diff options
author | Water-Team <water@pad.test.qt.nokia.com> | 2011-06-29 21:42:03 (GMT) |
---|---|---|
committer | Water-Team <water@pad.test.qt.nokia.com> | 2011-06-29 21:42:03 (GMT) |
commit | 0a8daa8845325fba9cf2ec973eb6bab8a2853dd5 (patch) | |
tree | 504c698037ee6283f1b5dbc6fa658bb2bfffb99a /src/gui/kernel | |
parent | 680023c4921019614948c277cde5498645836cb9 (diff) | |
parent | 6b3f2a3b96d01dc339d07a076300d29616603b28 (diff) | |
download | Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.zip Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.gz Qt-0a8daa8845325fba9cf2ec973eb6bab8a2853dd5.tar.bz2 |
Merge branch '4.8-upstream' into master-water
Diffstat (limited to 'src/gui/kernel')
23 files changed, 207 insertions, 163 deletions
diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp index 8029dfb..cbab6aa 100644 --- a/src/gui/kernel/qactiongroup.cpp +++ b/src/gui/kernel/qactiongroup.cpp @@ -108,8 +108,8 @@ void QActionGroupPrivate::_q_actionHovered() \ingroup mainwindow-classes - In some situations it is useful to group actions together. For - example, if you have a \gui{Left Align} action, a \gui{Right + In some situations it is useful to group QAction objects together. + For example, if you have a \gui{Left Align} action, a \gui{Right Align} action, a \gui{Justify} action, and a \gui{Center} action, only one of these actions should be active at any one time. One simple way of achieving this is to group the actions together in diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 3803599..361ec6d 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -1288,8 +1288,8 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis || event->type() == QEvent::LanguageChange || event->type() == QEvent::UpdateSoftKeys || event->type() == QEvent::InputMethod)) { - for (int i = 0; i < postedEvents->size(); ++i) { - const QPostEvent &cur = postedEvents->at(i); + for (QPostEventList::const_iterator it = postedEvents->constBegin(); it != postedEvents->constEnd(); ++it) { + const QPostEvent &cur = *it; if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type()) continue; if (cur.event->type() == QEvent::LayoutRequest diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index 0b9cad8..c5ff799 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -218,7 +218,6 @@ extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.cpp extern QWidget *qt_mac_find_window(OSWindowRef); //qwidget_mac.cpp extern void qt_mac_set_cursor(const QCursor *); //qcursor_mac.cpp extern bool qt_mac_is_macsheet(const QWidget *); //qwidget_mac.cpp -extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp extern void qt_mac_command_set_enabled(MenuRef, UInt32, bool); //qmenu_mac.cpp extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplication.cpp extern void qt_mac_update_cursor(); // qcursor_mac.mm @@ -2624,8 +2623,6 @@ OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, Ap Return true if you want to stop the event from being processed. Return false for normal event dispatching. The default implementation returns false. - - \sa macEventFilter(void *nsevent) */ bool QApplication::macEventFilter(EventHandlerCallRef, EventRef) { diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index 5787c71..b23c15c 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -444,6 +444,9 @@ void QApplication::alert(QWidget *, int) { } +/*! + \internal +*/ QPlatformNativeInterface *QApplication::platformNativeInterface() { QPlatformIntegration *pi = QApplicationPrivate::platformIntegration(); diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp index 1197c77..3b6a075 100644 --- a/src/gui/kernel/qapplication_qws.cpp +++ b/src/gui/kernel/qapplication_qws.cpp @@ -209,7 +209,7 @@ QString qws_dataDir() if (!S_ISDIR(buf.st_mode)) qFatal("%s is not a directory", dataDir.constData()); -#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) +#if !defined(Q_OS_INTEGRITY) && !defined(Q_OS_VXWORKS) && !defined(Q_OS_QNX) if (buf.st_uid != getuid()) qFatal("Qt for Embedded Linux data directory is not owned by user %d", getuid()); @@ -2184,6 +2184,11 @@ void qt_init(QApplicationPrivate *priv, int type) qws_screen_is_interlaced = read_bool_env_var("QWS_INTERLACE",false); const char *display = ::getenv("QWS_DISPLAY"); + +#ifdef QT_QWS_DEFAULT_DRIVER_NAME + if (!display) display = QT_QWS_DEFAULT_DRIVER_NAME; +#endif + if (display) qws_display_spec = display; // since we setenv later! diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 31d02d4..5ac9803 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -134,7 +134,7 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo s->MakeVisible(statusPaneVisible); } if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) { - const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size(); + const QSize size = qt_TRect2QRect(S60->clientRect()).size(); const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents QResizeEvent event(size, oldSize); QApplication::instance()->sendEvent(QApplication::desktop(), &event); @@ -231,6 +231,28 @@ void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible) } } +TRect QS60Data::clientRect() +{ + TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + if (S60->partialKeyboardOpen) { + // Adjust client rect when splitview is open, since for some curious reason + // native side insists that clientRect starts from (0,0) even though status + // pane might be visible. + TRect statusPaneRect; + TRect mainRect; + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane, statusPaneRect); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, mainRect); + int clientAreaHeight = mainRect.Height(); + CEikStatusPane *const s = S60->statusPane(); + if (s && s->IsVisible()) + r.Move(0, statusPaneRect.Height()); + else + clientAreaHeight += statusPaneRect.Height(); + r.SetHeight(clientAreaHeight); + } + return r; +} + bool qt_nograb() // application no-grab option { #if defined(QT_DEBUG) @@ -908,6 +930,15 @@ TKeyResponse QSymbianControl::sendSymbianKeyEvent(const TKeyEvent &keyEvent, QEv } Qt::KeyboardModifiers mods = mapToQtModifiers(keyEvent.iModifiers); + + TInt code = keyEvent.iCode; + + if (mods == Qt::ControlModifier) { + //only support ctrl+a .. ctrl+z, 0x40 is the key value before Qt::Key_A + if (code > 0 && code < 27) + keyCode = 0x40 + code; + } + QKeyEventEx qKeyEvent(type, keyCode, mods, qt_keymapper_private()->translateKeyEvent(keyCode, mods), (keyEvent.iRepeats != 0), 1, keyEvent.iScanCode, s60Keysym, keyEvent.iModifiers); QWidget *widget; @@ -1435,7 +1466,9 @@ void QSymbianControl::handleClientAreaChange() if (qwidget->isFullScreen() && !cbaVisibilityHint) { SetExtentToWholeScreen(); } else if (qwidget->isMaximized() || (qwidget->isFullScreen() && cbaVisibilityHint)) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + // Note that if there is S60->splitViewLastWidget, it means the resizing is done + // by input context handling and we can use just default ClientRect. + TRect r = (!S60->splitViewLastWidget) ? S60->clientRect() : static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); SetExtent(r.iTl, r.Size()); } else if (!qwidget->isMinimized()) { // Normal geometry if (!qwidget->testAttribute(Qt::WA_Resized)) { @@ -1443,7 +1476,7 @@ void QSymbianControl::handleClientAreaChange() qwidget->setAttribute(Qt::WA_Resized, false); //not a user resize } if (!qwidget->testAttribute(Qt::WA_Moved) && qwidget->windowType() != Qt::Dialog) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect r = S60->clientRect(); SetPosition(r.iTl); qwidget->setAttribute(Qt::WA_Moved, false); // not really an explicit position } @@ -1489,13 +1522,14 @@ void QSymbianControl::HandleResourceChange(int resourceType) if (!ic) { ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext()); } - if (ic && isSplitViewWidget(widget)) { + if (ic) { if (resourceType == KSplitViewCloseEvent) { S60->partialKeyboardOpen = false; ic->resetSplitViewWidget(); } else { S60->partialKeyboardOpen = true; - ic->ensureFocusWidgetVisible(widget); + if (isSplitViewWidget(widget)) + ic->ensureFocusWidgetVisible(widget); } } } @@ -1508,7 +1542,8 @@ void QSymbianControl::HandleResourceChange(int resourceType) // client area. if (S60->statusPane() && (S60->statusPane()->IsVisible() || m_lastStatusPaneVisibility)) { m_lastStatusPaneVisibility = S60->statusPane()->IsVisible(); - handleClientAreaChange(); + if (S60->handleStatusPaneResizeNotifications) + handleClientAreaChange(); } if (IsFocused() && IsVisible()) { qwidget->d_func()->setWindowIcon_sys(true); @@ -1531,6 +1566,11 @@ void QSymbianControl::HandleResourceChange(int resourceType) QResizeEvent e(qt_desktopWidget->size(), qt_desktopWidget->size()); QApplication::sendEvent(qt_desktopWidget, &e); } + // Send resize event to dialogs so they can adjust their position if necessary. + if (qwidget->windowType() & Qt::Dialog) { + QResizeEvent e(qwidget->size(), qwidget->size()); + QApplication::sendEvent(qwidget, &e); + } break; } #endif @@ -1907,7 +1947,7 @@ void qt_cleanup() qt_S60Beep = 0; } QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles - QPixmapCache::clear(); // Has to happen now, since QS60PixmapData has FBS handles + QPixmapCache::clear(); // Has to happen now, since QSymbianRasterPixmapData has FBS handles #ifdef QT_NO_FREETYPE qt_cleanup_symbianFontDatabase(); diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp index 156c970..86d8f3f 100644 --- a/src/gui/kernel/qdesktopwidget_s60.cpp +++ b/src/gui/kernel/qdesktopwidget_s60.cpp @@ -161,7 +161,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that) (*rects)[i] = r; QRect wr; if (i == 0) - wr = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); + wr = qt_TRect2QRect(S60->clientRect()); else wr = rects->at(i); (*workrects)[i].setRect(wr.x(), wr.y(), wr.width(), wr.height()); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index bdd2fe4..de2d87e 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3103,10 +3103,10 @@ QUrl QFileOpenEvent::url() const } /*! - \fn bool openFile(QFile &file, QIODevice::OpenMode flags) const + \fn bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const - Opens a QFile on the file referenced by this event. - Returns true if successful; otherwise returns false. + Opens a QFile on the \a file referenced by this event in the mode specified + by \a flags. Returns true if successful; otherwise returns false. This is necessary as some files cannot be opened by name, but require specific information stored in this event. diff --git a/src/gui/kernel/qgenericplugin_qpa.cpp b/src/gui/kernel/qgenericplugin_qpa.cpp index ca2fe7a..e7b65b7 100644 --- a/src/gui/kernel/qgenericplugin_qpa.cpp +++ b/src/gui/kernel/qgenericplugin_qpa.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE \brief The QGenericPlugin class is an abstract base class for window-system related plugins in Qt QPA. - Note that this class is only available in \l{Qt QPA}. + Note that this class is only available in Qt QPA. A mouse plugin can be created by subclassing QGenericPlugin and reimplementing the pure virtual keys() and diff --git a/src/gui/kernel/qgenericpluginfactory_qpa.cpp b/src/gui/kernel/qgenericpluginfactory_qpa.cpp index 8db22fb..fb6a0d8 100644 --- a/src/gui/kernel/qgenericpluginfactory_qpa.cpp +++ b/src/gui/kernel/qgenericpluginfactory_qpa.cpp @@ -65,8 +65,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, \brief The QGenericPluginFactory class creates window-system related plugin drivers in Qt QPA. - Note that this class is only available in \l{Qt QPA}. - + Note that this class is only available in Qt QPA. \sa QGenericPlugin */ diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index a1df34e..8b47d8e 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -119,10 +119,6 @@ const QStringList& qEnabledDraggedTypes() *****************************************************************************/ //#define DEBUG_MIME_MAPS -//functions -extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp -extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp - ScrapFlavorType qt_mac_mime_type = 'CUTE'; CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker"); diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp index e612e2d..0695486 100644 --- a/src/gui/kernel/qplatformcursor_qpa.cpp +++ b/src/gui/kernel/qplatformcursor_qpa.cpp @@ -52,48 +52,46 @@ QT_BEGIN_NAMESPACE QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances; /*! - \class QGraphicsSystemCursor + \class QPlatformCursor - \brief The QGraphicsSystemCursor class provides information about + \brief The QPlatformCursor class provides information about pointer device events (movement, buttons), and requests to change the currently displayed cursor. - Note that QGraphicsSystemCursor does not include any graphics for + Note that QPlatformCursor does not include any graphics for display. An application that sets a QCursor may provide its own graphics. - \sa QGraphicsSystemCursorImage + \sa QPlatformCursorImage */ /*! - \fn virtual void QGraphicsSystemCursor::pointerEvent(const QMouseEvent & event) + \fn virtual void QPlatformCursor::pointerEvent(const QMouseEvent & event) This method is called by Qt whenever a QMouseEvent is generated by the underlying pointer input. \a event is a reference to the QMouseEvent in question. A default do-nothing implementation is provided. - - \sa QApplicationPrivate::handleMouseEvent() */ /*! - \fn virtual void QGraphicsSystemCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) + \fn virtual void QPlatformCursor::changeCursor(QCursor * widgetCursor, QWidget * widget) \brief This method is called by Qt whenever the cursor graphic should be changed. - Implementation of this method is mandatory for a subclass of QGraphicsSystemCursor. + Implementation of this method is mandatory for a subclass of QPlatformCursor. \a widgetCursor is a pointer to the QCursor that should be displayed. \a widget is a pointer to the widget currently displayed at QCursor::pos(). Note that this may be 0 if the current position is not occupied by a displayed widget. - \sa QApplicationPrivate::handleMouseEvent(), QCursor::pos() + \sa QCursor::pos() */ /*! - \fn QGraphicsSystemCursor::QGraphicsSystemCursor() + \fn QPlatformCursor::QPlatformCursor(QPlatformScreen *screen) - \brief Constructs a QGraphicsSystemCursor + Constructs a QPlatformCursor for the given \a screen. */ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) : screen(scr) @@ -106,12 +104,12 @@ QPlatformCursor::QPlatformCursor(QPlatformScreen *scr ) // from src/gui/embedded/QGraphicsSystemCursorImage_qws.cpp /*! - \class QGraphicsSystemCursorImage + \class QPlatformCursorImage - \brief The QGraphicsSystemCursorImage class provides a set of graphics + \brief The QPlatformCursorImage class provides a set of graphics intended to be used as cursors. - \sa QGraphicsSystemCursor + \sa QPlatformCursor */ static QPlatformCursorImage *systemCursorTable[Qt::LastCursor+1]; @@ -502,7 +500,7 @@ void QPlatformCursorImage::createSystemCursor(int id) } /*! - \fn void QGraphicsSystemCursorImage::set(Qt::CursorShape id) + \fn void QPlatformCursorImage::set(Qt::CursorShape id) \brief Calling this method sets the cursor image to the specified shape @@ -531,15 +529,8 @@ void QPlatformCursorImage::set(Qt::CursorShape id) } /*! - \fn void QGraphicsSystemCursorImage::set(const QImage * image, int hx, int hy) - - \brief Set the cursor image to the specified QImage, with the hotsport at (hx, hy) - - \a image A pointer to a QImage - - \a hx The x coordinate of the cursor's hotspot - - \a hy the y coordinate of the cursor's hotspot + Sets the cursor image to the given \a image, with the hotspot at the + point specified by (\a hx, \a hy). */ void QPlatformCursorImage::set(const QImage &image, int hx, int hy) @@ -550,22 +541,19 @@ void QPlatformCursorImage::set(const QImage &image, int hx, int hy) } /*! - \fn void QGraphicsSystemCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn + \fn void QPlatformCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) - \a width The width of the graphic in pixels + Sets the cursor image to the graphic represented by the combination of + \a data and \a mask, with dimensions given by \a width and \a height and a + hotspot at the point specified by (\a hx, \a hy). - \a height The height of the graphic in pixels + The image data specified by \a data must be supplied in the format + described by QImage::Format_Indexed8. - \a hx The X hotspot of the cursor graphic - - \a hy The Y hotspot of the cursor graphic + The corresponding mask data specified by \a mask must be supplied in a + character array containing packed 1 bit per pixel format data, with any + padding bits at the end of the array. Bits of value 0 represent transparent + pixels in the image data. */ void QPlatformCursorImage::set(const uchar *data, const uchar *mask, int width, int height, int hx, int hy) @@ -625,34 +613,23 @@ void QPlatformCursorImage::set(const uchar *data, const uchar *mask, } /*! - \fn QGraphicsSystemCursorImage::QGraphicsSystemCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - - \brief set the cursor image to the graphic represented by the combination of data, mask, - width, and height - - \a data The pixel data of the graphic - - \a mask Mask data for the graphic. pixels in data with a corresponding mask bit of 0 are not drawn - - \a width The width of the graphic in pixels - - \a height The height of the graphic in pixels - - \a hotX The X hotspot of the cursor graphic + \fn QPlatformCursorImage::QPlatformCursorImage(const uchar *data, const uchar *mask, int width, int height, int hotX, int hotY) - \a hotY The Y hotspot of the cursor graphic + Sets the cursor image to the graphic represented by the combination of + \a data and \a mask, with dimensions given by \a width and \a height and a + hotspot at the point specified by (\a hotX, \a hotY). - \sa set + \sa set() */ /*! - \fn QImage *QGraphicsSystemCursorImage::image() + \fn QImage *QPlatformCursorImage::image() \brief Return the cursor graphic as a pointer to a QImage */ /*! - \fn QPoint QGraphicsSystemCursorImage::hotspot() + \fn QPoint QPlatformCursorImage::hotspot() \brief Return the cursor's hotspot */ diff --git a/src/gui/kernel/qplatformglcontext_qpa.cpp b/src/gui/kernel/qplatformglcontext_qpa.cpp index 8daa5d4..5c56efb 100644 --- a/src/gui/kernel/qplatformglcontext_qpa.cpp +++ b/src/gui/kernel/qplatformglcontext_qpa.cpp @@ -191,17 +191,17 @@ void QPlatformGLContext::deleteQGLContext() which maps to the QPlatformGLContext. */ -/*! \fn void swapBuffers() +/*! \fn void QPlatformGLContext::swapBuffers() Reimplement in subclass to native swap buffers calls */ -/*! getProcAddress(const QString& procName) +/*! \fn void *QPlatformGLContext::getProcAddress(const QString &procName) Reimplement in subclass to native getProcAddr calls. Note: its convenient to use qPrintable(const QString &str) to get the const char * pointer */ -/*! platformWindowFormat() const +/*! \fn QPlatformWindowFormat QPlatformGLContext::platformWindowFormat() const QWidget has the function qplatformWindowFormat(). That function is for the application programmer to request the format of the window and the context that he wants. diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 972fb0a..29287fe 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -132,20 +132,20 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const the recommended approach for making new platform plugin is to copy an existing plugin inside the QTSRCTREE/src/plugins/platform and develop the plugin inside the source tree. - The minimal platformintegration is the smallest platform integration it is possible to make, + The minimal platform integration is the smallest platform integration it is possible to make, which makes it an ideal starting point for new plugins. For a slightly more advanced plugin, consider reviewing the directfb plugin, or the testlite plugin. */ /*! - \fn QPixmapData *createPixmapData(QPixmapData::PixelType type) const + \fn QPixmapData *QPlatformIntegration::createPixmapData(QPixmapData::PixelType type) const Factory function for QPixmapData. PixelType can be either PixmapType or BitmapType. \sa QPixmapData */ /*! - \fn QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const + \fn QPlatformWindow *QPlatformIntegration::createPlatformWindow(QWidget *widget, WId winId = 0) const Factory function for QPlatformWindow. The widget parameter is a pointer to the top level widget(tlw) which the QPlatformWindow is suppose to be created for. The WId handle is actually @@ -162,7 +162,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const + \fn QWindowSurface *QPlatformIntegration::createWindowSurface(QWidget *widget, WId winId) const Factory function for QWindowSurface. The QWidget parameter is a pointer to the top level widget(tlw) the window surface is created for. A QPlatformWindow is always created @@ -175,7 +175,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn void moveToScreen(QWidget *window, int screen) + \fn void QPlatformIntegration::moveToScreen(QWidget *window, int screen) This function is called when a QWidget is displayed on screen, or the QWidget is to be displayed on a new screen. The QWidget parameter is a pointer to the top level widget and @@ -187,14 +187,14 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QList<QPlatformScreen *> screens() const + \fn QList<QPlatformScreen *> QPlatformIntegration::screens() const Accessor function to a list of all the screens on the current system. The screen with the index == 0 is the default/main screen. */ /*! - \fn bool isVirtualDesktop() + \fn bool QPlatformIntegration::isVirtualDesktop() Returns if the current windowing system configuration defines all the screens to be one desktop(virtual desktop), or if each screen is a desktop of its own. @@ -203,7 +203,7 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const */ /*! - \fn QPixmap grabWindow(WId window, int x, int y, int width, int height) const + \fn QPixmap QPlatformIntegration::grabWindow(WId window, int x, int y, int width, int height) const This function is called when Qt needs to be able to grab the content of a window. diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp index 87e40e4..2a1e7e4 100644 --- a/src/gui/kernel/qplatformscreen_qpa.cpp +++ b/src/gui/kernel/qplatformscreen_qpa.cpp @@ -66,12 +66,15 @@ QWidget *QPlatformScreen::topLevelAt(const QPoint & pos) const return 0; } -/*! \fn physicalSize() const - Reimplement in subclass to return the physical size of the screen. This function is used by - QFont to convert point sizes to pixel sizes. - - Default implementation takes the pixel size of the screen, considers a dpi of 100 and returns - the calculated (and probably wrong) physical size +/*! + Reimplement this function in subclass to return the physical size of the + screen. This function is used by QFont to convert point sizes to pixel + sizes. + + The default implementation takes the pixel size of the screen, considers a + resolution of 100 dots per inch, and returns the calculated physical size. + A device with a screen that has different resolutions will need to be + supported by a suitable reimplementation of this function. */ QSize QPlatformScreen::physicalSize() const { @@ -110,20 +113,20 @@ QPlatformScreen * QPlatformScreen::platformScreenForWidget(const QWidget *widget QPlatformScreen is also used by the public api QDesktopWidget for information about the desktop. */ -/*! \fn geometry() const +/*! \fn QRect QPlatformScreen::geometry() const = 0 Reimplement in subclass to return the pixel geometry of the screen */ -/*! \fn availableGeometry() const +/*! \fn QRect QPlatformScreen::availableGeometry() const Reimplement in subclass to return the pixel geometry of the available space This normally is the desktop screen minus the task manager, global menubar etc. */ -/*! \fn depth() const +/*! \fn int QPlatformScreen::depth() const = 0 Reimplement in subclass to return current depth of the screen */ -/*! \fn format() const +/*! \fn QImage::Format QPlatformScreen::format() const = 0 Reimplement in subclass to return the image format which corresponds to the screen format */ diff --git a/src/gui/kernel/qplatformwindowformat_qpa.cpp b/src/gui/kernel/qplatformwindowformat_qpa.cpp index e89b458..482ae68 100644 --- a/src/gui/kernel/qplatformwindowformat_qpa.cpp +++ b/src/gui/kernel/qplatformwindowformat_qpa.cpp @@ -122,8 +122,6 @@ public: \i \link setStencil() Stencil buffer.\endlink \i \link setStereo() Stereo buffers.\endlink \i \link setDirectRendering() Direct rendering.\endlink - \i \link setOverlay() Presence of an overlay.\endlink - \i \link setPlane() Plane of an overlay.\endlink \i \link setSampleBuffers() Multisample buffers.\endlink \endlist @@ -168,7 +166,7 @@ public: United States and other countries. \endlegalese - \sa QPlatformContext, QWidget + \sa QPlatformGLContext, QWidget */ /*! @@ -182,8 +180,6 @@ public: \i \link setStencil() Stencil buffer:\endlink Enabled. \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. - \i \link setOverlay() Overlay:\endlink Disabled. - \i \link setPlane() Plane:\endlink 0 (i.e., normal plane). \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. \endlist */ @@ -207,14 +203,10 @@ QPlatformWindowFormat::QPlatformWindowFormat() \snippet doc/src/snippets/code/src_opengl_qgl.cpp 3 Note that there are QGL::FormatOption values to turn format settings - both on and off, e.g. QGL::DepthBuffer and QGL::NoDepthBuffer, + both on and off; e.g., QGL::DepthBuffer and QGL::NoDepthBuffer, QGL::DirectRendering and QGL::IndirectRendering, etc. - The \a plane parameter defaults to 0 and is the plane which this - format should be associated with. Not all OpenGL implementations - supports overlay/underlay rendering planes. - - \sa defaultFormat(), setOption(), setPlane() + \sa defaultFormat(), setOption() */ QPlatformWindowFormat::QPlatformWindowFormat(QPlatformWindowFormat::FormatOptions options) @@ -619,8 +611,6 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const Otherwise returns false. WindowSurface is enabled by default. - - \sa setOverlay() */ /*! @@ -628,9 +618,7 @@ QPlatformGLContext *QPlatformWindowFormat::sharedGLContext() const otherwise the QWidget will only have a QPlatformWindow. - This is useful for ie. QGLWidget where the QPlatformGLContext controls the surface. - - \sa hasOverlay() + This is useful for QGLWidget where the QPlatformGLContext controls the surface. */ void QPlatformWindowFormat::setWindowSurface(bool enable) @@ -894,7 +882,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) } -/*! +/* Returns the default QPlatformWindowFormat for overlay contexts. The default overlay format is: @@ -907,9 +895,7 @@ void QPlatformWindowFormat::setDefaultFormat(const QPlatformWindowFormat &f) \i \link setStencil() Stencil buffer:\endlink Disabled. \i \link setStereo() Stereo:\endlink Disabled. \i \link setDirectRendering() Direct rendering:\endlink Enabled. - \i \link setOverlay() Overlay:\endlink Disabled. \i \link setSampleBuffers() Multisample buffers:\endlink Disabled. - \i \link setPlane() Plane:\endlink 1 (i.e., first overlay plane). \endlist \sa setDefaultFormat() diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 57893f9..a866da3 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -48,9 +48,6 @@ #ifdef Q_WS_S60 #include "private/qsoftkeymanager_s60_p.h" -#endif - -#if defined(Q_WS_S60) && !defined(SYMBIAN_VERSION_9_4) #include "private/qt_s60_p.h" #endif @@ -193,11 +190,14 @@ void QSoftKeyManager::sendKeyEvent() void QSoftKeyManager::updateSoftKeys() { - if (QApplication::activeWindow()) { - QSoftKeyManager::instance()->d_func()->pendingUpdate = true; - QEvent *event = new QEvent(QEvent::UpdateSoftKeys); - QApplication::postEvent(QSoftKeyManager::instance(), event); - } +#ifdef Q_WS_S60 + // Do not adjust softkeys if application is not the topmost one + if (S60->wsSession().GetFocusWindowGroup() != S60->windowGroup().WindowGroupId()) + return; +#endif + QSoftKeyManager::instance()->d_func()->pendingUpdate = true; + QEvent *event = new QEvent(QEvent::UpdateSoftKeys); + QApplication::postEvent(QSoftKeyManager::instance(), event); } bool QSoftKeyManager::appendSoftkeys(const QWidget &source, int level) diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index acdb0e5..b5d0101 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -53,6 +53,10 @@ #include <eiksoftkeyimage.h> #include <eikcmbut.h> +#ifndef QT_NO_STYLE_S60 +#include <qs60style.h> +#endif + #ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE @@ -220,26 +224,42 @@ bool QSoftKeyManagerPrivateS60::isOrientationLandscape() QSize QSoftKeyManagerPrivateS60::cbaIconSize(CEikButtonGroupContainer *cba, int position) { - int index = position; index += isOrientationLandscape() ? 0 : 1; if(cachedCbaIconSize[index].isNull()) { - // Only way I figured out to get CBA icon size without RnD SDK, was - // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() - // The returned value is cached to avoid unnecessary icon setting every time. - const bool left = (position == LSK_POSITION); - if(position == LSK_POSITION || position == RSK_POSITION) { - CEikImage* tmpImage = NULL; - QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); - EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes myimage ownership - int command = S60_COMMAND_START + position; - setNativeSoftkey(*cba, position, command, KNullDesC()); - cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); - EikSoftkeyImage::SetLabel(cba, left); - - if(cachedCbaIconSize[index] == QSize(138,72)) { - // Hack for S60 5.0 (5800) landscape orientation, which return wrong icon size - cachedCbaIconSize[index] = QSize(60,60); + if (QSysInfo::s60Version() >= QSysInfo::SV_S60_5_3) { + // S60 5.3 and later have fixed icon size on softkeys, while the button + // itself is bigger, so the automatic check doesn't work. + // Use custom pixel metrics to deduce the CBA icon size + int iconHeight = 30; + int iconWidth = 30; +#ifndef QT_NO_STYLE_S60 + QS60Style *s60Style = 0; + s60Style = qobject_cast<QS60Style *>(QApplication::style()); + if (s60Style) { + iconWidth = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconWidth); + iconHeight = s60Style->pixelMetric((QStyle::PixelMetric)PM_CbaIconHeight); + } +#endif + cachedCbaIconSize[index] = QSize(iconWidth, iconHeight); + } else { + // Only way I figured out to get CBA icon size without RnD SDK, was + // to set some dummy icon to CBA first and then ask CBA button CCoeControl::Size() + // The returned value is cached to avoid unnecessary icon setting every time. + const bool left = (position == LSK_POSITION); + if (position == LSK_POSITION || position == RSK_POSITION) { + CEikImage* tmpImage = NULL; + QT_TRAP_THROWING(tmpImage = new (ELeave) CEikImage); + EikSoftkeyImage::SetImage(cba, *tmpImage, left); // Takes tmpImage ownership + int command = S60_COMMAND_START + position; + setNativeSoftkey(*cba, position, command, KNullDesC()); + cachedCbaIconSize[index] = qt_TSize2QSize(cba->ControlOrNull(command)->Size()); + EikSoftkeyImage::SetLabel(cba, left); + + if (cachedCbaIconSize[index] == QSize(138,72)) { + // Hack for S60 5.0 landscape orientation, which return wrong icon size + cachedCbaIconSize[index] = QSize(60,60); + } } } } diff --git a/src/gui/kernel/qt_mac.cpp b/src/gui/kernel/qt_mac.cpp index 339bc82..69f0034 100644 --- a/src/gui/kernel/qt_mac.cpp +++ b/src/gui/kernel/qt_mac.cpp @@ -61,7 +61,6 @@ QFont qfontForThemeFont(ThemeFontID themeID) SInt16 f_size; Style f_style; GetThemeFont(themeID, Script, f_name, &f_size, &f_style); - extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp return QFont(qt_mac_from_pascal_string(f_name), f_size, (f_style & ::bold) ? QFont::Bold : QFont::Normal, (bool)(f_style & ::italic)); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 67eb07b..c429b04 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -161,6 +161,7 @@ public: int partial_keyboard : 1; int partial_keyboardAutoTranslation : 1; int partialKeyboardOpen : 1; + int handleStatusPaneResizeNotifications : 1; QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type QPointer<QWidget> splitViewLastWidget; @@ -198,6 +199,7 @@ public: static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState); #endif static void controlVisibilityChanged(CCoeControl *control, bool visible); + static TRect clientRect(); #ifdef Q_OS_SYMBIAN TTrapHandler *s60InstalledTrapHandler; @@ -353,6 +355,7 @@ inline QS60Data::QS60Data() partial_keyboard(0), partial_keyboardAutoTranslation(1), partialKeyboardOpen(0), + handleStatusPaneResizeNotifications(1), s60ApplicationFactory(0) #ifdef Q_OS_SYMBIAN ,s60InstalledTrapHandler(0) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 225a296..a51e295 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4554,6 +4554,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM QPoint oldp = q->pos(); QSize olds = q->size(); + // Apply size restrictions, applicable for Windows & Widgets. + if (QWExtra *extra = extraData()) { + w = qBound(extra->minw, w, extra->maxw); + h = qBound(extra->minh, h, extra->maxh); + } const bool isResize = (olds != QSize(w, h)); if (!realWindow && !isResize && QPoint(x, y) == oldp) @@ -4563,13 +4568,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.window_state = data.window_state & ~Qt::WindowMaximized; const bool visible = q->isVisible(); - // Apply size restrictions, applicable for Windows & Widgets. - if (QWExtra *extra = extraData()) { - w = qMin(w, extra->maxw); - h = qMin(h, extra->maxh); - w = qMax(w, extra->minw); - h = qMax(h, extra->minh); - } data.crect = QRect(x, y, w, h); if (realWindow) { diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index c7ce99a..56c3010 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -129,6 +129,11 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) { Q_D(QWidget); + d->aboutToDestroy(); + if (!isWindow() && parentWidget()) + parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); + d->deactivateWidgetCleanup(); + if ((windowType() == Qt::Popup)) qApp->d_func()->closePopup(this); @@ -136,6 +141,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (this == QApplicationPrivate::active_window) QApplication::setActiveWindow(0); + setAttribute(Qt::WA_WState_Created, false); + if (windowType() != Qt::Desktop) { if (destroySubWindows) { QObjectList childList(children()); @@ -155,6 +162,8 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) d->hide_sys(); } } + + d->setWinId(0); } } @@ -412,6 +421,7 @@ void QWidgetPrivate::hide_sys() { Q_Q(QWidget); q->setAttribute(Qt::WA_Mapped, false); + deactivateWidgetCleanup(); if (!q->isWindow()) { QWidget *p = q->parentWidget(); if (p &&p->isVisible()) { @@ -681,8 +691,10 @@ int QWidget::metric(PaintDeviceMetric m) const /*! \preliminary - Sets the window to be the \a window specified. - The QWidget takes ownership of the \a surface. + Sets the window to be the platform \a window specified. + + The widget takes ownership of the \a window. Any platform window + previously set on the widget will be destroyed. */ void QWidget::setPlatformWindow(QPlatformWindow *window) { @@ -711,6 +723,9 @@ QPlatformWindow *QWidget::platformWindow() const return 0; } +/*! + Sets the platform window format for the widget to the \a format specified. +*/ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) { if (isWindow() || testAttribute(Qt::WA_NativeWindow)) { @@ -727,6 +742,9 @@ void QWidget::setPlatformWindowFormat(const QPlatformWindowFormat &format) } } +/*! + Returns the platform window format for the widget. +*/ QPlatformWindowFormat QWidget::platformWindowFormat() const { Q_D(const QWidget); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 5672686..d6aaa3f 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -359,7 +359,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de if (popup) flags |= Qt::WindowStaysOnTopHint; // a popup stays on top - TRect clientRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect clientRect = S60->clientRect(); int sw = clientRect.Width(); int sh = clientRect.Height(); @@ -538,8 +538,6 @@ void QWidgetPrivate::show_sys() QT_TRAP_THROWING( factory->CreateResourceIndependentFurnitureL(ui); - TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); - CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS); if (isFullscreen && !cbaRequested) @@ -592,11 +590,13 @@ void QWidgetPrivate::show_sys() // Fill client area if maximized OR // Put window below status pane unless the window has an explicit position. if (!isFullscreen) { + // Use QS60Data::clientRect to take into account that native keyboard + // might affect ClientRect() return value. if (q->windowState() & Qt::WindowMaximized) { - TRect r = static_cast<CEikAppUi*>(S60->appUi())->ClientRect(); + TRect r = S60->clientRect(); id->SetExtent(r.iTl, r.Size()); } else if (!q->testAttribute(Qt::WA_Moved) && q->windowType() != Qt::Dialog) { - id->SetPosition(static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl); + id->SetPosition(S60->clientRect().iTl); } } @@ -1267,7 +1267,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate) // normal mode after showing the status pane, the geometry would overlap so we should // move it if it never had an explicit position. if (!wasMoved && S60->statusPane() && decorationsVisible) { - TPoint tl = static_cast<CEikAppUi*>(S60->appUi())->ClientRect().iTl; + TPoint tl = S60->clientRect().iTl; normalGeometry.setTopLeft(QPoint(tl.iX, tl.iY)); } #endif |