2 // blockwidget.cpp: Block add/remove/use widget
4 // Part of the Architektonas Project
5 // (C) 2011 Underground Software
6 // See the README and GPLv3 files for licensing and warranty information
8 // JLH = James Hammons <jlhamm@acm.org>
11 // --- ---------- ------------------------------------------------------------
12 // JLH 07/15/2013 Created this file
15 #include "blockwidget.h"
16 #include "blockitemwidget.h"
18 BlockWidget::BlockWidget(void): QWidget()
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");
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);
44 QPushButton * pb1 = new QPushButton("+");
45 QPushButton * pb2 = new QPushButton("-");
46 QPushButton * pb3 = new QPushButton("Edit");
47 QPushButton * pb4 = new QPushButton("Import");
49 QToolButton * pb1 = new QToolButton;
50 QToolButton * pb2 = new QToolButton;
51 QToolButton * pb3 = new QToolButton;
52 QToolButton * pb4 = new QToolButton;
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"));
59 pb1->setToolTip(tr("Add block"));
60 pb2->setToolTip(tr("Remove block"));
61 pb3->setToolTip(tr("Edit block"));
62 pb4->setToolTip(tr("Import block"));
65 QHBoxLayout * hbox1 = new QHBoxLayout;
66 hbox1->addWidget(pb1);
67 hbox1->addWidget(pb2);
68 hbox1->addWidget(pb3);
69 hbox1->addWidget(pb4);
72 QVBoxLayout * mainLayout = new QVBoxLayout;
73 mainLayout->addWidget(qlw);
74 mainLayout->addLayout(hbox1);
76 setLayout(mainLayout);
79 BlockWidget::~BlockWidget()