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 05/28/2010 Created this file. :-)
17 #include "textoptions.h"
19 #include "actiondrawtext.h"
20 #include "actioninterface.h"
22 TextOptions::TextOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
23 QWidget(parent, flags)
27 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
28 // nothing will show up on the screen. :-)
30 parent->addWidget(this);
33 TextOptions::~TextOptions()
37 void TextOptions::setAction(ActionInterface * a, bool update)
39 if (a != NULL && a->rtti() == RS2::ActionDrawText)
41 action = (ActionDrawText *)a;
48 st = action->getText();
49 sa = QString("%1").arg(RS_Math::rad2deg(action->getAngle()));
57 ui.teText->setText(st);
58 ui.leAngle->setText(sa);
62 RS_DEBUG->print(RS_Debug::D_ERROR, "TextOptions::setAction: wrong action type");
67 void TextOptions::updateText()
70 action->setText(ui.teText->text());
73 void TextOptions::updateAngle()
76 action->setAngle(RS_Math::deg2rad(RS_Math::eval(ui.leAngle->text())));