1 // arctangentialoptions.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/08/2010 Created this file. :-)
15 #include "arctangentialoptions.h"
17 #include "actiondrawarctangential.h"
20 ArcTangentialOptions::ArcTangentialOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21 QWidget(parent, flags),
22 lRadius(new QLabel(tr("Radius:"))),
23 leRadius(new QLineEdit(this))
25 QHBoxLayout * layout = new QHBoxLayout(this);
26 layout->setContentsMargins(0, 0, 0, 0);
28 leRadius->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
30 layout->addWidget(lRadius);
31 layout->addWidget(leRadius);
33 connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateRadius(QString)));
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 ArcTangentialOptions::~ArcTangentialOptions()
43 settings.beginGroup("Draw");
44 settings.setValue("ArcTangentialRadius", leRadius->text());
48 void ArcTangentialOptions::setAction(ActionInterface * a, bool update)
50 if (a != NULL && a->rtti() == RS2::ActionDrawArcTangential)
52 action = (ActionDrawArcTangential *)a;
57 sr = QString("%1").arg(action->getRadius());
60 settings.beginGroup("Draw");
61 sr = settings.value("ArcTangentialRadius", "1.0").toString();
63 action->setRadius(sr.toDouble());
65 leRadius->setText(sr);
69 RS_DEBUG->print(RS_Debug::D_ERROR,
70 "ArcTangentialOptions::setAction: wrong action type");
75 /*void ArcTangentialOptions::init() {
77 RS_SETTINGS->beginGroup("/Draw");
78 bool reversed = RS_SETTINGS->readNumEntry("/ArcReversed", 0);
79 RS_SETTINGS->endGroup();
81 rbNeg->setChecked(reversed);
84 /*void ArcTangentialOptions::setData(RS_ArcData* d) {
86 updateDirection(false);
89 void ArcTangentialOptions::updateRadius(const QString & s)
92 action->setRadius(RS_Math::eval(s));