diff --git a/src/Gui/QSint/actionpanel/actionbox.cpp b/src/Gui/QSint/actionpanel/actionbox.cpp index aea118fa33..4c92979e99 100644 --- a/src/Gui/QSint/actionpanel/actionbox.cpp +++ b/src/Gui/QSint/actionpanel/actionbox.cpp @@ -13,8 +13,8 @@ namespace QSint { -ActionBox::ActionBox(QWidget *parent) : - QFrame(parent) +ActionBox::ActionBox(QWidget *parent) + : QFrame(parent) { init(); } @@ -22,25 +22,23 @@ ActionBox::ActionBox(QWidget *parent) : ActionBox::ActionBox(const QString & headerText, QWidget *parent) : QFrame(parent) { - init(); - headerLabel->setText(headerText); + init(headerText); } ActionBox::ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent) : QFrame(parent) { - init(); - headerLabel->setText(headerText); + init(headerText); setIcon(icon); } -void ActionBox::init() +void ActionBox::init(const QString &headerText) { - setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Maximum); + setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum); - QHBoxLayout *mainLayout = new QHBoxLayout(this); + auto *mainLayout = new QHBoxLayout(this); - QVBoxLayout *iconLayout = new QVBoxLayout(); + auto *iconLayout = new QVBoxLayout(); mainLayout->addLayout(iconLayout); iconLabel = new QLabel(this); @@ -50,7 +48,7 @@ void ActionBox::init() dataLayout = new QVBoxLayout(); mainLayout->addLayout(dataLayout); - headerLabel = createItem(""); + headerLabel = createItem(headerText); headerLabel->setProperty("class", "header"); } @@ -92,9 +90,8 @@ QList ActionBox::createItems(QList actions) QLayout *l = createHBoxLayout(); - Q_FOREACH (QAction *action, actions) { - ActionLabel *act = createItem(action, l); - if (act) + for (QAction *action : actions) { + if (auto *act = createItem(action, l)) list.append(act); } @@ -106,7 +103,6 @@ ActionLabel* ActionBox::createItem(const QString & text, QLayout * l) ActionLabel *act = new ActionLabel(this); act->setText(text); act->setProperty("class", "action"); - act->setStyleSheet(""); if (l) l->addWidget(act); diff --git a/src/Gui/QSint/actionpanel/actionbox.h b/src/Gui/QSint/actionpanel/actionbox.h index 5f7500e5a3..bdedecc13c 100644 --- a/src/Gui/QSint/actionpanel/actionbox.h +++ b/src/Gui/QSint/actionpanel/actionbox.h @@ -172,7 +172,7 @@ public: explicit ActionBox(QWidget *parent = nullptr); /** Constructor. */ - explicit ActionBox(const QString & headerText, QWidget *parent = nullptr); + ActionBox(const QString & headerText, QWidget *parent = nullptr); /** Constructor. */ explicit ActionBox(const QPixmap & icon, const QString & headerText, QWidget *parent = nullptr); @@ -204,7 +204,7 @@ public: /** Creates action items from the \a actions list and returns the list of action items. \since 0.2 */ - QList createItems(QList actions); + QList createItems(const QList actions); /** Adds an action with \a text to the ActionBox and returns action item. */ @@ -245,7 +245,7 @@ public: QSize minimumSizeHint() const override; protected: - void init(); + void init(const QString &headerText = QString()); QVBoxLayout *dataLayout; QLabel *iconLabel;