]> Shamusworld >> Repos - architektonas/blob - src/layerwidget.cpp
More work on LayerWidget. Not functional yet.
[architektonas] / src / layerwidget.cpp
1 // layerwidget.cpp: Layer 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/11/2013  Created this file
12 //
13
14 #include "layerwidget.h"
15 #include "layeritemwidget.h"
16
17
18 #if 0
19 OK, what it seems like we should do here, is instead of deriving from QDockWidget,
20 we should derive from QWidget (or QScrollArea or somesuch). Then, when creating
21 the dockwidget in the main window, we add the LayerWidget as the QDockWidget's
22 main widget.
23 #endif
24
25 LayerWidget::LayerWidget(void): QWidget()
26 {
27
28         // Make a QScrollArea, put in a QVBoxLayout.
29         // Use line widget (two checkboxes, one label), use setIcon() on the
30         // checkboxes to change their look (eye open/closed for visibility,
31         // lock open/closed for layer lock).
32
33         QIcon visible(":/res/eye-open.png");
34         visible.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
35         QIcon locked(":/res/lock-open.png");
36         locked.addFile(":/res/lock-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
37
38         QVBoxLayout * mainLayout = new QVBoxLayout;
39         QHBoxLayout * line1 = new QHBoxLayout;
40         QHBoxLayout * line2 = new QHBoxLayout;
41
42 //      QCheckBox * box1 = new QCheckBox("bleah");
43 //      box1->setIcon(visible);
44 //      mainLayout->addWidget(box1);
45
46         QPushButton * button1 = new QPushButton;
47         button1->setFlat(true);
48         button1->setIcon(visible);
49         button1->setCheckable(true);
50         button1->setMaximumSize(QSize(20, 20));
51         QPushButton * button2 = new QPushButton;
52         button2->setFlat(true);
53         button2->setIcon(locked);
54         button2->setCheckable(true);
55         button2->setMaximumSize(QSize(20, 20));
56         QLabel * label1 = new QLabel("Background");
57
58         QPushButton * button3 = new QPushButton;
59         button3->setFlat(true);
60         button3->setIcon(visible);
61         button3->setCheckable(true);
62         button3->setMaximumSize(QSize(20, 20));
63         QPushButton * button4 = new QPushButton;
64         button4->setFlat(true);
65         button4->setIcon(locked);
66         button4->setCheckable(true);
67         button4->setMaximumSize(QSize(20, 20));
68         QLabel * label2 = new QLabel("Guides");
69
70         line1->addWidget(button1);
71         line1->addWidget(button2);
72         line1->addWidget(label1);
73
74         line2->addWidget(button3);
75         line2->addWidget(button4);
76         line2->addWidget(label2);
77
78         LayerItemWidget * liw1 = new LayerItemWidget("Floor #1");
79         LayerItemWidget * liw2 = new LayerItemWidget("Mechanical");
80         
81         mainLayout->addLayout(line1);
82         mainLayout->addLayout(line2);
83         mainLayout->addWidget(liw1);
84         mainLayout->addWidget(liw2);
85         mainLayout->addStretch();
86         setLayout(mainLayout);
87 }
88
89
90 LayerWidget::~LayerWidget()
91 {
92 }
93