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 05/28/2010 Created this file. :-)
15 #include "textoptions.h"
17 #include "rs_actiondrawtext.h"
18 #include "rs_actioninterface.h"
20 TextOptions::TextOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
21 QWidget(parent, flags)
25 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
26 // nothing will show up on the screen. :-)
28 parent->addWidget(this);
31 TextOptions::~TextOptions()
35 void TextOptions::setAction(RS_ActionInterface * a, bool update)
37 if (a != NULL && a->rtti() == RS2::ActionDrawText)
39 action = (RS_ActionDrawText *)a;
46 st = action->getText();
47 sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
55 ui.teText->setText(st);
56 ui.leAngle->setText(sa);
60 RS_DEBUG->print(RS_Debug::D_ERROR, "TextOptions::setAction: wrong action type");
65 void TextOptions::updateText()
68 action->setText(ui.teText->text());
71 void TextOptions::updateAngle()
74 action->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));