summaryrefslogtreecommitdiff
path: root/client/collapser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'client/collapser.cc')
-rw-r--r--client/collapser.cc29
1 files changed, 14 insertions, 15 deletions
diff --git a/client/collapser.cc b/client/collapser.cc
index 81c9b23..13357f4 100644
--- a/client/collapser.cc
+++ b/client/collapser.cc
@@ -31,7 +31,7 @@
#include "debug.h"
-#define ANIM_TIME 400 // ms
+#define ANIM_TIME 300 // ms
#define ANIM_INTERVAL 5 // ms
Collapser::Collapser(QWidget *collapsed, QWidget *expanded, bool setcollapsed,
@@ -157,11 +157,9 @@ void Collapser::expand()
// show expanded
if(collapsed) {
collapsed->setVisible(false);
- //qApp->processEvents(); // Make sure it is actually invisble before removing it form the layout.
layout()->removeWidget(collapsed);
-
- placeholder.grab_from(collapsed);
- }
+ placeholder.grab_from(collapsed);
+ }
layout()->addWidget(&placeholder);
placeholder.setVisible(true);
@@ -258,16 +256,21 @@ void Collapser::Placeholder::paintEvent(QPaintEvent *)
p.drawPixmap(rect(), pixmap_to, pixmap_to.rect());
}
+static QPixmap grab(QWidget *w, int width)
+{
+ QPixmap pix;
+ QSize sz = w->minimumSizeHint();
+ sz.setWidth(width);
+ w->resize(sz);
+ pix = QPixmap::grabWidget(w, 0, 0);
+ return pix;
+}
void Collapser::Placeholder::grab_from(QWidget *w)
{
weight = 0; // Reset
if(!w) return;
- // w->setFixedWidth(contentsRect().width());
- QSize sz = w->minimumSizeHint();
- // w->setFixedHeight(sz.height());
- w->resize(width(), sz.height());
- pixmap_from = QPixmap::grabWidget(w, 0, 0);
+ pixmap_from = grab(w, width());
}
void Collapser::Placeholder::grab_to(QWidget *w)
@@ -275,11 +278,7 @@ void Collapser::Placeholder::grab_to(QWidget *w)
weight = 0; // Reset
if(!w) return;
- // w->setFixedWidth(contentsRect().width());
- QSize sz = w->minimumSizeHint();
- // w->setFixedHeight(sz.height());
- w->resize(width(), sz.height());
- pixmap_to = QPixmap::grabWidget(w, 0, 0);
+ pixmap_to = grab(w, width());
}
void Collapser::Placeholder::setWeight(double w)