From 61db2cb15eabd86b8f87bd2c8e823e94cebd255f Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 7 Jul 2015 11:42:24 +0200 Subject: [PATCH] + extend QSint API, fix problems with Qt macro --- src/Gui/QSint/actionpanel/actiongroup.cpp | 2 +- src/Gui/QSint/actionpanel/actionpanel.cpp | 23 ++++++++++++++++++-- src/Gui/QSint/actionpanel/actionpanel.h | 10 +++++++++ src/Gui/QSint/actionpanel/taskheader_p.h | 2 +- src/Gui/QSint/actionpanel/winxppanelscheme.h | 1 - 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index 951f18e2c..652501741 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -167,7 +167,7 @@ void ActionGroup::processShow() myGroup->show(); setFixedHeight(m_fullHeight+myHeader->height()); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - setMaximumHeight(9999); + setMaximumHeight(QWIDGETSIZE_MAX); setMinimumHeight(0); return; } diff --git a/src/Gui/QSint/actionpanel/actionpanel.cpp b/src/Gui/QSint/actionpanel/actionpanel.cpp index 28f395554..c34cae066 100644 --- a/src/Gui/QSint/actionpanel/actionpanel.cpp +++ b/src/Gui/QSint/actionpanel/actionpanel.cpp @@ -17,7 +17,7 @@ namespace QSint ActionPanel::ActionPanel(QWidget *parent) : - BaseClass(parent) + BaseClass(parent), mySpacer(0) { setProperty("class", "panel"); @@ -64,9 +64,28 @@ void ActionPanel::addWidget(QWidget *w) layout()->addWidget(w); } +void ActionPanel::removeWidget(QWidget *w) +{ + if (w) + layout()->removeWidget(w); +} + void ActionPanel::addStretch(int s) { - ((QVBoxLayout*)layout())->addStretch(s); + //((QVBoxLayout*)layout())->addStretch(s); + if (!mySpacer) { + mySpacer = new QSpacerItem(0,0,QSizePolicy::Minimum, QSizePolicy::Expanding); + layout()->addItem(mySpacer); + } +} + +void ActionPanel::removeStretch() +{ + if (mySpacer) { + layout()->removeItem(mySpacer); + delete mySpacer; + mySpacer = 0; + } } ActionGroup * ActionPanel::createGroup() diff --git a/src/Gui/QSint/actionpanel/actionpanel.h b/src/Gui/QSint/actionpanel/actionpanel.h index d6557057f..0dc2a0860 100644 --- a/src/Gui/QSint/actionpanel/actionpanel.h +++ b/src/Gui/QSint/actionpanel/actionpanel.h @@ -9,6 +9,7 @@ #define ACTIONPANEL_H #include +#include #include "qsint_global.h" @@ -50,12 +51,20 @@ public: */ void addWidget(QWidget *w); + /** Removes the widget \a w from the ActionPanel's vertical layout. + */ + void removeWidget(QWidget *w); + /** Adds a spacer with width \a s to the ActionPanel's vertical layout. Normally you should do this after all the ActionGroups were added, in order to maintain some space below. */ void addStretch(int s = 0); + /** Removes the spacer -- if added -- from the ActionPanel's vertical layout. + */ + void removeStretch(); + /** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup without header. */ ActionGroup* createGroup(); @@ -86,6 +95,7 @@ protected: //virtual void paintEvent ( QPaintEvent * event ); ActionPanelScheme *myScheme; + QSpacerItem *mySpacer; }; diff --git a/src/Gui/QSint/actionpanel/taskheader_p.h b/src/Gui/QSint/actionpanel/taskheader_p.h index 5417e1c15..60801a5a5 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.h +++ b/src/Gui/QSint/actionpanel/taskheader_p.h @@ -37,7 +37,7 @@ public: Q_SIGNALS: void activated(); -public slots: +public Q_SLOTS: void fold(); protected Q_SLOTS: diff --git a/src/Gui/QSint/actionpanel/winxppanelscheme.h b/src/Gui/QSint/actionpanel/winxppanelscheme.h index 24be48f9f..5a93a2c64 100644 --- a/src/Gui/QSint/actionpanel/winxppanelscheme.h +++ b/src/Gui/QSint/actionpanel/winxppanelscheme.h @@ -10,7 +10,6 @@ #include "actionpanelscheme.h" - namespace QSint {