+ fix possible inconsistency of arrow button in task header

This commit is contained in:
wmayer 2015-07-08 22:23:24 +02:00
parent 1eb76ba48c
commit 5fc3370235
3 changed files with 25 additions and 1 deletions

View File

@ -143,6 +143,7 @@ void ActionGroup::processHide()
if (!--m_foldStep) {
myDummy->setFixedHeight(0);
myDummy->hide();
myHeader->setFold(false);
setFixedHeight(myHeader->height());
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
return;
@ -165,6 +166,7 @@ void ActionGroup::processShow()
myDummy->hide();
m_foldPixmap = QPixmap();
myGroup->show();
myHeader->setFold(true);
setFixedHeight(m_fullHeight+myHeader->height());
setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
setMaximumHeight(QWIDGETSIZE_MAX);

View File

@ -196,7 +196,9 @@ void TaskHeader::fold()
{
if (myExpandable) {
emit activated();
// Toggling the 'm_fold' member here may lead to inconsistencies with its ActionGroup.
// Thus, the method setFold() was added and called from ActionGroup when required.
#if 0
m_fold = !m_fold;
changeIcons();
if (myButton) {
@ -207,6 +209,23 @@ void TaskHeader::fold()
myButton->update();
}
}
#endif
}
}
void TaskHeader::setFold(bool on)
{
if (myExpandable) {
m_fold = on;
changeIcons();
if (myButton) {
myButton->setProperty("fold", m_fold);
if (myButton->style()) {
myButton->style()->unpolish(myButton);
myButton->style()->polish(myButton);
myButton->update();
}
}
}
}

View File

@ -37,6 +37,9 @@ public:
Q_SIGNALS:
void activated();
public:
void setFold(bool);
public Q_SLOTS:
void fold();