diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qaction.cpp | 3 | ||||
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 54 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_p.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_s60.cpp | 7 | ||||
-rw-r--r-- | src/gui/kernel/qapplication_x11.cpp | 29 | ||||
-rw-r--r-- | src/gui/kernel/qdnd_win.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qgesture.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qgesture.h | 4 | ||||
-rw-r--r-- | src/gui/kernel/qgesture_p.h | 18 | ||||
-rw-r--r-- | src/gui/kernel/qgesturemanager.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qstandardgestures.cpp | 16 | ||||
-rw-r--r-- | src/gui/kernel/qt_cocoa_helpers_mac.mm | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 12 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_mac.mm | 12 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_s60.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 4 |
17 files changed, 145 insertions, 39 deletions
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index a6d2594..f7e0751 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -82,8 +82,9 @@ static QString qt_strippedText(QString s) QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0), visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false), forceEnabledInSoftkeys(false), menuActionSoftkeys(false), + iconVisibleInMenu(-1), menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey), - priority(QAction::NormalPriority), iconVisibleInMenu(-1) + priority(QAction::NormalPriority) { #ifdef QT3_SUPPORT static int qt_static_action_id = -1; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index ce5c2c6..c5dd7fe 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -65,6 +65,7 @@ #include "qcolormap.h" #include "qdebug.h" #include "private/qgraphicssystemfactory_p.h" +#include "private/qgraphicssystem_p.h" #include "private/qstylesheetstyle_p.h" #include "private/qstyle_p.h" #include "qmessagebox.h" @@ -94,6 +95,10 @@ #include <stdlib.h> +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) +#include <link.h> +#endif + #include "qapplication_p.h" #include "qevent_p.h" #include "qwidget_p.h" @@ -492,6 +497,7 @@ bool QApplicationPrivate::fade_tooltip = false; bool QApplicationPrivate::animate_toolbox = false; bool QApplicationPrivate::widgetCount = false; bool QApplicationPrivate::load_testability = false; +QString QApplicationPrivate::qmljsDebugArguments; #ifdef QT_KEYPAD_NAVIGATION # ifdef Q_OS_SYMBIAN Qt::NavigationMode QApplicationPrivate::navigationMode = Qt::NavigationModeKeypadDirectional; @@ -563,6 +569,8 @@ void QApplicationPrivate::process_cmdline() QString s; if (arg == "-qdevel" || arg == "-qdebug") { // obsolete argument + } else if (arg.indexOf("-qmljsdebugger=", 0) != -1) { + qmljsDebugArguments = QString::fromLocal8Bit(arg.right(arg.length() - 15)); } else if (arg.indexOf("-style=", 0) != -1) { s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); } else if (arg == "-style" && i < argc-1) { @@ -668,6 +676,9 @@ void QApplicationPrivate::process_cmdline() Qt::RightToLeft \o -graphicssystem, sets the backend to be used for on-screen widgets and QPixmaps. Available options are \c{raster} and \c{opengl}. + \o -qmljsdebugger=, activates the QML/JS debugger with a specified port. + The value must be of format port:1234[,block], where block is optional + and will make the application wait until a debugger connects to it. \endlist The X11 version of Qt supports some traditional X11 command line options: @@ -703,6 +714,12 @@ void QApplicationPrivate::process_cmdline() done. \endlist + \section1 X11 Notes + + If QApplication fails to open the X11 display, it will terminate + the process. This behavior is consistent with most X11 + applications. + \sa arguments() */ @@ -771,6 +788,13 @@ QApplication::QApplication(int &argc, char **argv, Type type , int _internal) : QCoreApplication(*new QApplicationPrivate(argc, argv, type)) { Q_D(QApplication); d->construct(); QApplicationPrivate::app_compile_version = _internal;} +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) +static int qt_matchLibraryName(dl_phdr_info *info, size_t, void *data) +{ + const char *name = static_cast<const char *>(data); + return strstr(info->dlpi_name, name) != 0; +} +#endif /*! \internal @@ -789,6 +813,19 @@ void QApplicationPrivate::construct( // the environment variable has the lowest precedence of runtime graphicssystem switches if (graphics_system_name.isEmpty()) graphics_system_name = QString::fromLocal8Bit(qgetenv("QT_GRAPHICSSYSTEM")); + +#if defined(Q_WS_X11) && !defined(QT_NO_EGL) + if (graphics_system_name.isEmpty()) { + bool linksWithMeeGoTouch = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libmeegotouchcore")); + bool linksWithMeeGoGraphicsSystemHelper = dl_iterate_phdr(qt_matchLibraryName, const_cast<char *>("libQtMeeGoGraphicsSystemHelper")); + + if (linksWithMeeGoTouch && !linksWithMeeGoGraphicsSystemHelper) { + qWarning("Running non-meego graphics system enabled MeeGo touch, forcing native graphicssystem\n"); + graphics_system_name = QLatin1String("native"); + } + } +#endif + // Must be called before initialize() qt_init(this, qt_appType #ifdef Q_WS_X11 @@ -1121,6 +1158,8 @@ QApplication::~QApplication() QApplicationPrivate::app_style = 0; delete QApplicationPrivate::app_icon; QApplicationPrivate::app_icon = 0; + delete QApplicationPrivate::graphics_system; + QApplicationPrivate::graphics_system = 0; #ifndef QT_NO_CURSOR d->cursor_list.clear(); #endif @@ -2373,8 +2412,13 @@ static const char *application_menu_strings[] = { }; QString qt_mac_applicationmenu_string(int type) { - return qApp->translate("MAC_APPLICATION_MENU", - application_menu_strings[type]); + QString menuString = QString::fromLatin1(application_menu_strings[type]); + QString translated = qApp->translate("QMenuBar", application_menu_strings[type]); + if (translated != menuString) + return translated; + else + return qApp->translate("MAC_APPLICATION_MENU", + application_menu_strings[type]); } #endif #endif @@ -4359,11 +4403,13 @@ bool QApplication::notify(QObject *receiver, QEvent *e) eventAccepted = ge.isAccepted(); for (int i = 0; i < gestures.size(); ++i) { QGesture *g = gestures.at(i); - if ((res && eventAccepted) || (!eventAccepted && ge.isAccepted(g))) { + // Ignore res [event return value] because handling of multiple gestures + // packed into a single QEvent depends on not consuming the event + if (eventAccepted || ge.isAccepted(g)) { // if the gesture was accepted, mark the target widget for it gestureEvent->d_func()->targetWidgets[g->gestureType()] = w; gestureEvent->setAccepted(g, true); - } else if (!eventAccepted && !ge.isAccepted(g)) { + } else { // if the gesture was explicitly ignored by the application, // put it back so a parent can get it allGestures.append(g); diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 416ac06..d63f9c0 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -464,6 +464,8 @@ public: static bool animate_toolbox; static bool widgetCount; // Coupled with -widgetcount switch static bool load_testability; // Coupled with -testability switch + static QString qmljsDebugArguments; // a string containing arguments for js/qml debugging. + #ifdef Q_WS_MAC static bool native_modal_dialog_active; #endif @@ -570,12 +572,12 @@ public: #ifndef QT_NO_GESTURES QGestureManager *gestureManager; QWidget *gestureWidget; +#endif #if defined(Q_WS_X11) || defined(Q_WS_WIN) QPixmap *move_cursor; QPixmap *copy_cursor; QPixmap *link_cursor; #endif -#endif #if defined(Q_WS_WIN) QPixmap *ignore_cursor; #endif diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index e937918..1127c84 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -673,6 +673,9 @@ void QSymbianControl::HandleStatusPaneSizeChange() { QS60MainAppUi *s60AppUi = static_cast<QS60MainAppUi *>(S60->appUi()); s60AppUi->HandleStatusPaneSizeChange(); + // Send resize event to trigger desktopwidget workAreaResized signal + QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); + QApplication::sendEvent(qt_desktopWidget, &e); } #endif @@ -1341,6 +1344,10 @@ void QSymbianControl::setFocusSafely(bool focus) // focus in Symbian. If this is not executed, the control which happens to be on // the top of the stack may randomly be assigned focus by Symbian, for example // when creating new windows (specifically in CCoeAppUi::HandleStackChanged()). + + // Close any popups. + CEikonEnv::Static()->EikAppUi()->StopDisplayingMenuBar(); + if (focus) { S60->appUi()->RemoveFromStack(this); // Symbian doesn't automatically remove focus from the last focused control, so we need to diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 7495f6d..d8fb74c 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -74,7 +74,6 @@ #include "qevent_p.h" #include "qvarlengtharray.h" #include "qdebug.h" -#include <private/qunicodetables_p.h> #include <private/qcrashhandler_p.h> #include <private/qcolor_p.h> #include <private/qcursor_p.h> @@ -400,11 +399,39 @@ QTabletDeviceDataList *qt_tablet_devices() extern bool qt_tabletChokeMouse; #endif +typedef bool(*QX11FilterFunction)(XEvent *event); + +Q_GLOBAL_STATIC(QList<QX11FilterFunction>, x11Filters) + +Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func) +{ + Q_ASSERT(func); + + if (QList<QX11FilterFunction> *list = x11Filters()) + list->append(func); +} + +Q_GUI_EXPORT void qt_removeX11EventFilter(QX11FilterFunction func) +{ + Q_ASSERT(func); + + if (QList<QX11FilterFunction> *list = x11Filters()) + list->removeOne(func); +} + + static bool qt_x11EventFilter(XEvent* ev) { long unused; if (qApp->filterEvent(ev, &unused)) return true; + if (const QList<QX11FilterFunction> *list = x11Filters()) { + for (QList<QX11FilterFunction>::const_iterator it = list->constBegin(); it != list->constEnd(); ++it) { + if ((*it)(ev)) + return true; + } + } + return qApp->x11EventFilter(ev); } diff --git a/src/gui/kernel/qdnd_win.cpp b/src/gui/kernel/qdnd_win.cpp index a164c2a..7083886 100644 --- a/src/gui/kernel/qdnd_win.cpp +++ b/src/gui/kernel/qdnd_win.cpp @@ -515,7 +515,7 @@ static inline Qt::MouseButtons keystate_to_mousebutton(DWORD grfKeyState) //--------------------------------------------------------------------- // IDropSource Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) { #ifdef QDND_DEBUG @@ -545,7 +545,7 @@ QOleDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) } } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropSource::GiveFeedback(DWORD dwEffect) { Qt::DropAction action = translateToQDragDropAction(dwEffect); @@ -626,7 +626,7 @@ QOleDropTarget::Release(void) // IDropTarget Methods //--------------------------------------------------------------------- -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragEnter(LPDATAOBJECT pDataObj, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -688,7 +688,7 @@ void QOleDropTarget::sendDragEnterEvent(QWidget *dragEnterWidget, DWORD grfKeySt } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG @@ -758,7 +758,7 @@ QOleDropTarget::DragOver(DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) return NOERROR; } -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::DragLeave() { #ifdef QDND_DEBUG @@ -785,7 +785,7 @@ QOleDropTarget::DragLeave() #define KEY_STATE_BUTTON_MASK (MK_LBUTTON | MK_MBUTTON | MK_RBUTTON) -STDMETHODIMP +QT_ENSURE_STACK_ALIGNED_FOR_SSE STDMETHODIMP QOleDropTarget::Drop(LPDATAOBJECT /*pDataObj*/, DWORD grfKeyState, POINTL pt, LPDWORD pdwEffect) { #ifdef QDND_DEBUG diff --git a/src/gui/kernel/qgesture.cpp b/src/gui/kernel/qgesture.cpp index 13274c4..5725a22 100644 --- a/src/gui/kernel/qgesture.cpp +++ b/src/gui/kernel/qgesture.cpp @@ -775,4 +775,6 @@ int QTapAndHoldGesturePrivate::Timeout = 700; // in ms QT_END_NAMESPACE +#include <moc_qgesture.cpp> + #endif // QT_NO_GESTURES diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h index dcb0264..8416708 100644 --- a/src/gui/kernel/qgesture.h +++ b/src/gui/kernel/qgesture.h @@ -54,6 +54,7 @@ QT_BEGIN_HEADER Q_DECLARE_METATYPE(Qt::GestureState) +Q_DECLARE_METATYPE(Qt::GestureType) QT_BEGIN_NAMESPACE @@ -112,6 +113,8 @@ class Q_GUI_EXPORT QPanGesture : public QGesture Q_PROPERTY(QPointF offset READ offset WRITE setOffset) Q_PROPERTY(QPointF delta READ delta STORED false) Q_PROPERTY(qreal acceleration READ acceleration WRITE setAcceleration) + Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal horizontalVelocity READ horizontalVelocity WRITE setHorizontalVelocity) + Q_PRIVATE_PROPERTY(QPanGesture::d_func(), qreal verticalVelocity READ verticalVelocity WRITE setVerticalVelocity) public: QPanGesture(QObject *parent = 0); @@ -210,6 +213,7 @@ class Q_GUI_EXPORT QSwipeGesture : public QGesture Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false) Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false) Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle) + Q_PRIVATE_PROPERTY(QSwipeGesture::d_func(), qreal velocity READ velocity WRITE setVelocity) public: enum SwipeDirection { NoDirection, Left, Right, Up, Down }; diff --git a/src/gui/kernel/qgesture_p.h b/src/gui/kernel/qgesture_p.h index 29b923e..6a856ac 100644 --- a/src/gui/kernel/qgesture_p.h +++ b/src/gui/kernel/qgesture_p.h @@ -88,14 +88,21 @@ class QPanGesturePrivate : public QGesturePrivate public: QPanGesturePrivate() - : acceleration(0) + : acceleration(0), xVelocity(0), yVelocity(0) { } + qreal horizontalVelocity() const { return xVelocity; } + void setHorizontalVelocity(qreal value) { xVelocity = value; } + qreal verticalVelocity() const { return yVelocity; } + void setVerticalVelocity(qreal value) { yVelocity = value; } + QPointF lastOffset; QPointF offset; QPoint startPosition; qreal acceleration; + qreal xVelocity; + qreal yVelocity; }; class QPinchGesturePrivate : public QGesturePrivate @@ -105,7 +112,7 @@ class QPinchGesturePrivate : public QGesturePrivate public: QPinchGesturePrivate() : totalChangeFlags(0), changeFlags(0), - totalScaleFactor(0), lastScaleFactor(0), scaleFactor(0), + totalScaleFactor(1), lastScaleFactor(1), scaleFactor(1), totalRotationAngle(0), lastRotationAngle(0), rotationAngle(0), isNewSequence(true) { @@ -139,17 +146,20 @@ public: : horizontalDirection(QSwipeGesture::NoDirection), verticalDirection(QSwipeGesture::NoDirection), swipeAngle(0), - started(false), speed(0) + started(false), velocityValue(0) { } + qreal velocity() const { return velocityValue; } + void setVelocity(qreal value) { velocityValue = value; } + QSwipeGesture::SwipeDirection horizontalDirection; QSwipeGesture::SwipeDirection verticalDirection; qreal swipeAngle; QPoint lastPositions[3]; bool started; - qreal speed; + qreal velocityValue; QElapsedTimer time; }; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 5c80340..6dd8127 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -184,7 +184,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ // get or create a QGesture object that will represent the state for a given object, used by the recognizer QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type) { - // if the widget is being deleted we should be carefull and not to + // if the widget is being deleted we should be careful not to // create a new state, as it will create QWeakPointer which doesnt work // from the destructor. if (object->isWidgetType()) { diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index c2f275a..50b2354 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -590,7 +590,7 @@ static const struct { //: Button that will hang up if we're in call, or make a call if we're not. { Qt::Key_ToggleCallHangup, QT_TRANSLATE_NOOP("QShortcut", "Toggle Call/Hangup") }, { Qt::Key_Flip, QT_TRANSLATE_NOOP("QShortcut", "Flip") }, - //: Button to trigger voice dialling + //: Button to trigger voice dialing { Qt::Key_VoiceDial, QT_TRANSLATE_NOOP("QShortcut", "Voice Dial") }, //: Button to redial the last number called { Qt::Key_LastNumberRedial, QT_TRANSLATE_NOOP("QShortcut", "Last Number Redial") }, diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp index 127e150..893ba2b 100644 --- a/src/gui/kernel/qstandardgestures.cpp +++ b/src/gui/kernel/qstandardgestures.cpp @@ -199,6 +199,7 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->startPosition[1] = p2.screenPos(); } QLineF line(p1.screenPos(), p2.screenPos()); + QLineF lastLine(p1.lastScreenPos(), p2.lastScreenPos()); QLineF tmp(line); tmp.setLength(line.length() / 2.); QPointF centerPoint = tmp.p2(); @@ -207,16 +208,15 @@ QGestureRecognizer::Result QPinchGestureRecognizer::recognize(QGesture *state, d->centerPoint = centerPoint; d->changeFlags |= QPinchGesture::CenterPointChanged; - const qreal scaleFactor = - QLineF(p1.screenPos(), p2.screenPos()).length() - / QLineF(d->startPosition[0], d->startPosition[1]).length(); + const qreal scaleFactor = line.length() / lastLine.length(); + if (d->isNewSequence) { d->lastScaleFactor = scaleFactor; } else { d->lastScaleFactor = d->scaleFactor; } d->scaleFactor = scaleFactor; - d->totalScaleFactor += d->scaleFactor - d->lastScaleFactor; + d->totalScaleFactor = d->totalScaleFactor * scaleFactor; d->changeFlags |= QPinchGesture::ScaleFactorChanged; qreal angle = QLineF(p1.screenPos(), p2.screenPos()).angle(); @@ -266,7 +266,7 @@ void QPinchGestureRecognizer::reset(QGesture *state) d->totalChangeFlags = d->changeFlags = 0; d->startCenterPoint = d->lastCenterPoint = d->centerPoint = QPointF(); - d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 0; + d->totalScaleFactor = d->lastScaleFactor = d->scaleFactor = 1; d->totalRotationAngle = d->lastRotationAngle = d->rotationAngle = 0; d->isNewSequence = true; @@ -304,7 +304,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, switch (event->type()) { case QEvent::TouchBegin: { - d->speed = 1; + d->velocityValue = 1; d->time.start(); d->started = true; result = QGestureRecognizer::MayBeGesture; @@ -345,7 +345,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state, int elapsedTime = d->time.restart(); if (!elapsedTime) elapsedTime = 1; - d->speed = 0.9 * d->speed + distance / elapsedTime; + d->velocityValue = 0.9 * d->velocityValue + distance / elapsedTime; d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle(); static const int MoveThreshold = 50; @@ -407,7 +407,7 @@ void QSwipeGestureRecognizer::reset(QGesture *state) d->lastPositions[0] = d->lastPositions[1] = d->lastPositions[2] = QPoint(); d->started = false; - d->speed = 0; + d->velocityValue = 0; d->time.invalidate(); QGestureRecognizer::reset(state); diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 7d23abf..3945754 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -193,6 +193,7 @@ void macWindowToolbarShow(const QWidget *widget, bool show ) } } #else + qt_widget_private(const_cast<QWidget *>(widget))->updateFrameStrut(); ShowHideWindowToolbar(wnd, show, false); #endif } diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 819e555..db560ce 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1199,7 +1199,7 @@ void QWidgetPrivate::adjustFlags(Qt::WindowFlags &flags, QWidget *w) flags |= Qt::WindowTitleHint; } if (customize) - ; // don't modify window flags if the user explicitely set them. + ; // don't modify window flags if the user explicitly set them. else if (type == Qt::Dialog || type == Qt::Sheet) #ifndef Q_WS_WINCE flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint; @@ -7525,7 +7525,7 @@ void QWidgetPrivate::hide_helper() A hidden widget will only become visible when show() is called on it. It will not be automatically shown when the parent is shown. - To check visiblity, use !isVisible() instead (notice the exclamation mark). + To check visibility, use !isVisible() instead (notice the exclamation mark). isHidden() implies !isVisible(), but a widget can be not visible and not hidden at the same time. This is the case for widgets that are children of @@ -11123,7 +11123,7 @@ void QWidget::updateMicroFocus() { #if !defined(QT_NO_IM) && (defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) Q_D(QWidget); - // and optimisation to update input context only it has already been created. + // and optimization to update input context only it has already been created. if (d->ic || qApp->d_func()->inputContext) { QInputContext *ic = inputContext(); if (ic) @@ -11868,8 +11868,8 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction) Tells us if it there is currently a reachable widget by keypad navigation in a certain \a orientation. - If no navigation is possible, occuring key events in that \a orientation may - be used to interact with the value in the focussed widget, even though it + If no navigation is possible, occurring key events in that \a orientation may + be used to interact with the value in the focused widget, even though it currently has not the editFocus. \sa QWidgetPrivate::widgetInNavigationDirection(), QWidget::hasEditFocus() @@ -11889,7 +11889,7 @@ bool QWidgetPrivate::canKeypadNavigate(Qt::Orientation orientation) one, left/right key events will be used to switch between tabs in keypad navigation. If there is no QTabWidget, the horizontal key events can be used to - interact with the value in the focussed widget, even though it currently has + interact with the value in the focused widget, even though it currently has not the editFocus. \sa QWidget::hasEditFocus() diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 1979c84..1e2aa9f 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -114,6 +114,9 @@ QT_BEGIN_NAMESPACE +// qmainwindow.cpp +extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window); + #define XCOORD_MAX 16383 #define WRECT_MAX 8191 @@ -2375,7 +2378,8 @@ void QWidgetPrivate::recreateMacWindow() HIViewRemoveFromSuperview(myView); determineWindowClass(); createWindow_sys(); - if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) { + + if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) { mwl->updateHIToolBarStatus(); } @@ -2912,7 +2916,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // We do this down below for wasCreated, so avoid doing this twice // (only for performance, it gets called a lot anyway). if (!wasCreated) { - if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) { + if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) { mwl->updateHIToolBarStatus(); } } @@ -2937,7 +2941,7 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f) // If we were a unified window, We just transfered our toolbars out of the unified toolbar. // So redo the status one more time. It apparently is not an issue with Cocoa. if (q->isWindow()) { - if (QMainWindowLayout *mwl = qobject_cast<QMainWindowLayout *>(q->layout())) { + if (QMainWindowLayout *mwl = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q))) { mwl->updateHIToolBarStatus(); } } @@ -5138,7 +5142,7 @@ void QWidgetPrivate::macUpdateMetalAttribute() return; recreateMacWindow(); #else - QMainWindowLayout *layout = qobject_cast<QMainWindowLayout *>(q->layout()); + QMainWindowLayout *layout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(q)); if (q->testAttribute(Qt::WA_MacBrushedMetal)) { if (layout) layout->updateHIToolBarStatus(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index c98c05a..4109ed8 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -518,7 +518,7 @@ void QWidgetPrivate::show_sys() if (q->windowState() & Qt::WindowMaximized) { TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); id->SetExtent(r.iTl, r.Size()); - } else if (!q->testAttribute(Qt::WA_Moved)) { + } else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) { id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); } } diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index e01489f..8d80e10 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -889,8 +889,10 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO q->setWindowOpacity(maybeTopData()->opacity/255.); } - } else if (q->testAttribute(Qt::WA_SetCursor) && q->internalWinId()) { + } else if (q->internalWinId()) { qt_x11_enforce_cursor(q); + if (QWidget *p = q->parentWidget()) // reset the cursor on the native parent + qt_x11_enforce_cursor(p); } if (extra && !extra->mask.isEmpty() && q->internalWinId()) |