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. :-)
15 // JLH 06/08/2010 Fixed problem with widget not showing up in toolbar.
18 #include "arcoptions.h"
20 #include "actiondrawarc.h"
21 #include "actioninterface.h"
25 ArcOptions::ArcOptions(QToolBar * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
26 QWidget(parent, flags),
27 rbPos(new QRadioButton(this)),
28 rbNeg(new QRadioButton(this))
30 QHBoxLayout * layout = new QHBoxLayout(this);
31 layout->setContentsMargins(0, 0, 0, 0);
33 rbPos->setIcon(QIcon(":/res/qg_dirpos"));
34 rbNeg->setIcon(QIcon(":/res/qg_dirneg"));
36 layout->addWidget(rbPos);
37 layout->addWidget(rbNeg);
39 connect(rbPos, SIGNAL(toggled(bool)), this, SLOT(updateDirection(bool)));
40 connect(rbNeg, SIGNAL(toggled(bool)), this, SLOT(updateDirection(bool)));
42 // We need to add the widget (this thing) to the toolbar passed in. Otherwise,
43 // nothing will show up on the screen. :-)
45 parent->addWidget(this);
48 ArcOptions::~ArcOptions()
50 settings.beginGroup("Draw");
51 settings.setValue("ArcReversed", rbNeg->isChecked());
55 void ArcOptions::setAction(ActionInterface * a, bool update)
57 if (a != NULL && a->rtti() == RS2::ActionDrawArc)
59 action = (ActionDrawArc *)a;
64 reversed = action->isReversed();
67 settings.beginGroup("Draw");
68 reversed = settings.value("ArcReversed", false).toBool();
70 action->setReversed(reversed);
73 rbNeg->setChecked(reversed);
77 DEBUG->print(Debug::D_ERROR, "QG_ArcOptions::setAction: wrong action type");
82 void ArcOptions::updateDirection(bool /*pos*/)
85 action->setReversed(rbNeg->isChecked());