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"
23 TextOptions::TextOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
24 QWidget(parent, flags)
28 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
29 // nothing will show up on the screen. :-)
31 parent->addWidget(this);
34 TextOptions::~TextOptions()
38 void TextOptions::setAction(ActionInterface * a, bool update)
40 if (a != NULL && a->rtti() == RS2::ActionDrawText)
42 action = (ActionDrawText *)a;
49 st = action->getText();
50 sa = QString("%1").arg(Math::rad2deg(action->getAngle()));
58 ui.teText->setText(st);
59 ui.leAngle->setText(sa);
63 DEBUG->print(Debug::D_ERROR, "TextOptions::setAction: wrong action type");
68 void TextOptions::updateText()
71 action->setText(ui.teText->text());
74 void TextOptions::updateAngle()
77 action->setAngle(Math::deg2rad(Math::eval(ui.leAngle->text())));