]> Shamusworld >> Repos - architektonas/blob - src/blockwidget.cpp
d6965c977c873861834f1fcb54e9d2a8d3a70349
[architektonas] / src / blockwidget.cpp
1 // blockwidget.cpp: Block add/remove/use widget
2 //
3 // Part of the Architektonas Project
4 // (C) 2011 Underground Software
5 // See the README and GPLv3 files for licensing and warranty information
6 //
7 // JLH = James Hammons <jlhamm@acm.org>
8 //
9 // WHO  WHEN        WHAT
10 // ---  ----------  ------------------------------------------------------------
11 // JLH  07/15/2013  Created this file
12 //
13
14 #include "blockwidget.h"
15 #include "blockitemwidget.h"
16
17
18 BlockWidget::BlockWidget(void): QWidget()
19 {
20         BlockItemWidget * biw1 = new BlockItemWidget("2x4");
21         BlockItemWidget * biw2 = new BlockItemWidget("2x6");
22         BlockItemWidget * biw3 = new BlockItemWidget("36\" door RHS");
23         BlockItemWidget * biw4 = new BlockItemWidget("36\" door LHS");
24         BlockItemWidget * biw5 = new BlockItemWidget("Person");
25
26         QListWidget * qlw = new QListWidget;
27         QListWidgetItem * qli1 = new QListWidgetItem(qlw);
28         QListWidgetItem * qli2 = new QListWidgetItem(qlw);
29         QListWidgetItem * qli3 = new QListWidgetItem(qlw);
30         QListWidgetItem * qli4 = new QListWidgetItem(qlw);
31         QListWidgetItem * qli5 = new QListWidgetItem(qlw);
32         qli1->setSizeHint(biw1->sizeHint());
33         qli2->setSizeHint(biw2->sizeHint());
34         qli3->setSizeHint(biw3->sizeHint());
35         qli4->setSizeHint(biw4->sizeHint());
36         qli5->setSizeHint(biw5->sizeHint());
37         qlw->setItemWidget(qli1, biw1);
38         qlw->setItemWidget(qli2, biw2);
39         qlw->setItemWidget(qli3, biw3);
40         qlw->setItemWidget(qli4, biw4);
41         qlw->setItemWidget(qli5, biw5);
42
43 #if 0
44         QPushButton * pb1 = new QPushButton("+");
45         QPushButton * pb2 = new QPushButton("-");
46         QPushButton * pb3 = new QPushButton("Edit");
47         QPushButton * pb4 = new QPushButton("Import");
48 #else
49         QToolButton * pb1 = new QToolButton;
50         QToolButton * pb2 = new QToolButton;
51         QToolButton * pb3 = new QToolButton;
52         QToolButton * pb4 = new QToolButton;
53
54         pb1->setIcon(QIcon(":/res/layer-add.png"));
55         pb2->setIcon(QIcon(":/res/layer-delete.png"));
56         pb3->setIcon(QIcon(":/res/layer-edit.png"));
57         pb4->setIcon(QIcon(":/res/block-import.png"));
58
59         pb1->setToolTip(tr("Add block"));
60         pb2->setToolTip(tr("Remove block"));
61         pb3->setToolTip(tr("Edit block"));
62         pb4->setToolTip(tr("Import block"));
63 #endif
64
65         QHBoxLayout * hbox1 = new QHBoxLayout;
66         hbox1->addWidget(pb1);
67         hbox1->addWidget(pb2);
68         hbox1->addWidget(pb3);
69         hbox1->addWidget(pb4);
70         hbox1->addStretch();
71
72         QVBoxLayout * mainLayout = new QVBoxLayout;
73         mainLayout->addWidget(qlw);
74         mainLayout->addLayout(hbox1);
75
76         setLayout(mainLayout);
77 }
78
79
80 BlockWidget::~BlockWidget()
81 {
82 }
83