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 // 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/08/2010 Created this file. :-)
17 #include "arctangentialoptions.h"
19 #include "actiondrawarctangential.h"
23 ArcTangentialOptions::ArcTangentialOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
24 QWidget(parent, flags),
25 lRadius(new QLabel(tr("Radius:"))),
26 leRadius(new QLineEdit(this))
28 QHBoxLayout * layout = new QHBoxLayout(this);
29 layout->setContentsMargins(0, 0, 0, 0);
31 leRadius->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
33 layout->addWidget(lRadius);
34 layout->addWidget(leRadius);
36 connect(leRadius, SIGNAL(textChanged(QString)), this, SLOT(updateRadius(QString)));
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 ArcTangentialOptions::~ArcTangentialOptions()
46 settings.beginGroup("Draw");
47 settings.setValue("ArcTangentialRadius", leRadius->text());
51 void ArcTangentialOptions::setAction(ActionInterface * a, bool update)
53 if (a != NULL && a->rtti() == RS2::ActionDrawArcTangential)
55 action = (ActionDrawArcTangential *)a;
60 sr = QString("%1").arg(action->getRadius());
63 settings.beginGroup("Draw");
64 sr = settings.value("ArcTangentialRadius", "1.0").toString();
66 action->setRadius(sr.toDouble());
68 leRadius->setText(sr);
72 DEBUG->print(Debug::D_ERROR,
73 "ArcTangentialOptions::setAction: wrong action type");
78 /*void ArcTangentialOptions::init() {
80 RS_SETTINGS->beginGroup("/Draw");
81 bool reversed = RS_SETTINGS->readNumEntry("/ArcReversed", 0);
82 RS_SETTINGS->endGroup();
84 rbNeg->setChecked(reversed);
87 /*void ArcTangentialOptions::setData(ArcData* d) {
89 updateDirection(false);
92 void ArcTangentialOptions::updateRadius(const QString & s)
95 action->setRadius(Math::eval(s));