src/action.h \
src/applicationwindow.h \
src/arc.h \
+ src/blockitemwidget.h \
src/blockwidget.h \
src/circle.h \
src/connection.h \
src/action.cpp \
src/applicationwindow.cpp \
src/arc.cpp \
+ src/blockitemwidget.cpp \
src/blockwidget.cpp \
src/circle.cpp \
src/connection.cpp \
dock1->setWidget(lw);
addDockWidget(Qt::RightDockWidgetArea, dock1);
QDockWidget * dock2 = new QDockWidget(tr("Blocks"), this);
-// BlockWidget * bw = new BlockWidget;
-// dock2->setWidget(bw);
+ BlockWidget * bw = new BlockWidget;
+ dock2->setWidget(bw);
addDockWidget(Qt::RightDockWidgetArea, dock2);
// Needed for saveState()
dock1->setObjectName("Layers");
--- /dev/null
+// layeritemwidget.cpp: Layer item widget
+//
+// Part of the Architektonas Project
+// (C) 2011 Underground Software
+// See the README and GPLv3 files for licensing and warranty information
+//
+// JLH = James Hammons <jlhamm@acm.org>
+//
+// WHO WHEN WHAT
+// --- ---------- ------------------------------------------------------------
+// JLH 07/13/2013 Created this file
+//
+
+#include "blockitemwidget.h"
+
+
+BlockItemWidget::BlockItemWidget(QString s, QPixmap * i/*=0*/):
+ QWidget(),
+ name(new QLabel(s)),
+ image(new QLabel)
+{
+ QHBoxLayout * mainLayout = new QHBoxLayout;
+ mainLayout->setContentsMargins(0, 0, 0, 0); // This is required, otherwise the layout engine puts too much space around this widget. :-/
+
+ if (i == 0)
+ {
+ i = new QPixmap(36, 32);
+ i->fill(); // Fills pixmap with white
+ QPainter p(i);
+ p.setPen(Qt::black);
+ p.drawLine(0, 0, 31, 31);
+ p.drawLine(0, 31, 31, 0);
+ }
+
+ image->setPixmap(*i);
+
+ mainLayout->addWidget(image);
+ mainLayout->addWidget(name);
+ mainLayout->addStretch();
+ setLayout(mainLayout);
+QSize size = mainLayout->sizeHint();
+printf("BlockItemWidget: size. w=%i, h=%i\n", size.width(), size.height());
+}
+
+
+BlockItemWidget::~BlockItemWidget()
+{
+}
+
--- /dev/null
+#ifndef __BLOCKITEMWIDGET_H__
+#define __BLOCKITEMWIDGET_H__
+
+#include <QtGui>
+
+class BlockItemWidget: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ BlockItemWidget(QString, QPixmap * i = 0);
+ ~BlockItemWidget();
+
+ public:
+ QLabel * name;
+ QLabel * image;
+};
+
+#endif // __BLOCKITEMWIDGET_H__
//
// WHO WHEN WHAT
// --- ---------- ------------------------------------------------------------
-// JLH 07/11/2013 Created this file
+// JLH 07/15/2013 Created this file
//
#include "blockwidget.h"
+#include "blockitemwidget.h"
+
+
+BlockWidget::BlockWidget(void): QWidget()
+{
+ BlockItemWidget * biw1 = new BlockItemWidget("2x4");
+ BlockItemWidget * biw2 = new BlockItemWidget("2x6");
+ BlockItemWidget * biw3 = new BlockItemWidget("36\" door RHS");
+ BlockItemWidget * biw4 = new BlockItemWidget("36\" door LHS");
+ BlockItemWidget * biw5 = new BlockItemWidget("Person");
+
+ QListWidget * qlw = new QListWidget;
+ QListWidgetItem * qli1 = new QListWidgetItem(qlw);
+ QListWidgetItem * qli2 = new QListWidgetItem(qlw);
+ QListWidgetItem * qli3 = new QListWidgetItem(qlw);
+ QListWidgetItem * qli4 = new QListWidgetItem(qlw);
+ QListWidgetItem * qli5 = new QListWidgetItem(qlw);
+ qli1->setSizeHint(biw1->sizeHint());
+ qli2->setSizeHint(biw2->sizeHint());
+ qli3->setSizeHint(biw3->sizeHint());
+ qli4->setSizeHint(biw4->sizeHint());
+ qli5->setSizeHint(biw5->sizeHint());
+ qlw->setItemWidget(qli1, biw1);
+ qlw->setItemWidget(qli2, biw2);
+ qlw->setItemWidget(qli3, biw3);
+ qlw->setItemWidget(qli4, biw4);
+ qlw->setItemWidget(qli5, biw5);
+
+ QPushButton * pb1 = new QPushButton("+");
+ QPushButton * pb2 = new QPushButton("-");
+ QPushButton * pb3 = new QPushButton("Edit");
+ QPushButton * pb4 = new QPushButton("Import");
+// QPushButton * pb5 = new QPushButton("v");
+
+ QHBoxLayout * hbox1 = new QHBoxLayout;
+ hbox1->addWidget(pb1);
+ hbox1->addWidget(pb2);
+ hbox1->addWidget(pb3);
+ hbox1->addWidget(pb4);
+// hbox1->addWidget(pb5);
+ hbox1->addStretch();
+
+ QVBoxLayout * mainLayout = new QVBoxLayout;
+ mainLayout->addWidget(qlw);
+ mainLayout->addLayout(hbox1);
+
+ setLayout(mainLayout);
+}
+
+
+BlockWidget::~BlockWidget()
+{
+}
+
+#ifndef __BLOCKWIDGET_H__
+#define __BLOCKWIDGET_H__
+
+#include <QtGui>
+
+class BlockWidget: public QWidget
+{
+ Q_OBJECT
+
+ public:
+ BlockWidget(void);
+ ~BlockWidget();
+
+};
+
+#endif // __BLOCKWIDGET_H__