diff options
author | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-13 10:53:27 (GMT) |
---|---|---|
committer | Gunnar Sletta <gunnar@trolltech.com> | 2009-11-13 10:53:27 (GMT) |
commit | becf7dc2b4b7c2609350eb3236f854c1a4a344f5 (patch) | |
tree | 9cdc7101f704a7c6b6544c3aa74f79e5f2fdd1dc /src/gui/widgets | |
parent | 3794e55c2c8427dd8bd4f86af5e894cc80267881 (diff) | |
parent | 60d2ab05c350f866f942a35f341f455015fdb800 (diff) | |
download | Qt-becf7dc2b4b7c2609350eb3236f854c1a4a344f5.zip Qt-becf7dc2b4b7c2609350eb3236f854c1a4a344f5.tar.gz Qt-becf7dc2b4b7c2609350eb3236f854c1a4a344f5.tar.bz2 |
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qabstractscrollarea.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/qabstractslider.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qcalendarwidget.cpp | 14 | ||||
-rw-r--r-- | src/gui/widgets/qdialogbuttonbox.cpp | 28 | ||||
-rw-r--r-- | src/gui/widgets/qdockarealayout.cpp | 9 | ||||
-rw-r--r-- | src/gui/widgets/qdockwidget.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qfontcombobox.cpp | 11 | ||||
-rw-r--r-- | src/gui/widgets/qlabel.cpp | 38 | ||||
-rw-r--r-- | src/gui/widgets/qlabel_p.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindowlayout.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 44 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_p.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbar.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbararealayout.cpp | 50 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbararealayout_p.h | 6 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbarlayout.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbarlayout_p.h | 2 |
19 files changed, 139 insertions, 100 deletions
diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index b0d0baf..35639b7 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -1130,10 +1130,13 @@ void QAbstractScrollArea::mouseMoveEvent(QMouseEvent *e) void QAbstractScrollArea::wheelEvent(QWheelEvent *e) { Q_D(QAbstractScrollArea); - if (static_cast<QWheelEvent*>(e)->orientation() == Qt::Horizontal) - QApplication::sendEvent(d->hbar, e); - else - QApplication::sendEvent(d->vbar, e); + QScrollBar *const bars[2] = { d->hbar, d->vbar }; + int idx = (e->orientation() == Qt::Vertical) ? 1 : 0; + int other = (idx + 1) % 2; + if (!bars[idx]->isVisible() && bars[other]->isVisible()) + idx = other; // If the scrollbar of the event orientation is hidden, fallback to the other. + + QApplication::sendEvent(bars[idx], e); } #endif diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index fec9fab..e0db9c2 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -690,8 +690,6 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) { Q_D(QAbstractSlider); e->ignore(); - if (e->orientation() != d->orientation && !rect().contains(e->pos())) - return; int stepsToScroll = 0; qreal offset = qreal(e->delta()) / 120; diff --git a/src/gui/widgets/qcalendarwidget.cpp b/src/gui/widgets/qcalendarwidget.cpp index 08ed7f6..ee536ee 100644 --- a/src/gui/widgets/qcalendarwidget.cpp +++ b/src/gui/widgets/qcalendarwidget.cpp @@ -2297,7 +2297,21 @@ int QCalendarWidget::monthShown() const void QCalendarWidget::setCurrentPage(int year, int month) { Q_D(QCalendarWidget); + QDate currentDate = d->getCurrentDate(); + int day = currentDate.day(); + int daysInMonths = QDate(year, month, 1).daysInMonth(); + if (day > daysInMonths) + day = daysInMonths; + d->showMonth(year, month); + + QDate newDate(year, month, day); + int row = -1, col = -1; + d->m_model->cellForDate(newDate, &row, &col); + if (row != -1 && col != -1) { + d->m_view->selectionModel()->setCurrentIndex(d->m_model->index(row, col), + QItemSelectionModel::NoUpdate); + } } /*! diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 2231b98..2ee5751 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -315,9 +315,9 @@ void QDialogButtonBoxPrivate::initLayout() buttonLayout = new QVBoxLayout(q); } - int left, top, right, bottom; + int left, top, right, bottom; setLayoutItemMargins(QStyle::SE_PushButtonLayoutItem); - getLayoutItemMargins(&left, &top, &right, &bottom); + getLayoutItemMargins(&left, &top, &right, &bottom); buttonLayout->setContentsMargins(-left, -top, -right, -bottom); if (!q->testAttribute(Qt::WA_WState_OwnSizePolicy)) { @@ -356,7 +356,7 @@ void QDialogButtonBoxPrivate::addButtonsToLayout(const QList<QAbstractButton *> void QDialogButtonBoxPrivate::layoutButtons() { Q_Q(QDialogButtonBox); - const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item + const int MacGap = 36 - 8; // 8 is the default gap between a widget and a spacer item for (int i = buttonLayout->count() - 1; i >= 0; --i) { QLayoutItem *item = buttonLayout->takeAt(i); @@ -581,6 +581,22 @@ QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialog } QObject::connect(action, SIGNAL(triggered()), button, SIGNAL(clicked())); action->setSoftKeyRole(softkeyRole); + + + QWidget *dialog = 0; + QWidget *p = q; + while (p && !p->isWindow()) { + p = p->parentWidget(); + if ((dialog = qobject_cast<QDialog *>(p))) + break; + } + + if (dialog) { + dialog->addAction(action); + } else { + q->addAction(action); + } + return action; } #endif @@ -1193,12 +1209,8 @@ bool QDialogButtonBox::event(QEvent *event) if (!hasDefault && firstAcceptButton) firstAcceptButton->setDefault(true); #ifdef QT_SOFTKEYS_ENABLED - if (dialog) { + if (dialog) setFixedSize(0,0); - dialog->addActions(d->softKeyActions.values()); - } else { - addActions(d->softKeyActions.values()); - } #endif }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index dffec11..953edab 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1841,7 +1841,6 @@ void QDockAreaLayoutInfo::saveState(QDataStream &stream) const } } -#ifdef Q_WS_MAC static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) { switch (pos) { @@ -1853,7 +1852,6 @@ static Qt::DockWidgetArea toDockWidgetArea(QInternal::DockPosition pos) } return Qt::NoDockWidgetArea; } -#endif static QRect constrainedRect(QRect rect, const QRect &desktop) { @@ -1933,6 +1931,9 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> item_list.append(item); } else { QDockAreaLayoutItem item(new QDockWidgetItem(widget)); + if (!testing) { + item_list.append(item); + } if (flags & StateFlagFloating) { bool drawer = false; #ifdef Q_WS_MAC // drawer support @@ -1977,12 +1978,10 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*> if (!testing) { widget->setFloating(false); widget->setVisible(flags & StateFlagVisible); + emit widget->dockLocationChanged(toDockWidgetArea(dockPos)); } } - if (!testing) { - item_list.append(item); - } } } else if (nextMarker == SequenceMarker) { int dummy; diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp index a8e2a37..9cf6af1 100644 --- a/src/gui/widgets/qdockwidget.cpp +++ b/src/gui/widgets/qdockwidget.cpp @@ -1225,6 +1225,7 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) features &= DockWidgetFeatureMask; if (d->features == features) return; + const bool closableChanged = (d->features ^ features) & DockWidgetClosable; d->features = features; QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout()); @@ -1233,6 +1234,10 @@ void QDockWidget::setFeatures(QDockWidget::DockWidgetFeatures features) d->toggleViewAction->setEnabled((d->features & DockWidgetClosable) == DockWidgetClosable); emit featuresChanged(d->features); update(); + if (closableChanged && layout->nativeWindowDeco()) { + //this ensures the native decoration is drawn + d->setWindowState(true /*floating*/, true /*unplug*/); + } } QDockWidget::DockWidgetFeatures QDockWidget::features() const diff --git a/src/gui/widgets/qfontcombobox.cpp b/src/gui/widgets/qfontcombobox.cpp index 806db59..d601f81 100644 --- a/src/gui/widgets/qfontcombobox.cpp +++ b/src/gui/widgets/qfontcombobox.cpp @@ -247,7 +247,14 @@ void QFontComboBoxPrivate::_q_updateModel() } list = result; + //we need to block the signals so that the model doesn't emit reset + //this prevents the current index from changing + //it will be updated just after this + ///TODO: we should finda way to avoid blocking signals and have a real update of the model + const bool old = m->blockSignals(true); m->setStringList(list); + m->blockSignals(old); + if (list.isEmpty()) { if (currentFont != QFont()) { currentFont = QFont(); @@ -420,8 +427,10 @@ void QFontComboBox::setCurrentFont(const QFont &font) Q_D(QFontComboBox); if (font != d->currentFont) { d->currentFont = font; - emit currentFontChanged(d->currentFont); d->_q_updateModel(); + if (d->currentFont == font) { //else the signal has already be emitted by _q_updateModel + emit currentFontChanged(d->currentFont); + } } } diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp index 3d908a1..ea711e8 100644 --- a/src/gui/widgets/qlabel.cpp +++ b/src/gui/widgets/qlabel.cpp @@ -1170,22 +1170,10 @@ void QLabelPrivate::updateShortcut() // But then we do want to hide the ampersands, so we can't use shortcutId. hasShortcut = false; - if (control) { - ensureTextPopulated(); - // Underline the first character that follows an ampersand - shortcutCursor = control->document()->find(QLatin1String("&")); - if (shortcutCursor.isNull()) - return; - hasShortcut = true; - shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); - shortcutCursor.deleteChar(); // remove the ampersand - shortcutCursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); - } else { - if (!text.contains(QLatin1Char('&'))) - return; - hasShortcut = true; - shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); - } + if (!text.contains(QLatin1Char('&'))) + return; + hasShortcut = true; + shortcutId = q->grabShortcut(QKeySequence::mnemonic(text)); } #endif // QT_NO_SHORTCUT @@ -1456,6 +1444,24 @@ void QLabelPrivate::ensureTextPopulated() const doc->setPlainText(text); #endif doc->setUndoRedoEnabled(false); + +#ifndef QT_NO_SHORTCUT + if (hasShortcut) { + // Underline the first character that follows an ampersand (and remove the others ampersands) + int from = 0; + bool found = false; + QTextCursor cursor; + while (!(cursor = control->document()->find((QLatin1String("&")), from)).isNull()) { + cursor.deleteChar(); // remove the ampersand + cursor.movePosition(QTextCursor::NextCharacter, QTextCursor::KeepAnchor); + from = cursor.position(); + if (!found && cursor.selectedText() != QLatin1String("&")) { //not a second & + found = true; + shortcutCursor = cursor; + } + } + } +#endif } } textDirty = false; diff --git a/src/gui/widgets/qlabel_p.h b/src/gui/widgets/qlabel_p.h index c5a74e2..ca17a35 100644 --- a/src/gui/widgets/qlabel_p.h +++ b/src/gui/widgets/qlabel_p.h @@ -113,7 +113,7 @@ public: mutable uint hasShortcut : 1; Qt::TextFormat textformat; mutable QTextControl *control; - QTextCursor shortcutCursor; + mutable QTextCursor shortcutCursor; Qt::TextInteractionFlags textInteractionFlags; inline bool needTextControl() const { diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 2914164..300a2ea 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -414,7 +414,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event) int c = m_cursor; // cursor position after insertion of commit string - if (event->replacementStart() <= 0) + if (event->replacementStart() == 0) c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength()); m_cursor += event->replacementStart(); diff --git a/src/gui/widgets/qmainwindowlayout.cpp b/src/gui/widgets/qmainwindowlayout.cpp index 027a5d6..fa6f7a1 100644 --- a/src/gui/widgets/qmainwindowlayout.cpp +++ b/src/gui/widgets/qmainwindowlayout.cpp @@ -1641,6 +1641,9 @@ void QMainWindowLayout::animationFinished(QWidget *widget) savedState.clear(); currentGapPos.clear(); pluggingWidget = 0; + //applying the state will make sure that the currentGap is updated correctly + //and all the geometries (especially the one from the central widget) is correct + layoutState.apply(false); } if (!widgetAnimator.animating()) { diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index cc39b7f..54d1612 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -602,14 +602,7 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } #ifndef QT_NO_STATUSTIP } else if (previousAction) { - QWidget *w = causedPopup.widget; - while (QMenu *m = qobject_cast<QMenu*>(w)) - w = m->d_func()->causedPopup.widget; - if (w) { - QString empty; - QStatusTipEvent tip(empty); - QApplication::sendEvent(w, &tip); - } + previousAction->d_func()->showStatusText(topCausedWidget(), QString()); #endif } if (hideActiveMenu) { @@ -623,6 +616,15 @@ void QMenuPrivate::setCurrentAction(QAction *action, int popup, SelectionReason } } +//return the top causedPopup.widget that is not a QMenu +QWidget *QMenuPrivate::topCausedWidget() const +{ + QWidget* top = causedPopup.widget; + while (QMenu* m = qobject_cast<QMenu *>(top)) + top = m->d_func()->causedPopup.widget; + return top; +} + QAction *QMenuPrivate::actionAt(QPoint p) const { if (!q_func()->rect().contains(p)) //sanity check @@ -1094,10 +1096,7 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection); } #endif - QWidget *w = causedPopup.widget; - while (QMenu *m = qobject_cast<QMenu*>(w)) - w = m->d_func()->causedPopup.widget; - action->showStatusText(w); + action->showStatusText(topCausedWidget()); } else { actionAboutToTrigger = 0; } @@ -1801,10 +1800,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction) #ifndef QT_NO_MENUBAR // if this menu is part of a chain attached to a QMenuBar, set the // _NET_WM_WINDOW_TYPE_DROPDOWN_MENU X11 window type - QWidget* top = this; - while (QMenu* m = qobject_cast<QMenu *>(top)) - top = m->d_func()->causedPopup.widget; - setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(top) != 0); + setAttribute(Qt::WA_X11NetWmWindowTypeDropDownMenu, qobject_cast<QMenuBar *>(d->topCausedWidget()) != 0); #endif ensurePolished(); // Get the right font @@ -2752,18 +2748,14 @@ void QMenu::keyPressEvent(QKeyEvent *e) } } if (!key_consumed) { - if (QWidget *caused = d->causedPopup.widget) { - while(QMenu *m = qobject_cast<QMenu*>(caused)) - caused = m->d_func()->causedPopup.widget; #ifndef QT_NO_MENUBAR - if (QMenuBar *mb = qobject_cast<QMenuBar*>(caused)) { - QAction *oldAct = mb->d_func()->currentAction; - QApplication::sendEvent(mb, e); - if (mb->d_func()->currentAction != oldAct) - key_consumed = true; - } -#endif + if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->topCausedWidget())) { + QAction *oldAct = mb->d_func()->currentAction; + QApplication::sendEvent(mb, e); + if (mb->d_func()->currentAction != oldAct) + key_consumed = true; } +#endif } #ifdef Q_OS_WIN32 diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h index a5bde7c..c021063 100644 --- a/src/gui/widgets/qmenu_p.h +++ b/src/gui/widgets/qmenu_p.h @@ -215,6 +215,7 @@ public: SelectedFromKeyboard, SelectedFromElsewhere }; + QWidget *topCausedWidget() const; QAction *actionAt(QPoint p) const; void setFirstActionActive(); void setCurrentAction(QAction *, int popup = -1, SelectionReason reason = SelectedFromElsewhere, bool activateFirst = false); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index 689d2e1..b1ff662 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -332,7 +332,9 @@ void QMenuBarPrivate::popupAction(QAction *action, bool activateFirst) QPoint pos(q->mapToGlobal(QPoint(adjustedActionRect.left(), adjustedActionRect.bottom() + 1))); QSize popup_size = activeMenu->sizeHint(); - QRect screenRect = QApplication::desktop()->screenGeometry(pos); + //we put the popup menu on the screen containing the bottom-center of the action rect + QRect screenRect = QApplication::desktop()->screenGeometry(pos + QPoint(adjustedActionRect.width() / 2, 0)); + pos = QPoint(qMax(pos.x(), screenRect.x()), qMax(pos.y(), screenRect.y())); const bool fitUp = (q->mapToGlobal(adjustedActionRect.topLeft()).y() >= popup_size.height()); const bool fitDown = (pos.y() + popup_size.height() <= screenRect.bottom()); diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp index 5596ca4..58a3d28 100644 --- a/src/gui/widgets/qtoolbar.cpp +++ b/src/gui/widgets/qtoolbar.cpp @@ -396,7 +396,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event) void QToolBarPrivate::unplug(const QRect &_r) { Q_Q(QToolBar); - layout->setExpanded(false, false); + layout->setExpanded(false); QRect r = _r; r.moveTopLeft(q->mapToGlobal(QPoint(0, 0))); setWindowState(true, true, r); diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp index de11625..b7e985c 100644 --- a/src/gui/widgets/qtoolbararealayout.cpp +++ b/src/gui/widgets/qtoolbararealayout.cpp @@ -480,7 +480,7 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos) } -QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const +QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos, int *minDistance) const { int p = pick(o, pos); @@ -509,12 +509,19 @@ QList<int> QToolBarAreaLayoutInfo::gapIndex(const QPoint &pos) const QList<int> result; result << j << k; + *minDistance = 0; //we found a perfect match + return result; + } + } else { + const int dist = distance(pos); + //it will only return a path if the minDistance is higher than the current distance + if (dist >= 0 && *minDistance > dist) { + *minDistance = dist; + + QList<int> result; + result << lines.count() << 0; return result; } - } else if (appendLineDropRect().contains(pos)) { - QList<int> result; - result << lines.count() << 0; - return result; } return QList<int>(); @@ -587,32 +594,20 @@ QRect QToolBarAreaLayoutInfo::itemRect(const QList<int> &path) const return result; } -QRect QToolBarAreaLayoutInfo::appendLineDropRect() const +int QToolBarAreaLayoutInfo::distance(const QPoint &pos) const { - QRect result; - switch (dockPos) { case QInternal::LeftDock: - result = QRect(rect.right(), rect.top(), - EmptyDockAreaSize, rect.height()); - break; + return pos.x() - rect.right(); case QInternal::RightDock: - result = QRect(rect.left() - EmptyDockAreaSize, rect.top(), - EmptyDockAreaSize, rect.height()); - break; + return rect.left() - pos.x(); case QInternal::TopDock: - result = QRect(rect.left(), rect.bottom() + 1, - rect.width(), EmptyDockAreaSize); - break; + return pos.y() - rect.bottom(); case QInternal::BottomDock: - result = QRect(rect.left(), rect.top() - EmptyDockAreaSize, - rect.width(), EmptyDockAreaSize); - break; + return rect.top() - pos.y(); default: - break; + return -1; } - - return result; } /****************************************************************************** @@ -1022,21 +1017,24 @@ QList<int> QToolBarAreaLayout::indexOf(QWidget *toolBar) const return result; } +//this functions returns the path to the possible gapindex for the position pos QList<int> QToolBarAreaLayout::gapIndex(const QPoint &pos) const { Qt::LayoutDirection dir = mainWindow->layoutDirection(); + int minDistance = 80; // when a dock area is empty, how "wide" is it? + QList<int> ret; //return value for (int i = 0; i < QInternal::DockCount; ++i) { QPoint p = pos; if (docks[i].o == Qt::Horizontal) p = QStyle::visualPos(dir, docks[i].rect, p); - QList<int> result = docks[i].gapIndex(p); + QList<int> result = docks[i].gapIndex(p, &minDistance); if (!result.isEmpty()) { result.prepend(i); - return result; + ret = result; } } - return QList<int>(); + return ret; } QList<int> QToolBarAreaLayout::currentGapIndex() const diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index 1e113b7..f0ab80c 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -155,8 +155,6 @@ public: class QToolBarAreaLayoutInfo { public: - enum { EmptyDockAreaSize = 80 }; // when a dock area is empty, how "wide" is it? - QToolBarAreaLayoutInfo(QInternal::DockPosition pos = QInternal::TopDock); QList<QToolBarAreaLayoutLine> lines; @@ -173,11 +171,11 @@ public: void removeToolBarBreak(QToolBar *before); void moveToolBar(QToolBar *toolbar, int pos); - QList<int> gapIndex(const QPoint &pos) const; + QList<int> gapIndex(const QPoint &pos, int *maxDistance) const; bool insertGap(const QList<int> &path, QLayoutItem *item); void clear(); QRect itemRect(const QList<int> &path) const; - QRect appendLineDropRect() const; + int distance(const QPoint &pos) const; QRect rect; Qt::Orientation o; diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 7dc1e01..0afe5d8 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -642,7 +642,7 @@ QSize QToolBarLayout::expandedSize(const QSize &size) const return result; } -void QToolBarLayout::setExpanded(bool exp, bool animated) +void QToolBarLayout::setExpanded(bool exp) { if (exp == expanded) return; @@ -654,7 +654,6 @@ void QToolBarLayout::setExpanded(bool exp, bool animated) if (!tb) return; if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) { - animating = true; QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout()); if (expanded) { tb->raise(); @@ -665,7 +664,7 @@ void QToolBarLayout::setExpanded(bool exp, bool animated) layoutActions(rect.size()); } } - layout->layoutState.toolBarAreaLayout.apply(animated); + layout->layoutState.toolBarAreaLayout.apply(win->isAnimated()); } } diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h index d49a5df..afd0227 100644 --- a/src/gui/widgets/qtoolbarlayout_p.h +++ b/src/gui/widgets/qtoolbarlayout_p.h @@ -112,7 +112,7 @@ public: bool hasExpandFlag() const; public Q_SLOTS: - void setExpanded(bool b, bool animated = true); + void setExpanded(bool b); private: QList<QToolBarItem*> items; |