diff options
author | deva <deva> | 2011-02-23 10:08:46 +0000 |
---|---|---|
committer | deva <deva> | 2011-02-23 10:08:46 +0000 |
commit | b62e7ea66866a80181efa366ba255c6a30a8a664 (patch) | |
tree | 0ecfb1683de6beff8041db9a54582f13670e8d99 /client/collapser.cc | |
parent | 8fbf461b279c0b96fdf5b764ef04376b5f7da7ec (diff) |
Fixes 'speedy collapse' on commit.
Diffstat (limited to 'client/collapser.cc')
-rw-r--r-- | client/collapser.cc | 42 |
1 files changed, 25 insertions, 17 deletions
diff --git a/client/collapser.cc b/client/collapser.cc index 6ae9d21..81c9b23 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -31,8 +31,8 @@ #include "debug.h" -#define ANIM_TIME 2000 -#define ANIM_INTERVAL 20 +#define ANIM_TIME 400 // ms +#define ANIM_INTERVAL 5 // ms Collapser::Collapser(QWidget *collapsed, QWidget *expanded, bool setcollapsed, QScrollArea *scrollarea) @@ -56,59 +56,71 @@ Collapser::Collapser(QWidget *collapsed, QWidget *expanded, bool setcollapsed, setCollapsed(setcollapsed); } +void Collapser::updateHeight() +{ + int c_height = 16; + int e_height = 16; + if(collapsed) { + QSize sz = collapsed->minimumSizeHint(); + c_height = sz.height(); + } + + if(expanded) { + QSize sz = expanded->minimumSizeHint(); + e_height = sz.height(); + } + + if(isCollapsed()) { + setFixedHeight(c_height); + } else { + setFixedHeight(e_height); + } +} + void Collapser::setWidgets(QWidget *collapsed, QWidget *expanded) { - DEBUG(collapser, "\n"); setCollapsedWidget(collapsed); setExpandedWidget(expanded); } void Collapser::setCollapsedWidget(QWidget *collapsed) { - DEBUG(collapser, "\n"); this->collapsed = collapsed; - /* + if(isCollapsed() == true && collapsed) { layout()->addWidget(collapsed); collapsed->setVisible(true); } - */ } void Collapser::setExpandedWidget(QWidget *expanded) { - DEBUG(collapser, "\n"); this->expanded = expanded; - /* + if(isCollapsed() == false && expanded) { layout()->addWidget(expanded); expanded->setVisible(true); } - */ } QWidget *Collapser::collapsedWidget() { - DEBUG(collapser, "\n"); return collapsed; } QWidget *Collapser::expandedWidget() { - DEBUG(collapser, "\n"); return expanded; } bool Collapser::isCollapsed() { - DEBUG(collapser, "\n"); return is_collapsed; } void Collapser::setCollapsed(bool setcollapsed) { - DEBUG(collapser, "\n"); if(this->is_collapsed == setcollapsed) return; if(setcollapsed) collapse(); @@ -117,7 +129,6 @@ void Collapser::setCollapsed(bool setcollapsed) void Collapser::collapse() { - DEBUG(collapser, "\n"); emit collapsing(); t_anim.start(); @@ -139,7 +150,6 @@ void Collapser::collapse() void Collapser::expand() { - DEBUG(collapser, "\n"); emit expanding(); t_anim.start(); @@ -164,14 +174,12 @@ void Collapser::expand() void Collapser::toggleCollapse() { - DEBUG(collapser, "\n"); if(!is_collapsed) collapse(); else expand(); } void Collapser::anim() { - DEBUG(collapser, "\n"); int c_height = 16; int e_height = 16; if(collapsed) { |