+ extend QSint API, fix problems with Qt macro

This commit is contained in:
wmayer 2015-07-07 11:42:24 +02:00
parent 83bef31698
commit 61db2cb15e
5 changed files with 33 additions and 5 deletions

View File

@ -167,7 +167,7 @@ void ActionGroup::processShow()
myGroup->show(); myGroup->show();
setFixedHeight(m_fullHeight+myHeader->height()); setFixedHeight(m_fullHeight+myHeader->height());
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setMaximumHeight(9999); setMaximumHeight(QWIDGETSIZE_MAX);
setMinimumHeight(0); setMinimumHeight(0);
return; return;
} }

View File

@ -17,7 +17,7 @@ namespace QSint
ActionPanel::ActionPanel(QWidget *parent) : ActionPanel::ActionPanel(QWidget *parent) :
BaseClass(parent) BaseClass(parent), mySpacer(0)
{ {
setProperty("class", "panel"); setProperty("class", "panel");
@ -64,9 +64,28 @@ void ActionPanel::addWidget(QWidget *w)
layout()->addWidget(w); layout()->addWidget(w);
} }
void ActionPanel::removeWidget(QWidget *w)
{
if (w)
layout()->removeWidget(w);
}
void ActionPanel::addStretch(int s) 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() ActionGroup * ActionPanel::createGroup()

View File

@ -9,6 +9,7 @@
#define ACTIONPANEL_H #define ACTIONPANEL_H
#include <QFrame> #include <QFrame>
#include <QSpacerItem>
#include "qsint_global.h" #include "qsint_global.h"
@ -50,12 +51,20 @@ public:
*/ */
void addWidget(QWidget *w); 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. /** 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 Normally you should do this after all the ActionGroups were added, in order to
maintain some space below. maintain some space below.
*/ */
void addStretch(int s = 0); 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. /** Creates and adds to the ActionPanel's vertical layout an empty ActionGroup without header.
*/ */
ActionGroup* createGroup(); ActionGroup* createGroup();
@ -86,6 +95,7 @@ protected:
//virtual void paintEvent ( QPaintEvent * event ); //virtual void paintEvent ( QPaintEvent * event );
ActionPanelScheme *myScheme; ActionPanelScheme *myScheme;
QSpacerItem *mySpacer;
}; };

View File

@ -37,7 +37,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void activated(); void activated();
public slots: public Q_SLOTS:
void fold(); void fold();
protected Q_SLOTS: protected Q_SLOTS:

View File

@ -10,7 +10,6 @@
#include "actionpanelscheme.h" #include "actionpanelscheme.h"
namespace QSint namespace QSint
{ {