diff options
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/qmenu_mac.mm | 38 | ||||
-rw-r--r-- | src/gui/widgets/qscrollbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qworkspace.cpp | 10 |
7 files changed, 40 insertions, 32 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/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/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())); |