Преглед на файлове

Fix workflow next button arrow and text

Only ctkPushButton can properly align the icon to the right of the text.
Julien Finet преди 13 години
родител
ревизия
335bb6918e
променени са 1 файла, в които са добавени 7 реда и са изтрити 6 реда
  1. 7 6
      Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp

+ 7 - 6
Libs/Widgets/ctkWorkflowButtonBoxWidget.cpp

@@ -21,13 +21,13 @@
 // Qt includes
 // Qt includes
 #include <QWidget>
 #include <QWidget>
 #include <QList>
 #include <QList>
-#include <QPushButton>
 #include <QBoxLayout>
 #include <QBoxLayout>
 #include <QDebug>
 #include <QDebug>
 #include <QPointer>
 #include <QPointer>
 #include <QStyle>
 #include <QStyle>
 
 
 // CTK includes
 // CTK includes
+#include "ctkPushButton.h"
 #include "ctkWorkflowButtonBoxWidget.h"
 #include "ctkWorkflowButtonBoxWidget.h"
 #include "ctkWorkflowStep.h"
 #include "ctkWorkflowStep.h"
 #include "ctkWorkflowWidgetStep.h"
 #include "ctkWorkflowWidgetStep.h"
@@ -54,9 +54,9 @@ public:
   typedef QMap<QPushButton*, ctkWorkflowStep*> ButtonToStepMapType;
   typedef QMap<QPushButton*, ctkWorkflowStep*> ButtonToStepMapType;
 
 
   // The buttons on the widget (maintain maps associating each forward/goTo button with its step)
   // The buttons on the widget (maintain maps associating each forward/goTo button with its step)
-  QPushButton*        BackButton;
+  ctkPushButton*      BackButton;
   QString             BackButtonDefaultText;
   QString             BackButtonDefaultText;
-  QPushButton*        NextButton;
+  ctkPushButton*      NextButton;
   QString             NextButtonDefaultText;
   QString             NextButtonDefaultText;
   ButtonToStepMapType GoToButtonToStepMap;
   ButtonToStepMapType GoToButtonToStepMap;
 
 
@@ -104,13 +104,14 @@ void ctkWorkflowButtonBoxWidgetPrivate::setupUi(QWidget * newParent)
   QIcon nextIcon = newParent->style()->standardIcon(QStyle::SP_ArrowRight);
   QIcon nextIcon = newParent->style()->standardIcon(QStyle::SP_ArrowRight);
 
 
   // Setup the buttons
   // Setup the buttons
-  this->BackButton = new QPushButton(backIcon, this->BackButtonDefaultText, newParent);
+  this->BackButton = new ctkPushButton(backIcon, this->BackButtonDefaultText, newParent);
   this->BackButton->setSizePolicy(this->ButtonSizePolicy);
   this->BackButton->setSizePolicy(this->ButtonSizePolicy);
+  this->BackButton->setIconAlignment(Qt::AlignLeft | Qt::AlignVCenter);
   newParent->layout()->addWidget(this->BackButton);
   newParent->layout()->addWidget(this->BackButton);
 
 
-  this->NextButton = new QPushButton(nextIcon, this->NextButtonDefaultText, newParent);
+  this->NextButton = new ctkPushButton(nextIcon, this->NextButtonDefaultText, newParent);
   this->NextButton->setSizePolicy(this->ButtonSizePolicy);
   this->NextButton->setSizePolicy(this->ButtonSizePolicy);
-  this->NextButton->setLayoutDirection(Qt::RightToLeft);
+  this->NextButton->setIconAlignment(Qt::AlignRight | Qt::AlignVCenter);
   newParent->layout()->addWidget(this->NextButton);
   newParent->layout()->addWidget(this->NextButton);
 }
 }