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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/10/2010 Created this file. :-)
17 #include "linepolygon2options.h"
19 #include "actiondrawlinepolygon2.h"
23 LinePolygon2Options::LinePolygon2Options(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
24 QWidget(parent, flags),
25 lNumber(new QLabel(tr("Number:"))),
26 sbNumber(new QSpinBox(this))
28 QHBoxLayout * layout = new QHBoxLayout(this);
29 layout->setContentsMargins(0, 0, 0, 0);
31 // leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
33 layout->addWidget(lNumber);
34 layout->addWidget(sbNumber);
36 connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
38 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
39 // nothing will show up on the screen. :-)
41 parent->addWidget(this);
44 LinePolygon2Options::~LinePolygon2Options()
46 settings.beginGroup("Draw");
47 settings.setValue("LinePolygon2Number", sbNumber->text());
51 void LinePolygon2Options::setAction(ActionInterface * a, bool update)
53 if (a != NULL && a->rtti() == RS2::ActionDrawLinePolygon2)
55 action = (ActionDrawLinePolygon2 *)a;
60 sn = QString("%1").arg(action->getNumber());
63 settings.beginGroup("Draw");
64 sn = settings.value("LinePolygon2Number", "3").toString();
68 sbNumber->setValue(sn.toInt());
72 DEBUG->print(Debug::D_ERROR, "LinePolygon2Options::setAction: wrong action type");
77 void LinePolygon2Options::updateNumber(int n)