X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fforms%2Fcadtoolbarselect.cpp;h=6a70ceca0dd94923efc10aa0f983f21f2d09a75a;hb=d774c2655ba2c3657a565f325411144452392277;hp=27eee4e9a09e22bf6d6364cf655b934f9afd4ee3;hpb=f7188d32d0beaef31fc3475be05daea2f018ebec;p=architektonas diff --git a/src/forms/cadtoolbarselect.cpp b/src/forms/cadtoolbarselect.cpp index 27eee4e..6a70cec 100644 --- a/src/forms/cadtoolbarselect.cpp +++ b/src/forms/cadtoolbarselect.cpp @@ -15,42 +15,37 @@ #include "cadtoolbarselect.h" #include "qg_actionhandler.h" -#include "rs_actioninterface.h" +#include "actioninterface.h" #include "cadtoolbar.h" #include "createqtactions.h" CadToolBarSelect::CadToolBarSelect(CadToolBar * parent, Qt::WindowFlags flags/*= 0*/): - QWidget((QWidget *)parent, flags), cadToolBar(parent), actionHandler(NULL), - selectAction(NULL), nextAction(-1) + QWidget((QWidget *)parent, flags), actionHandler(NULL), selectAction(NULL), + nextAction(-1) { - actionHandler = cadToolBar->getActionHandler(); + actionHandler = parent->getActionHandler(); QGridLayout * gridLayout = new QGridLayout(this); gridLayout->setSpacing(0); gridLayout->setContentsMargins(0, 0, 0, 0); - QAction * actionBack = new QAction(QIcon(":/res/qg_back"), tr("Back"), this); - QToolButton * button = new QToolButton(this); - button->setDefaultAction(actionBack); - QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); - button->setSizePolicy(policy); - gridLayout->addWidget(button, 0, 0, 1, 2); - connect(button, SIGNAL(clicked()), this, SLOT(back())); + gridLayout->addWidget(parent->CreateBackButton(this), 0, 0, 1, 2); - gridLayout->addWidget(CreateToolButton(actionDeselectAll), 1, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectAll), 1, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectSingle), 2, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectContour), 2, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionDeselectWindow), 3, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectWindow), 3, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectIntersected), 4, 1, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectInvert), 5, 0, 1, 1); - gridLayout->addWidget(CreateToolButton(actionSelectLayer), 5, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectAll), 1, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectAll), 1, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectSingle), 2, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectContour), 2, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectWindow), 3, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectWindow), 3, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionDeselectIntersected), 4, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectIntersected), 4, 1, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectInvert), 5, 0, 1, 1); + gridLayout->addWidget(parent->CreateToolButton(actionSelectLayer), 5, 1, 1, 1); QAction * actionDoit = new QAction(QIcon(":/res/qg_forward"), tr("Forward"), this); doit = new QToolButton(this); doit->setDefaultAction(actionDoit); + QSizePolicy policy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred); doit->setSizePolicy(policy); gridLayout->addWidget(doit, 6, 0, 1, 2); connect(doit, SIGNAL(clicked()), this, SLOT(runNextAction())); @@ -61,7 +56,7 @@ CadToolBarSelect::~CadToolBarSelect() } //hmm, should these three funcs be here??? -void CadToolBarSelect::setSelectAction(RS_ActionInterface * selectAction) +void CadToolBarSelect::setSelectAction(ActionInterface * selectAction) { this->selectAction = selectAction; } @@ -78,32 +73,15 @@ void CadToolBarSelect::setNextAction(int nextAction) void CadToolBarSelect::runNextAction() { -//printf("CadToolBarSelect::runNextAction(): Entered function...\n"); if (selectAction) { -//printf("CadToolBarSelect::runNextAction(): About to do selectAction...\n"); selectAction->finish(); selectAction = NULL; } if (nextAction != -1) { -//printf("CadToolBarSelect::runNextAction(): About to do nextAction...\n"); actionHandler->killSelectActions(); actionHandler->setCurrentAction((RS2::ActionType)nextAction); } } - -void CadToolBarSelect::back() -{ - cadToolBar->back(); -} - -QToolButton * CadToolBarSelect::CreateToolButton(QAction * action) -{ - QToolButton * button = new QToolButton(this); - button->setDefaultAction(action); - button->setIconSize(QSize(18, 18)); - - return button; -}