diff --git a/src/Gui/QSint/actionpanel/actiongroup.cpp b/src/Gui/QSint/actionpanel/actiongroup.cpp index 9f90350619..e85e29c308 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.cpp +++ b/src/Gui/QSint/actionpanel/actiongroup.cpp @@ -11,6 +11,8 @@ #include #include #include +#include +#include namespace QSint { @@ -42,7 +44,6 @@ ActionGroup::~ActionGroup() = default; void ActionGroup::init(bool hasHeader) { m_foldStep = 0; - myScheme = ActionPanelScheme::defaultScheme(); auto *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); @@ -58,6 +59,7 @@ void ActionGroup::init(bool hasHeader) myDummy->hide(); connect(myHeader.get(), &TaskHeader::activated, this, &ActionGroup::showHide); + } QBoxLayout* ActionGroup::groupLayout() @@ -94,24 +96,22 @@ void ActionGroup::showHide() if (myGroup->isVisible()) { - m_foldPixmap = myGroup->transparentRender(); m_tempHeight = m_fullHeight = myGroup->height(); - m_foldDelta = m_fullHeight / myScheme->groupFoldSteps; - m_foldStep = myScheme->groupFoldSteps; + m_foldDelta = m_fullHeight / 20; // foldsteps + m_foldStep = 20; m_foldDirection = -1; myGroup->hide(); myDummy->setFixedSize(myGroup->size()); - - QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processHide); + QTimer::singleShot(15, this, &ActionGroup::processHide); } else { - m_foldStep = myScheme->groupFoldSteps; + m_foldStep = 20; m_foldDirection = 1; m_tempHeight = 0; - QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processShow); + QTimer::singleShot(15, this, &ActionGroup::processShow); } myDummy->show(); } @@ -131,7 +131,7 @@ void ActionGroup::processHide() myDummy->setFixedHeight(m_tempHeight); setFixedHeight(myDummy->height() + myHeader->height()); - QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processHide); + QTimer::singleShot(15, this, &ActionGroup::processHide); } void ActionGroup::processShow() @@ -152,7 +152,7 @@ void ActionGroup::processShow() myDummy->setFixedHeight(m_tempHeight); setFixedHeight(myDummy->height() + myHeader->height()); - QTimer::singleShot(myScheme->groupFoldDelay, this, &ActionGroup::processShow); + QTimer::singleShot(15, this, &ActionGroup::processShow); } void ActionGroup::paintEvent(QPaintEvent *event) @@ -160,25 +160,31 @@ void ActionGroup::paintEvent(QPaintEvent *event) Q_UNUSED(event); QPainter p(this); + int foldsteps = 20; + bool groupFoldThaw = true; // Change opacity gradually + FoldEffect groupFoldEffect = NoFolding; + + if (m_foldPixmap.isNull()) return; + if (myDummy->isVisible()) { - if (myScheme->groupFoldThaw) + if (groupFoldThaw) { double opacity = (m_foldDirection < 0) - ? static_cast(m_foldStep) / myScheme->groupFoldSteps - : static_cast(myScheme->groupFoldSteps - m_foldStep) / myScheme->groupFoldSteps; + ? static_cast(m_foldStep) / foldsteps + : static_cast(foldsteps - m_foldStep) / foldsteps; p.setOpacity(opacity); } - switch (myScheme->groupFoldEffect) + switch (groupFoldEffect) { - case ActionPanelScheme::ShrunkFolding: + case ShrunkFolding: p.drawPixmap(myDummy->pos(), m_foldPixmap.scaled(myDummy->size())); break; - case ActionPanelScheme::SlideFolding: + case SlideFolding: p.drawPixmap(myDummy->pos(), m_foldPixmap, QRect(0, m_foldPixmap.height() - myDummy->height(), - m_foldPixmap.width(), myDummy->width())); + m_foldPixmap.width(), myDummy->height())); break; default: p.drawPixmap(myDummy->pos(), m_foldPixmap); diff --git a/src/Gui/QSint/actionpanel/actiongroup.h b/src/Gui/QSint/actionpanel/actiongroup.h index a2c50aa97e..2bada35714 100644 --- a/src/Gui/QSint/actionpanel/actiongroup.h +++ b/src/Gui/QSint/actionpanel/actiongroup.h @@ -19,7 +19,6 @@ namespace QSint class ActionLabel; -class ActionPanelScheme; class TaskHeader; class TaskGroup; @@ -109,6 +108,13 @@ public: QSize minimumSizeHint() const override; + enum FoldEffect + { + NoFolding, + ShrunkFolding, + SlideFolding + }; + public Q_SLOTS: void showHide(); @@ -131,7 +137,6 @@ protected: std::unique_ptr myHeader; std::unique_ptr myGroup; std::unique_ptr myDummy; - ActionPanelScheme *myScheme = nullptr; }; } // namespace QSint diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index 77b3af097c..2bcb7deca4 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -185,7 +185,7 @@ void TaskBox::hideGroupBox() } else { m_tempHeight = m_fullHeight = myGroup->height(); - m_foldDelta = m_fullHeight / myScheme->groupFoldSteps; + m_foldDelta = m_fullHeight / 20; // foldsteps } m_foldStep = 0.0;