1 // moverotateoptions.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/09/2010 Created this file. :-)
15 #include "moverotateoptions.h"
17 #include "actionmodifymoverotate.h"
20 MoveRotateOptions::MoveRotateOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21 QWidget(parent, flags),
22 lAngle(new QLabel(tr("Angle:"))),
23 leAngle(new QLineEdit(this))
25 QHBoxLayout * layout = new QHBoxLayout(this);
26 layout->setContentsMargins(0, 0, 0, 0);
28 leAngle->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored));
30 layout->addWidget(lAngle);
31 layout->addWidget(leAngle);
33 connect(leAngle, SIGNAL(textChanged(QString)), this, SLOT(updateAngle(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 MoveRotateOptions::~MoveRotateOptions()
43 settings.beginGroup("Modify");
44 settings.setValue("MoveRotate", leAngle->text());
48 void MoveRotateOptions::setAction(ActionInterface * a, bool update)
50 if (a != NULL && a->rtti() == RS2::ActionModifyMoveRotate)
52 action = (ActionModifyMoveRotate *)a;
57 sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
60 settings.beginGroup("Modify");
61 sa = settings.value("MoveRotate", "30").toString();
63 action->setAngle(RS_Math::deg2rad(sa.toDouble()));
70 RS_DEBUG->print(RS_Debug::D_ERROR, "CircleOptions::setAction: wrong action type");
75 void MoveRotateOptions::updateAngle(const QString & a)
78 action->setAngle(RS_Math::deg2rad(RS_Math::eval(a)));