1 // lineparallelthroughoptions.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 "lineparallelthroughoptions.h"
17 #include "actiondrawlineparallelthrough.h"
20 LineParallelThroughOptions::LineParallelThroughOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21 QWidget(parent, flags),
22 lNumber(new QLabel(tr("Number:"))),
23 sbNumber(new QSpinBox(this))
25 QHBoxLayout * layout = new QHBoxLayout(this);
26 layout->setContentsMargins(0, 0, 0, 0);
28 // leDist->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
30 layout->addWidget(lNumber);
31 layout->addWidget(sbNumber);
33 connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(updateNumber(int)));
35 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
36 // nothing will show up on the screen. :-)
38 parent->addWidget(this);
41 LineParallelThroughOptions::~LineParallelThroughOptions()
43 settings.beginGroup("Draw");
44 settings.setValue("LineParallelNumber", sbNumber->text());
48 void LineParallelThroughOptions::setAction(ActionInterface * a, bool update)
50 if (a != NULL && a->rtti() == RS2::ActionDrawLineParallelThrough)
52 action = (ActionDrawLineParallelThrough *)a;
57 sn = QString("%1").arg(action->getNumber());
60 settings.beginGroup("Draw");
61 sn = settings.value("LineParallelNumber", "1").toString();
65 sbNumber->setValue(sn.toInt());
69 RS_DEBUG->print(RS_Debug::D_ERROR, "LineParallelThroughOptions::setAction: wrong action type");
74 void LineParallelThroughOptions::updateNumber(int n)