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/10/2010 Created this file. :-)
15 #include "cadtoolbararcs.h"
18 #include "cadtoolbar.h"
19 #include "qg_actionhandler.h"
22 CadToolBarArcs::CadToolBarArcs(QWidget * parent/*= 0*/, Qt::WindowFlags flags/*= 0*/):
23 QWidget(parent, flags), actionHandler(NULL), cadToolBar(NULL)
28 CadToolBarArcs::~CadToolBarArcs()
32 /*void QG_CadToolBarArcs::mousePressEvent(QMouseEvent* e) {
33 if (e->button()==RightButton && cadToolBar!=NULL) {
39 void CadToolBarArcs::contextMenuEvent(QContextMenuEvent * e)
44 void CadToolBarArcs::setCadToolBar(CadToolBar * tb)
49 actionHandler = tb->getActionHandler();
51 RS_DEBUG->print(RS_Debug::D_ERROR, "CadToolBarArcs::setCadToolBar(): No valid toolbar set.");
54 void CadToolBarArcs::drawArc()
56 if (cadToolBar != NULL && actionHandler != NULL)
57 actionHandler->slotDrawArc();
60 void CadToolBarArcs::drawArc3P()
62 if (cadToolBar != NULL && actionHandler != NULL)
63 actionHandler->slotDrawArc3P();
66 void CadToolBarArcs::drawArcParallel()
68 if (cadToolBar != NULL && actionHandler != NULL)
69 actionHandler->slotDrawArcParallel();
72 void CadToolBarArcs::drawArcTangential()
74 if (cadToolBar != NULL && actionHandler != NULL)
75 actionHandler->slotDrawArcTangential();
78 void CadToolBarArcs::back()
80 if (cadToolBar != NULL)
84 #include "cadtoolbar.h"
85 #include "createqtactions.h"
87 CadToolBarArcs::CadToolBarArcs(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/):
88 QWidget((QWidget *)parent, flags), cadToolBar(parent)
90 QGridLayout * gridLayout = new QGridLayout(this);
91 gridLayout->setSpacing(0);
92 gridLayout->setContentsMargins(0, 0, 0, 0);
94 QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this);
95 QToolButton * button = new QToolButton(this);
96 button->setDefaultAction(actionBack);
97 QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
98 button->setSizePolicy(policy);
99 gridLayout->addWidget(button, 0, 0, 1, 2);
100 connect(button, SIGNAL(triggered(QAction *)), this, SLOT(back()));
102 gridLayout->addWidget(CreateToolButton(actionDrawArc), 1, 0, 1, 1);
103 gridLayout->addWidget(CreateToolButton(actionDrawArc3P), 1, 1, 1, 1);
104 gridLayout->addWidget(CreateToolButton(actionDrawArcParallel), 2, 0, 1, 1);
105 gridLayout->addWidget(CreateToolButton(actionDrawArcTangential), 2, 1, 1, 1);
108 CadToolBarArcs::~CadToolBarArcs()
112 void CadToolBarArcs::back()
117 QToolButton * CadToolBarArcs::CreateToolButton(QAction * action)
119 QToolButton * button = new QToolButton(this);
120 button->setDefaultAction(action);
121 button->setIconSize(QSize(18, 18));