diff options
| author | deva <deva> | 2011-03-03 10:56:50 +0000 | 
|---|---|---|
| committer | deva <deva> | 2011-03-03 10:56:50 +0000 | 
| commit | dc5075774cd0e746f6d2e324c96af36806e847d4 (patch) | |
| tree | 86b519ebf9fd984b3abfc23091a7af534d341b8d /client | |
| parent | 3e97ad5860913cfac2c3a170175ac9ced6acee97 (diff) | |
Unify grabber functions.
Diffstat (limited to 'client')
| -rw-r--r-- | client/collapser.cc | 29 | 
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)  | 
