1 // linepolygon2options.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/10/2010 Created this file. :-)
15 #include "linepolygon2options.h"
17 #include "rs_actiondrawlinepolygon2.h"
21 LinePolygon2Options::LinePolygon2Options(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
22 QWidget(parent, flags),
23 lNumber(new QLabel(tr("Number:"))),
24 sbNumber(new QSpinBox(this))
26 QHBoxLayout * layout = new QHBoxLayout(this);
27 layout->setContentsMargins(0, 0, 0, 0);
29 // leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
31 layout->addWidget(lNumber);
32 layout->addWidget(sbNumber);
34 connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
36 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
37 // nothing will show up on the screen. :-)
39 parent->addWidget(this);
42 LinePolygon2Options::~LinePolygon2Options()
44 settings.beginGroup("Draw");
45 settings.setValue("LinePolygon2Number", sbNumber->text());
49 void LinePolygon2Options::setAction(RS_ActionInterface * a, bool update)
51 if (a != NULL && a->rtti() == RS2::ActionDrawLinePolygon2)
53 action = (RS_ActionDrawLinePolygon2 *)a;
58 sn = QString("%1").arg(action->getNumber());
61 settings.beginGroup("Draw");
62 sn = settings.value("LinePolygon2Number", "3").toString();
66 sbNumber->setValue(sn.toInt());
70 RS_DEBUG->print(RS_Debug::D_ERROR, "LinePolygon2Options::setAction: wrong action type");
75 void LinePolygon2Options::updateNumber(int n)