diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-03-25 22:09:36 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-03-25 22:09:36 (GMT) |
commit | 11b9190a182c5f3c1055c100145b02a3975509ed (patch) | |
tree | 2c664ad92363204c320e23f9d1e6ca29505eaf2e /src/gui/widgets | |
parent | 03686225036ebfc5cf78e3fcc66f5810a140c7d2 (diff) | |
parent | 3671dbf34940e166b747b6f8f3f5758fd486073c (diff) | |
download | Qt-11b9190a182c5f3c1055c100145b02a3975509ed.zip Qt-11b9190a182c5f3c1055c100145b02a3975509ed.tar.gz Qt-11b9190a182c5f3c1055c100145b02a3975509ed.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt into 4.7
Conflicts:
src/declarative/graphicsitems/qdeclarativeitem.cpp
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qabstractslider.cpp | 10 | ||||
-rw-r--r-- | src/gui/widgets/qabstractslider_p.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qeffects.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/qlinecontrol.cpp | 1 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 38 | ||||
-rw-r--r-- | src/gui/widgets/qscrollbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qsplitter.cpp | 32 | ||||
-rw-r--r-- | src/gui/widgets/qsplitter.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbarlayout.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qworkspace.cpp | 10 |
11 files changed, 78 insertions, 33 deletions
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 522d472..6a01d68 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -764,12 +764,12 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) SliderAction action = SliderNoAction; #ifdef QT_KEYPAD_NAVIGATION if (ev->isAutoRepeat()) { - if (d->firstRepeat.isNull()) - d->firstRepeat = QTime::currentTime(); + if (!d->firstRepeat.isValid()) + d->firstRepeat.start(); else if (1 == d->repeatMultiplier) { // This is the interval in milli seconds which one key repetition // takes. - const int repeatMSecs = d->firstRepeat.msecsTo(QTime::currentTime()); + const int repeatMSecs = d->firstRepeat.elapsed(); /** * The time it takes to currently navigate the whole slider. @@ -787,8 +787,8 @@ void QAbstractSlider::keyPressEvent(QKeyEvent *ev) } } - else if (!d->firstRepeat.isNull()) { - d->firstRepeat = QTime(); + else if (!d->firstRepeat.isValid()) { + d->firstRepeat.invalidate(); d->repeatMultiplier = 1; } diff --git a/src/gui/widgets/qabstractslider_p.h b/src/gui/widgets/qabstractslider_p.h index 6e6ff6e..19d1fca 100644 --- a/src/gui/widgets/qabstractslider_p.h +++ b/src/gui/widgets/qabstractslider_p.h @@ -54,6 +54,7 @@ // #include "QtCore/qbasictimer.h" +#include "QtCore/qelapsedtimer.h" #include "private/qwidget_p.h" #include "qstyle.h" @@ -103,7 +104,7 @@ public: /** * The time of when the first auto repeating key press event occurs. */ - QTime firstRepeat; + QElapsedTimer firstRepeat; #endif diff --git a/src/gui/widgets/qeffects.cpp b/src/gui/widgets/qeffects.cpp index dd7fc48..a56d093 100644 --- a/src/gui/widgets/qeffects.cpp +++ b/src/gui/widgets/qeffects.cpp @@ -41,7 +41,6 @@ #include "qapplication.h" #ifndef QT_NO_EFFECTS -#include "qdatetime.h" #include "qdesktopwidget.h" #include "qeffects_p.h" #include "qevent.h" @@ -50,6 +49,7 @@ #include "qpixmap.h" #include "qpointer.h" #include "qtimer.h" +#include "qelapsedtimer.h" #include "qdebug.h" QT_BEGIN_NAMESPACE @@ -103,7 +103,7 @@ private: int elapsed; bool showWidget; QTimer anim; - QTime checkTime; + QElapsedTimer checkTime; double windowOpacity; }; @@ -384,7 +384,7 @@ private: int orientation; QTimer anim; - QTime checkTime; + QElapsedTimer checkTime; QPixmap pm; }; diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index 8e715a9..42df800 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1767,7 +1767,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) } break; #endif - default: if (!handled) unknown = true; diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index d2eda80..44483ea 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1374,7 +1374,9 @@ bool QMainWindow::event(QEvent *event) #endif // QT_NO_STATUSTIP case QEvent::StyleChange: +#ifndef QT_NO_DOCKWIDGET d->layout->layoutState.dockAreaLayout.styleChangedEvent(); +#endif if (!d->explicitIconSize) setIconSize(QSize()); break; diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 43722a1..9a14ce6 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -909,6 +909,7 @@ static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *act static QString qt_mac_menu_merge_text(QMacMenuAction *action) { QString ret; + extern QString qt_mac_applicationmenu_string(int type); #ifdef QT_MAC_USE_COCOA QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader(); #endif @@ -916,34 +917,25 @@ static QString qt_mac_menu_merge_text(QMacMenuAction *action) ret = action->action->text(); #ifndef QT_MAC_USE_COCOA else if (action->command == kHICommandAbout) - ret = QMenuBar::tr("About %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); else if (action->command == kHICommandAboutQt) ret = QMenuBar::tr("About Qt"); else if (action->command == kHICommandPreferences) - ret = QMenuBar::tr("Preferences"); + ret = qt_mac_applicationmenu_string(4); else if (action->command == kHICommandQuit) - ret = QMenuBar::tr("Quit %1").arg(qAppName()); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); #else else if (action->menuItem == [loader aboutMenuItem]) { - if (action->action->text() == QString("About %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(6).arg(qAppName()); } else if (action->menuItem == [loader aboutQtMenuItem]) { if (action->action->text() == QString("About Qt")) ret = QMenuBar::tr("About Qt"); else ret = action->action->text(); } else if (action->menuItem == [loader preferencesMenuItem]) { - if (action->action->text() == QString("Preferences")) - ret = QMenuBar::tr("Preferences"); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(4); } else if (action->menuItem == [loader quitMenuItem]) { - if (action->action->text() == QString("Quit %1").arg(qAppName())) - ret = QMenuBar::tr("About %1").arg(qAppName()); - else - ret = action->action->text(); + ret = qt_mac_applicationmenu_string(5).arg(qAppName()); } #endif return ret; @@ -2060,6 +2052,22 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly() QWidget *w = findWindowThatShouldDisplayMenubar(); QMenuBar *mb = findMenubarForWindow(w); + // We need to see if we are in full screen mode, if so we need to + // switch the full screen mode to be able to show or hide the menubar. + if(w && mb) { + // This case means we are creating a menubar, check if full screen + if(w->isFullScreen()) { + // Ok, switch to showing the menubar when hovering over it. + SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar); + } + } else if(w) { + // Removing a menubar + if(w->isFullScreen()) { + // Ok, switch to not showing the menubar when hovering on it + SetSystemUIMode(kUIModeAllHidden, 0); + } + } + if (mb && mb->isNativeMenuBar()) { bool modal = QApplicationPrivate::modalState(); #ifdef QT_MAC_USE_COCOA diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index c0eeb2f..4ee9f27 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -47,7 +47,7 @@ #include "qstyle.h" #include "qstyleoption.h" #include "qmenu.h" -#include <QtCore/qdatetime.h> +#include <QtCore/qelapsedtimer.h> #ifndef QT_NO_SCROLLBAR @@ -613,7 +613,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e) } const int initialDelay = 500; // default threshold d->activateControl(d->pressedControl, initialDelay); - QTime time; + QElapsedTimer time; time.start(); repaint(style()->subControlRect(QStyle::CC_ScrollBar, &opt, d->pressedControl, this)); if (time.elapsed() >= initialDelay && d->repeatActionTimer.isActive()) { diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 597b28b..88b7517 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -227,6 +227,33 @@ QSize QSplitterHandle::sizeHint() const /*! \reimp */ +void QSplitterHandle::resizeEvent(QResizeEvent *event) +{ + Q_D(const QSplitterHandle); + + // When splitters are only 1 pixel large we increase the + // actual grab area to five pixels + + // Note that QSplitter uses contentsRect for layouting + // and ensures that handles are drawn on top of widgets + // We simply use the contents margins for draggin and only + // paint the mask area + bool useTinyMode = (d->s->handleWidth() == 1); + setAttribute(Qt::WA_MouseNoMask, useTinyMode); + if (useTinyMode) { + if (orientation() == Qt::Horizontal) + setContentsMargins(2, 0, 2, 0); + else + setContentsMargins(0, 2, 0, 2); + setMask(QRegion(contentsRect())); + } + + QWidget::resizeEvent(event); +} + +/*! + \reimp +*/ bool QSplitterHandle::event(QEvent *event) { Q_D(QSplitterHandle); @@ -301,7 +328,7 @@ void QSplitterHandle::paintEvent(QPaintEvent *) Q_D(QSplitterHandle); QPainter p(this); QStyleOption opt(0); - opt.rect = rect(); + opt.rect = contentsRect(); opt.palette = palette(); if (orientation() == Qt::Horizontal) opt.state = QStyle::State_Horizontal; @@ -1662,6 +1689,9 @@ void QSplitter::setSizes(const QList<int> &list) By default, this property contains a value that depends on the user's platform and style preferences. + + If you set handleWidth to 1, the actual grab area will grow to overlap a + few pixels of it's respective widgets. */ int QSplitter::handleWidth() const diff --git a/src/gui/widgets/qsplitter.h b/src/gui/widgets/qsplitter.h index a793f24..c3b304d 100644 --- a/src/gui/widgets/qsplitter.h +++ b/src/gui/widgets/qsplitter.h @@ -172,6 +172,7 @@ protected: void mouseMoveEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *); void mouseReleaseEvent(QMouseEvent *); + void resizeEvent(QResizeEvent *); bool event(QEvent *); void moveSplitter(int p); diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp index 4eb252a..f87510f 100644 --- a/src/gui/widgets/qtoolbarlayout.cpp +++ b/src/gui/widgets/qtoolbarlayout.cpp @@ -654,7 +654,11 @@ void QToolBarLayout::setExpanded(bool exp) if (!tb) return; if (QMainWindow *win = qobject_cast<QMainWindow*>(tb->parentWidget())) { +#ifdef QT_NO_DOCKWIDGET + animating = false; +#else animating = !tb->isWindow() && win->isAnimated(); +#endif QMainWindowLayout *layout = qobject_cast<QMainWindowLayout*>(win->layout()); if (expanded) { tb->raise(); diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp index 2a6a7da..7180c4d 100644 --- a/src/gui/widgets/qworkspace.cpp +++ b/src/gui/widgets/qworkspace.cpp @@ -44,7 +44,6 @@ #include "qapplication.h" #include "qbitmap.h" #include "qcursor.h" -#include "qdatetime.h" #include "qdesktopwidget.h" #include "qevent.h" #include "qhash.h" @@ -59,6 +58,7 @@ #include "qscrollbar.h" #include "qstyle.h" #include "qstyleoption.h" +#include "qelapsedtimer.h" #include "qtooltip.h" #include "qdebug.h" #include <private/qwidget_p.h> @@ -450,10 +450,10 @@ void QWorkspaceTitleBar::mousePressEvent(QMouseEvent *e) case QStyle::SC_TitleBarSysMenu: if (d->flags & Qt::WindowSystemMenuHint) { d->buttonDown = QStyle::SC_None; - static QTime *t = 0; + static QElapsedTimer *t = 0; static QWorkspaceTitleBar *tc = 0; if (!t) - t = new QTime; + t = new QElapsedTimer; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { emit showOperationMenu(); t->start(); @@ -1839,7 +1839,7 @@ bool QWorkspace::event(QEvent *e) bool QWorkspace::eventFilter(QObject *o, QEvent * e) { Q_D(QWorkspace); - static QTime* t = 0; + static QElapsedTimer* t = 0; static QWorkspace* tc = 0; if (o == d->maxtools) { switch (e->type()) { @@ -1847,7 +1847,7 @@ bool QWorkspace::eventFilter(QObject *o, QEvent * e) { QMenuBar* b = (QMenuBar*)o->parent(); if (!t) - t = new QTime; + t = new QElapsedTimer; if (tc != this || t->elapsed() > QApplication::doubleClickInterval()) { if (isRightToLeft()) { QPoint p = b->mapToGlobal(QPoint(b->x() + b->width(), b->y() + b->height())); |