1 // layeritemwidget.cpp: Layer item widget
3 // Part of the Architektonas Project
4 // (C) 2011 Underground Software
5 // See the README and GPLv3 files for licensing and warranty information
7 // JLH = James Hammons <jlhamm@acm.org>
10 // --- ---------- ------------------------------------------------------------
11 // JLH 07/13/2013 Created this file
14 #include "layeritemwidget.h"
17 LayerItemWidget::LayerItemWidget(QString s, bool invisible/*=false*/, bool locked/*=false*/):
20 visibility(new QPushButton),
21 editibility(new QPushButton)
23 QIcon visibleIcon(":/res/eye-open.png");
24 visibleIcon.addFile(":/res/eye-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
25 QIcon lockedIcon(":/res/lock-open.png");
26 lockedIcon.addFile(":/res/lock-closed.png", QSize(16, 16), QIcon::Normal, QIcon::On);
27 QSize buttonSize(20, 20);
29 QHBoxLayout * mainLayout = new QHBoxLayout;
30 mainLayout->setContentsMargins(0, 0, 0, 0); // This is required, otherwise the layout engine puts too much space around this widget. :-/
32 visibility->setFlat(true);
33 visibility->setIcon(visibleIcon);
34 visibility->setCheckable(true);
35 visibility->setMaximumSize(buttonSize);
36 visibility->setChecked(invisible);
38 editibility->setFlat(true);
39 editibility->setIcon(lockedIcon);
40 editibility->setCheckable(true);
41 editibility->setMaximumSize(buttonSize);
42 editibility->setChecked(locked);
44 mainLayout->addWidget(visibility);
45 mainLayout->addWidget(editibility);
46 mainLayout->addWidget(name);
47 setLayout(mainLayout);
51 LayerItemWidget::~LayerItemWidget()