src/gui/widgets/qtoolbarlayout.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   640     rpick(o, result) = w;
   640     rpick(o, result) = w;
   641     rperp(o, result) = h;
   641     rperp(o, result) = h;
   642     return result;
   642     return result;
   643 }
   643 }
   644 
   644 
   645 void QToolBarLayout::setExpanded(bool exp, bool animated)
   645 void QToolBarLayout::setExpanded(bool exp)
   646 {
   646 {
   647     if (exp == expanded)
   647     if (exp == expanded)
   648         return;
   648         return;
   649 
   649 
   650     expanded = exp;
   650     expanded = exp;
   652 
   652 
   653     QToolBar *tb = qobject_cast<QToolBar*>(parentWidget());
   653     QToolBar *tb = qobject_cast<QToolBar*>(parentWidget());
   654     if (!tb)
   654     if (!tb)
   655         return;
   655         return;
   656     if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
   656     if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) {
   657         animating = true;
   657         animating = !tb->isWindow() && win->isAnimated();
   658         QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
   658         QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout());
   659         if (expanded) {
   659         if (expanded) {
   660             tb->raise();
   660             tb->raise();
   661         } else {
   661         } else {
   662             QList<int> path = layout->layoutState.indexOf(tb);
   662             QList<int> path = layout->layoutState.indexOf(tb);
   663             if (!path.isEmpty()) {
   663             if (!path.isEmpty()) {
   664                 QRect rect = layout->layoutState.itemRect(path);
   664                 QRect rect = layout->layoutState.itemRect(path);
   665                 layoutActions(rect.size());
   665                 layoutActions(rect.size());
   666             }
   666             }
   667         }
   667         }
   668         layout->layoutState.toolBarAreaLayout.apply(animated);
   668         layout->layoutState.toolBarAreaLayout.apply(animating);
   669     }
   669     }
   670 }
   670 }
   671 
   671 
   672 QSize QToolBarLayout::minimumSize() const
   672 QSize QToolBarLayout::minimumSize() const
   673 {
   673 {