diff options
author | axis <qt-info@nokia.com> | 2011-04-07 09:08:53 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2011-04-07 09:08:53 (GMT) |
commit | d54b3f04fa629fe031f1083073eef0145f0d6b1e (patch) | |
tree | 2a06736f812c478bdb21aa3781078fe88b5532fa /src/gui | |
parent | 258c1a8537816f7b4c79e7cf4090a333768a10fa (diff) | |
parent | 8031eada2f81963865390b4d899631b09d4ca6f3 (diff) | |
download | Qt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.zip Qt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.tar.gz Qt-d54b3f04fa629fe031f1083073eef0145f0d6b1e.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt into earth-master
Conflicts:
src/corelib/thread/qthread_unix.cpp
Diffstat (limited to 'src/gui')
77 files changed, 467 insertions, 406 deletions
diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp index 3317018..ef46697 100644 --- a/src/gui/dialogs/qabstractprintdialog.cpp +++ b/src/gui/dialogs/qabstractprintdialog.cpp @@ -381,19 +381,11 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) If the dialog is accepted by the user, the QPrinter object is correctly configured for printing. - \raw HTML - <table align="center"> - <tr><td> - \endraw - \inlineimage plastique-printdialog.png - \raw HTML - </td><td> - \endraw - \inlineimage plastique-printdialog-properties.png - \raw HTML - </td></tr> - </table> - \endraw + \table + \row + \o \inlineimage plastique-printdialog.png + \o \inlineimage plastique-printdialog-properties.png + \endtable The printer dialog (shown above in Plastique style) enables access to common printing properties. On X11 platforms that use the CUPS printing system, the diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 09bb56c..d6dbcf6 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -1536,10 +1536,12 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, /*! \since 4.2 - Opens an information message box with the specified \a title and - \a text. The standard \a buttons are added to the message box. \a - defaultButton specifies the button used when \key Enter is - pressed. \a defaultButton must refer to a button that was given in \a buttons. + Opens an information message box with the given \a title and + \a text in front of the specified \a parent widget. + + The standard \a buttons are added to the message box. + \a defaultButton specifies the button used when \key Enter is pressed. + \a defaultButton must refer to a button that was given in \a buttons. If \a defaultButton is QMessageBox::NoButton, QMessageBox chooses a suitable default automatically. @@ -1547,9 +1549,13 @@ static QMessageBox::StandardButton showNewMessageBox(QWidget *parent, \key Esc was pressed instead, the \l{Default and Escape Keys} {escape button} is returned. - The message box is an \l{Qt::ApplicationModal} {application modal} + The message box is an \l{Qt::ApplicationModal}{application modal} dialog box. + \warning Do not delete \a parent during the execution of the dialog. + If you want to do this, you should create the dialog + yourself using one of the QMessageBox constructors. + \sa question(), warning(), critical() */ QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QString &title, @@ -1564,8 +1570,10 @@ QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QStr /*! \since 4.2 - Opens a question message box with the specified \a title and \a - text. The standard \a buttons are added to the message box. \a + Opens a question message box with the given \a title and \a + text in front of the specified \a parent widget. + + The standard \a buttons are added to the message box. \a defaultButton specifies the button used when \key Enter is pressed. \a defaultButton must refer to a button that was given in \a buttons. If \a defaultButton is QMessageBox::NoButton, QMessageBox @@ -1578,6 +1586,10 @@ QMessageBox::StandardButton QMessageBox::information(QWidget *parent, const QStr The message box is an \l{Qt::ApplicationModal} {application modal} dialog box. + \warning Do not delete \a parent during the execution of the dialog. + If you want to do this, you should create the dialog + yourself using one of the QMessageBox constructors. + \sa information(), warning(), critical() */ QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString &title, @@ -1590,8 +1602,10 @@ QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString /*! \since 4.2 - Opens a warning message box with the specified \a title and \a - text. The standard \a buttons are added to the message box. \a + Opens a warning message box with the given \a title and \a + text in front of the specified \a parent widget. + + The standard \a buttons are added to the message box. \a defaultButton specifies the button used when \key Enter is pressed. \a defaultButton must refer to a button that was given in \a buttons. If \a defaultButton is QMessageBox::NoButton, QMessageBox @@ -1604,6 +1618,10 @@ QMessageBox::StandardButton QMessageBox::question(QWidget *parent, const QString The message box is an \l{Qt::ApplicationModal} {application modal} dialog box. + \warning Do not delete \a parent during the execution of the dialog. + If you want to do this, you should create the dialog + yourself using one of the QMessageBox constructors. + \sa question(), information(), critical() */ QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString &title, @@ -1616,8 +1634,10 @@ QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString /*! \since 4.2 - Opens a critical message box with the specified \a title and \a - text. The standard \a buttons are added to the message box. \a + Opens a critical message box with the given \a title and \a + text in front of the specified \a parent widget. + + The standard \a buttons are added to the message box. \a defaultButton specifies the button used when \key Enter is pressed. \a defaultButton must refer to a button that was given in \a buttons. If \a defaultButton is QMessageBox::NoButton, QMessageBox @@ -1630,9 +1650,9 @@ QMessageBox::StandardButton QMessageBox::warning(QWidget *parent, const QString The message box is an \l{Qt::ApplicationModal} {application modal} dialog box. - \warning Do not delete \a parent during the execution of the dialog. - If you want to do this, you should create the dialog - yourself using one of the QMessageBox constructors. + \warning Do not delete \a parent during the execution of the dialog. + If you want to do this, you should create the dialog + yourself using one of the QMessageBox constructors. \sa question(), warning(), information() */ diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index fb9ee9d..bf79ec7 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -330,10 +330,8 @@ void qt_set_winid_on_widget(QWidget* w, Qt::HANDLE id) // NOTE: The X11 version of createSurface will re-create the native drawable if it's visual doesn't // match the one for the passed in EGLConfig -EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *unusedProperties) +EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEglProperties *properties) { - Q_UNUSED(unusedProperties); - int devType = device->devType(); if (devType == QInternal::Pbuffer) { @@ -417,7 +415,12 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg // At this point, the widget's window should be created and have the correct visual. Now we // just need to create the EGL surface for it: - EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0); + const int *props; + if (properties) + props = properties->properties(); + else + props = 0; + EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), props); if (surf == EGL_NO_SURFACE) qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); return surf; diff --git a/src/gui/embedded/qscreen_qws.cpp b/src/gui/embedded/qscreen_qws.cpp index e207ed1..90561fd 100644 --- a/src/gui/embedded/qscreen_qws.cpp +++ b/src/gui/embedded/qscreen_qws.cpp @@ -64,7 +64,6 @@ QT_BEGIN_NAMESPACE // #define QT_USE_MEMCPY_DUFF #ifndef QT_NO_QWS_CURSOR -bool qt_sw_cursor=false; Q_GUI_EXPORT QScreenCursor * qt_screencursor = 0; #endif Q_GUI_EXPORT QScreen * qt_screen = 0; @@ -119,8 +118,6 @@ ClearCacheFunc QScreen::clearCacheFunc = 0; Returns a pointer to the application's unique screen cursor. */ -extern bool qws_sw_cursor; - /*! Constructs a screen cursor */ diff --git a/src/gui/embedded/qscreen_qws.h b/src/gui/embedded/qscreen_qws.h index 17ffbbb..85c775e 100644 --- a/src/gui/embedded/qscreen_qws.h +++ b/src/gui/embedded/qscreen_qws.h @@ -130,7 +130,7 @@ const int SourcePixmap=1; class QScreenCursor; extern QScreenCursor *qt_screencursor; -extern bool qt_sw_cursor; +extern bool qws_sw_cursor; class Q_GUI_EXPORT QScreenCursor { @@ -145,7 +145,7 @@ public: bool supportsAlphaCursor() const { return supportsAlpha; } - static bool enabled() { return qt_sw_cursor; } + static bool enabled() { return qws_sw_cursor; } QRect boundingRect() const { return QRect(pos - hotspot, size); } QImage image() const { return cursor; } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 014b61b..9bb5424 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -56,7 +56,7 @@ Items that are anchored are automatically added to the layout, and if items are removed, all their anchors will be automatically removed. - \div {float-left} + \div {class="float-left"} \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets. \enddiv diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 0af36ac..e342783 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -579,19 +579,21 @@ QGraphicsItem pointer). The return value is unused; you cannot adjust anything in this notification. - \value ItemSceneChange The item is moved to a new scene. This notification - is also sent when the item is added to its initial scene, and when it is - removed. The value argument is the new scene (i.e., a QGraphicsScene + \value ItemSceneChange The item is moved to a new scene. This notification is + also sent when the item is added to its initial scene, and when it is removed. + The item's scene() is the old scene (or 0 if the item has not been added to a + scene yet). The value argument is the new scene (i.e., a QGraphicsScene pointer), or a null pointer if the item is removed from a scene. Do not - override this change by passing this item to QGraphicsScene::addItem() as - this notification is delivered; instead, you can return the new scene from + override this change by passing this item to QGraphicsScene::addItem() as this + notification is delivered; instead, you can return the new scene from itemChange(). Use this feature with caution; objecting to a scene change can quickly lead to unwanted recursion. - \value ItemSceneHasChanged The item's scene has changed. The value - argument is the new scene (i.e., a pointer to a QGraphicsScene). Do not - call setScene() in itemChange() as this notification is delivered. The - return value is ignored. + \value ItemSceneHasChanged The item's scene has changed. The item's scene() is + the new scene. This notification is also sent when the item is added to its + initial scene, and when it is removed.The value argument is the new scene + (i.e., a pointer to a QGraphicsScene). Do not call setScene() in itemChange() + as this notification is delivered. The return value is ignored. \value ItemCursorChange The item's cursor changes. The value argument is the new cursor (i.e., a QCursor). Do not call setCursor() in itemChange() diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 7932a73..faa29e5 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4948,6 +4948,19 @@ void QGraphicsScenePrivate::draw(QGraphicsItem *item, QPainter *painter, const Q if (painterStateProtection || restorePainterClip) painter->restore(); + + static int drawRect = qgetenv("QT_DRAW_SCENE_ITEM_RECTS").toInt(); + if (drawRect) { + QPen oldPen = painter->pen(); + QBrush oldBrush = painter->brush(); + quintptr ptr = reinterpret_cast<quintptr>(item); + const QColor color = QColor::fromHsv(ptr % 255, 255, 255); + painter->setPen(color); + painter->setBrush(Qt::NoBrush); + painter->drawRect(adjustedItemBoundingRect(item)); + painter->setPen(oldPen); + painter->setBrush(oldBrush); + } } // Draw children in front diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index 06df788..513c41f 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -92,6 +92,7 @@ #include "qgraphicstransform_p.h" #include <QDebug> #include <QtCore/qmath.h> +#include <QtCore/qnumeric.h> #ifndef QT_NO_GRAPHICSVIEW QT_BEGIN_NAMESPACE @@ -467,6 +468,7 @@ void QGraphicsRotation::setOrigin(const QVector3D &point) item will be rotated counter-clockwise. Normally the rotation angle will be in the range (-360, 360), but you can also provide numbers outside of this range (e.g., a angle of 370 degrees gives the same result as 10 degrees). + Setting the angle to NaN results in no rotation. \sa origin */ @@ -570,7 +572,7 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const { Q_D(const QGraphicsRotation); - if (d->angle == 0. || d->axis.isNull()) + if (d->angle == 0. || d->axis.isNull() || qIsNaN(d->angle)) return; matrix->translate(d->origin); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 0e2750d..488a36a 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -2497,7 +2497,7 @@ QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const else if (value.type() == QVariant::PointF) value = mapFromScene(value.toPointF()); else if (value.type() == QVariant::Rect) - value = mapFromScene(value.toRect()).boundingRect(); + value = d->mapRectFromScene(value.toRect()).toRect(); else if (value.type() == QVariant::Point) value = mapFromScene(value.toPoint()); return value; diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 158f9ab..7182062 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -972,12 +972,15 @@ QString QIcon::themeName() Returns the QIcon corresponding to \a name in the current icon theme. If no such icon is found in the current theme - \a fallback is return instead. + \a fallback is returned instead. - The lastest version of the freedesktop icon specification and naming - spesification can be obtained here: - http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html - http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html + The latest version of the freedesktop icon specification and naming + specification can be obtained here: + + \list + \o \l{http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html} + \o \l{http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html} + \endlist To fetch an icon from the current icon theme: diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d992dd5..50b372e 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -65,6 +65,7 @@ #include <private/qpaintengine_raster_p.h> #include <private/qimage_p.h> +#include <private/qfont_p.h> QT_BEGIN_NAMESPACE @@ -119,9 +120,6 @@ const QVector<QRgb> *qt_image_colortable(const QImage &image) return &image.d->colortable; } -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); - QBasicAtomicInt qimage_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); QImageData::QImageData() @@ -797,6 +795,8 @@ QImage::QImage() Constructs an image with the given \a width, \a height and \a format. + A \l{isNull()}{null} image will be returned if memory cannot be allocated. + \warning This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter. @@ -810,6 +810,8 @@ QImage::QImage(int width, int height, Format format) /*! Constructs an image with the given \a size and \a format. + A \l{isNull()}{null} image is returned if memory cannot be allocated. + \warning This will create a QImage with uninitialized data. Call fill() to fill the image with an appropriate pixel value before drawing onto it with QPainter. diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index a8683b5..6f0979a 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -477,8 +477,6 @@ void QPicturePaintEngine::drawImage(const QRectF &r, const QImage &image, const writeCmdLength(pos, r, false); } -Q_GUI_EXPORT extern int qt_defaultDpi(); - void QPicturePaintEngine::drawTextItem(const QPointF &p , const QTextItem &ti) { Q_D(QPicturePaintEngine); diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 053d1fc..3f38c0c 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -46,6 +46,7 @@ #include <private/qfactoryloader_p.h> #include <private/qpaintengine_pic_p.h> +#include <private/qfont_p.h> #include "qdatastream.h" #include "qfile.h" @@ -108,8 +109,6 @@ void qt_format_text(const QFont &fnt, const QRectF &_r, const char *qt_mfhdr_tag = "QPIC"; // header tag static const quint16 mfhdr_maj = 11; // major version # static const quint16 mfhdr_min = 0; // minor version # -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); /*! Constructs an empty picture. diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 26d3b87..e2cd745 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -49,6 +49,7 @@ #include <private/qblittable_p.h> #include <private/qdrawhelper_p.h> +#include <private/qfont_p.h> #ifndef QT_NO_BLITTABLE QT_BEGIN_NAMESPACE @@ -104,8 +105,6 @@ void QBlittablePixmapData::resize(int width, int height) h = height; is_null = (w <= 0 || h <= 0); } -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index a5f42c1..0a4d921 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -41,6 +41,8 @@ #include "qpixmap.h" +#include <private/qfont_p.h> + #include "qpixmap_raster_p.h" #include "qnativeimage_p.h" #include "qimage_p.h" @@ -346,9 +348,6 @@ QPaintEngine* QRasterPixmapData::paintEngine() const return image.paintEngine(); } -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); - int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { QImageData *d = image.d; diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 32d8dd7..c8aa003 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -46,6 +46,7 @@ #include <private/qgraphicssystem_p.h> #include <private/qt_s60_p.h> #include <private/qpaintengine_s60_p.h> +#include <private/qfont_p.h> #include "qpixmap.h" #include "qpixmap_raster_p.h" @@ -601,9 +602,6 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) return res; } -Q_GUI_EXPORT int qt_defaultDpiX(); -Q_GUI_EXPORT int qt_defaultDpiY(); - int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index d88c437..c2a8b00 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -219,6 +219,7 @@ void setup_qt(QImage& image, png_structp png_ptr, png_infop info_ptr, float scre png_colorp palette = 0; int num_palette; png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0); + png_set_interlace_handling(png_ptr); if (color_type == PNG_COLOR_TYPE_GRAY) { // Black & White or 8-bit grayscale diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index 41abe95..2c70ade 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -416,7 +416,8 @@ void QCoeFepInputContext::resetSplitViewWidget(bool keepInputWidget) int index = gv->scene()->focusItem()->toGraphicsObject()->metaObject()->indexOfSignal(signal.right(signal.length() - 1)); if (index != -1) disconnect(gv->scene()->focusItem()->toGraphicsObject(), SIGNAL(cursorPositionChanged()), this, SLOT(translateInputWidget())); - QGraphicsItem *rootItem; + + QGraphicsItem *rootItem = 0; foreach (QGraphicsItem *item, gv->scene()->items()) { if (!item->parentItem()) { rootItem = item; @@ -828,7 +829,7 @@ void QCoeFepInputContext::translateInputWidget() return; // Fetch root item (i.e. graphicsitem with no parent) - QGraphicsItem *rootItem; + QGraphicsItem *rootItem = 0; foreach (QGraphicsItem *item, gv->scene()->items()) { if (!item->parentItem()) { rootItem = item; diff --git a/src/gui/inputmethod/qinputcontext.cpp b/src/gui/inputmethod/qinputcontext.cpp index 063aefd..f083e51 100644 --- a/src/gui/inputmethod/qinputcontext.cpp +++ b/src/gui/inputmethod/qinputcontext.cpp @@ -355,9 +355,10 @@ void QInputContext::widgetDestroyed(QWidget *widget) in complex input method. In the case, call QInputContext::reset() to ensure proper termination of inputting. - You must not send any QInputMethodEvent except empty InputMethodEnd event using - QInputContext::reset() at reimplemented reset(). It will break - input state consistency. + In a reimplementation of reset(), you must not send any + QInputMethodEvent containing preedit text. You can only commit + string and attributes; otherwise, you risk breaking input state + consistency. */ diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index d6d9536..471c199 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -643,8 +643,12 @@ int QHeaderView::sectionSize(int logicalIndex) const } /*! - Returns the section position of the given \a logicalIndex, or -1 if the - section is hidden. + + Returns the section position of the given \a logicalIndex, or -1 + if the section is hidden. The position is measured in pixels from + the first visible item's top-left corner to the top-left corner of + the item with \a logicalIndex. The measurement is along the x-axis + for horizontal headers and along the y-axis for vertical headers. \sa sectionViewportPosition() */ diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp index 94e3b76..61a935f 100644 --- a/src/gui/itemviews/qlistwidget.cpp +++ b/src/gui/itemviews/qlistwidget.cpp @@ -1500,7 +1500,9 @@ void QListWidget::setCurrentRow(int row, QItemSelectionModel::SelectionFlags com } /*! - Returns a pointer to the item at the coordinates \a p. + Returns a pointer to the item at the coordinates \a p. The coordinates + are relative to the list widget's \l{QAbstractScrollArea::}{viewport()}. + */ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const { @@ -1514,6 +1516,9 @@ QListWidgetItem *QListWidget::itemAt(const QPoint &p) const \overload Returns a pointer to the item at the coordinates (\a x, \a y). + The coordinates are relative to the list widget's + \l{QAbstractScrollArea::}{viewport()}. + */ diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 4db29d6..2ea9a43 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -2830,7 +2830,8 @@ void QTreeWidget::setCurrentItem(QTreeWidgetItem *item, int column, /*! - Returns a pointer to the item at the coordinates \a p. + Returns a pointer to the item at the coordinates \a p. The coordinates + are relative to the tree widget's \l{QAbstractScrollArea::}{viewport()}. \sa visualItemRect() */ @@ -2844,7 +2845,8 @@ QTreeWidgetItem *QTreeWidget::itemAt(const QPoint &p) const \fn QTreeWidgetItem *QTreeWidget::itemAt(int x, int y) const \overload - Returns a pointer to the item at the coordinates (\a x, \a y). + Returns a pointer to the item at the coordinates (\a x, \a y). The coordinates + are relative to the tree widget's \l{QAbstractScrollArea::}{viewport()}. */ /*! diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 3d642d0..769b136 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1271,15 +1271,36 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowIcon_sys(true); qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 - // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. - QWidget *const window = qwidget->window(); - if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane - const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = decorationsVisible; - const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; - const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; - const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + if (qwidget->isWindow()) { + QWidget *const window = qwidget->window(); + QWidget *parentWindow = window->parentWidget(); + if (parentWindow) { + while (parentWindow->parentWidget()) + parentWindow = parentWindow->parentWidget(); + } else { + parentWindow = window; + } + + const bool parentDecorationsVisible = !(parentWindow->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool parentIsFullscreen = parentWindow->windowState() & Qt::WindowFullScreen; + const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint; + bool buttonGroupVisibility = (parentDecorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint)); + + // For non-toplevel normal and maximized windows, show cba if window has softkey + // actions even if topmost parent is not showing cba. Do the same for fullscreen + // windows that request it. + if (!buttonGroupVisibility + && window->parentWidget() + && !(window->windowState() & Qt::WindowMinimized) + && ((window->windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(window->windowState() & Qt::WindowFullScreen))) { + for (int i = 0; i < window->actions().size(); ++i) { + if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) { + buttonGroupVisibility = true; + break; + } + } + } + S60->setStatusPaneAndButtonGroupVisibility(parentDecorationsVisible, buttonGroupVisibility); } #endif } else if (QApplication::activeWindow() == qwidget->window()) { @@ -1455,6 +1476,35 @@ bool QSymbianControl::isControlActive() return IsActivated() ? true : false; } +void QSymbianControl::ensureFixNativeOrientation() +{ +#if defined(Q_SYMBIAN_SUPPORTS_FIXNATIVEORIENTATION) + // Call FixNativeOrientation() for fullscreen QDeclarativeViews that + // have a locked orientation matching the native orientation of the device. + // This avoids unnecessary window rotation on wserv level. + if (!qwidget->isWindow() || qwidget->windowType() == Qt::Desktop + || !qwidget->inherits("QDeclarativeView") + || S60->screenNumberForWidget(qwidget) > 0) + return; + const bool isFullScreen = qwidget->windowState().testFlag(Qt::WindowFullScreen); + const bool isFixed = qwidget->d_func()->fixNativeOrientationCalled; + const bool matchesNative = qwidget->testAttribute( + S60->nativeOrientationIsPortrait ? Qt::WA_LockPortraitOrientation + : Qt::WA_LockLandscapeOrientation); + if (isFullScreen && matchesNative) { + if (!isFixed) { + Window().FixNativeOrientation(); + qwidget->d_func()->fixNativeOrientationCalled = true; + } + } else if (isFixed) { + qwidget->d_func()->fixNativeOrientationCalled = false; + qwidget->hide(); + qwidget->d_func()->create_sys(0, false, true); + qwidget->show(); + } +#endif +} + /*! \typedef QApplication::QS60MainApplicationFactory \since 4.6 diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 54e7e3e..b5e5d18 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -254,7 +254,10 @@ static int qCocoaViewCount = 0; qt_mac_retain_graphics_context(context); // We use a different graphics system. - if (QApplicationPrivate::graphicsSystem() != 0) { + // + // Widgets that are set to paint on screen, specifically QGLWidget, + // requires the native engine to execute in order to be drawn. + if (QApplicationPrivate::graphicsSystem() != 0 && !qwidget->testAttribute(Qt::WA_PaintOnScreen)) { // Raster engine. if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) { @@ -334,12 +337,6 @@ static int qCocoaViewCount = 0; qwidget->update(qwidget->rect()); qwidgetprivate->syncBackingStore(qwidget->rect()); } - - // Since we don't want to use the native engine, we must exit, however - // widgets that are set to paint on screen, specifically QGLWidget, - // requires the following code to execute in order to be drawn. - if (!qwidget->testAttribute(Qt::WA_PaintOnScreen)) - return; } // Native engine. diff --git a/src/gui/kernel/qkeymapper_s60.cpp b/src/gui/kernel/qkeymapper_s60.cpp index bcf32a5..08cfae0 100644 --- a/src/gui/kernel/qkeymapper_s60.cpp +++ b/src/gui/kernel/qkeymapper_s60.cpp @@ -69,8 +69,17 @@ void QKeyMapperPrivate::clearMappings() QString QKeyMapperPrivate::translateKeyEvent(int keySym, Qt::KeyboardModifiers /* modifiers */) { - if (keySym >= Qt::Key_Escape) - return QString(); + if (keySym >= Qt::Key_Escape) { + switch (keySym) { + case Qt::Key_Tab: + return QString(QChar('\t')); + case Qt::Key_Return: // fall through + case Qt::Key_Enter: + return QString(QChar('\r')); + default: + return QString(); + } + } // Symbian doesn't actually use modifiers, but gives us the character code directly. diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 1b26933..204efe9 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -50,6 +50,10 @@ #include "private/qsoftkeymanager_s60_p.h" #endif +#ifdef SYMBIAN_VERSION_SYMBIAN3 +#include "private/qt_s60_p.h" +#endif + #ifndef QT_NO_SOFTKEYMANAGER QT_BEGIN_NAMESPACE @@ -101,6 +105,30 @@ QSoftKeyManager::QSoftKeyManager() : QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget) { QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget); +#ifdef SYMBIAN_VERSION_SYMBIAN3 + int key = 0; + switch (standardKey) { + case OkSoftKey: + key = EAknSoftkeyOk; + break; + case SelectSoftKey: + key = EAknSoftkeySelect; + break; + case DoneSoftKey: + key = EAknSoftkeyDone; + break; + case MenuSoftKey: + key = EAknSoftkeyOptions; + break; + case CancelSoftKey: + key = EAknSoftkeyCancel; + break; + default: + break; + }; + if (key != 0) + QSoftKeyManager::instance()->d_func()->softKeyCommandActions.insert(action, key); +#endif QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case MenuSoftKey: // FALL-THROUGH @@ -143,6 +171,9 @@ void QSoftKeyManager::cleanupHash(QObject *obj) Q_D(QSoftKeyManager); QAction *action = qobject_cast<QAction*>(obj); d->keyedActions.remove(action); +#ifdef SYMBIAN_VERSION_SYMBIAN3 + d->softKeyCommandActions.remove(action); +#endif } void QSoftKeyManager::sendKeyEvent() diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h index 27d8ee9..02ae697 100644 --- a/src/gui/kernel/qsoftkeymanager_common_p.h +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -72,6 +72,9 @@ protected: QMultiHash<int, QAction*> requestedSoftKeyActions; QWidget *initialSoftKeySource; bool pendingUpdate; +#ifdef SYMBIAN_VERSION_SYMBIAN3 + QHash<QAction*, int> softKeyCommandActions; +#endif }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 3496297..79ed91a 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -113,12 +113,20 @@ void QSoftKeyManagerPrivateS60::ensureCbaVisibilityAndResponsiviness(CEikButtonG void QSoftKeyManagerPrivateS60::clearSoftkeys(CEikButtonGroupContainer &cba) { +#ifdef SYMBIAN_VERSION_SYMBIAN3 + QT_TRAP_THROWING( + //EAknSoftkeyEmpty is used, because using -1 adds softkeys without actions on Symbian3 + cba.SetCommandL(0, EAknSoftkeyEmpty, KNullDesC); + cba.SetCommandL(2, EAknSoftkeyEmpty, KNullDesC); + ); +#else QT_TRAP_THROWING( //Using -1 instead of EAknSoftkeyEmpty to avoid flickering. cba.SetCommandL(0, -1, KNullDesC); // TODO: Should we clear also middle SK? cba.SetCommandL(2, -1, KNullDesC); ); +#endif realSoftKeyActions.clear(); } @@ -290,6 +298,10 @@ bool QSoftKeyManagerPrivateS60::setSoftkey(CEikButtonGroupContainer &cba, QString text = softkeyText(*action); TPtrC nativeText = qt_QString2TPtrC(text); int command = S60_COMMAND_START + position; +#ifdef SYMBIAN_VERSION_SYMBIAN3 + if (softKeyCommandActions.contains(action)) + command = softKeyCommandActions.value(action); +#endif setNativeSoftkey(cba, position, command, nativeText); const bool dimmed = !action->isEnabled() && !QSoftKeyManager::isForceEnabledInSofkeys(action); cba.DimCommand(command, dimmed); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index 3bb27c3..102c0ca 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -189,6 +189,8 @@ public: int screenHeightInPixelsForScreen[qt_symbian_max_screens]; int screenWidthInTwipsForScreen[qt_symbian_max_screens]; int screenHeightInTwipsForScreen[qt_symbian_max_screens]; + + bool nativeOrientationIsPortrait; }; Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data(); @@ -233,6 +235,8 @@ public: bool isControlActive(); + void ensureFixNativeOrientation(); + #ifdef Q_WS_S60 void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); } void HandleStatusPaneSizeChange(); @@ -327,9 +331,11 @@ inline QS60Data::QS60Data() inline void QS60Data::updateScreenSize() { + CWsScreenDevice *dev = S60->screenDevice(); + int screenModeCount = dev->NumScreenModes(); + int mode = dev->CurrentScreenMode(); TPixelsTwipsAndRotation params; - int mode = S60->screenDevice()->CurrentScreenMode(); - S60->screenDevice()->GetScreenModeSizeAndRotation(mode, params); + dev->GetScreenModeSizeAndRotation(mode, params); S60->screenWidthInPixels = params.iPixelSize.iWidth; S60->screenHeightInPixels = params.iPixelSize.iHeight; S60->screenWidthInTwips = params.iTwipsSize.iWidth; @@ -352,6 +358,21 @@ inline void QS60Data::updateScreenSize() S60->screenWidthInTwipsForScreen[i] = params.iTwipsSize.iWidth; S60->screenHeightInTwipsForScreen[i] = params.iTwipsSize.iHeight; } + + // Look for a screen mode with rotation 0 + // in order to decide what the native orientation is. + int nativeScreenWidthInPixels = 0; + int nativeScreenHeightInPixels = 0; + for (mode = 0; mode < screenModeCount; ++mode) { + TPixelsAndRotation sizeAndRotation; + dev->GetScreenModeSizeAndRotation(mode, sizeAndRotation); + if (sizeAndRotation.iRotation == CFbsBitGc::EGraphicsOrientationNormal) { + nativeScreenWidthInPixels = sizeAndRotation.iPixelSize.iWidth; + nativeScreenHeightInPixels = sizeAndRotation.iPixelSize.iHeight; + break; + } + } + S60->nativeOrientationIsPortrait = nativeScreenWidthInPixels <= nativeScreenHeightInPixels; } inline RWsSession& QS60Data::wsSession() diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 4b7349b..3cc3e65 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -312,6 +312,7 @@ QWidgetPrivate::QWidgetPrivate(int version) , qd_hd(0) #elif defined(Q_OS_SYMBIAN) , symbianScreenNumber(0) + , fixNativeOrientationCalled(false) #endif { if (!qApp) { @@ -10970,6 +10971,9 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) } QT_TRAP_THROWING(appUi->SetOrientationL(s60orientation)); S60->orientationSet = true; + QSymbianControl *window = static_cast<QSymbianControl *>(internalWinId()); + if (window) + window->ensureFixNativeOrientation(); #endif break; } diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index e5a2c35..919f8bc 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -908,6 +908,7 @@ public: static QWidget *mouseGrabber; static QWidget *keyboardGrabber; int symbianScreenNumber; // only valid for desktop widget and top-levels + bool fixNativeOrientationCalled; void s60UpdateIsOpaque(); void reparentChildren(); void registerTouchWindow(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index b031936..c74c7eb 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -278,6 +278,8 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) q->internalWinId()->SetRect(TRect(TPoint(x, y), TSize(w, h))); topData()->normalGeometry = data.crect; } + QSymbianControl *window = static_cast<QSymbianControl *>(q->internalWinId()); + window->ensureFixNativeOrientation(); } else { data.crect.setRect(x, y, w, h); @@ -1208,17 +1210,41 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } #ifdef Q_WS_S60 - bool decorationsVisible(false); - if (!parentWidget()) { // Only top level native windows have control over cba/status pane - // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. - // The window decoration visibility has to be changed before doing actual window state - // change since in that order the availableGeometry will return directly the right size and - // we will avoid unnecessary redraws - decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = decorationsVisible; - const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessary redraws + Qt::WindowStates comparisonState = newstate; + QWidget *parentWindow = parentWidget(); + if (parentWindow) { + while (parentWindow->parentWidget()) + parentWindow = parentWindow->parentWidget(); + comparisonState = parentWindow->windowState(); + } else { + parentWindow = this; + } + + const bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen; + const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint; + bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint)); + + // For non-toplevel normal and maximized windows, show cba if window has softkey + // actions even if topmost parent is not showing cba. Do the same for fullscreen + // windows that request it. + if (!buttonGroupVisibility + && parentWidget() + && !(newstate & Qt::WindowMinimized) + && ((windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(newstate & Qt::WindowFullScreen))) { + for (int i = 0; i < actions().size(); ++i) { + if (actions().at(i)->softKeyRole() != QAction::NoSoftKey) { + buttonGroupVisibility = true; + break; + } + } } + S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility); + #endif // Q_WS_S60 // Ensure the initial size is valid, since we store it as normalGeometry below. @@ -1277,6 +1303,12 @@ void QWidget::setWindowState(Qt::WindowStates newstate) if (newstate & Qt::WindowActive) activateWindow(); + if (isWindow()) { + // Now that the new state is set, fix the display memory layout, if needed. + QSymbianControl *window = static_cast<QSymbianControl *>(effectiveWinId()); + window->ensureFixNativeOrientation(); + } + QWindowStateChangeEvent e(oldstate); QApplication::sendEvent(this, &e); } @@ -1423,7 +1455,8 @@ void QWidget::activateWindow() if (tlw->isVisible()) { window()->createWinId(); QSymbianControl *id = static_cast<QSymbianControl *>(tlw->internalWinId()); - id->setFocusSafely(true); + if (!id->IsFocused()) + id->setFocusSafely(true); } } diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index e5d8abc..42c1c35 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -588,7 +588,7 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up return; } - if (!windowSurface->hasPartialUpdateSupport()) { + if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { fullUpdatePending = true; sendUpdateRequest(tlw, updateImmediately); return; @@ -683,7 +683,7 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd return; } - if (!windowSurface->hasPartialUpdateSupport()) { + if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { fullUpdatePending = true; sendUpdateRequest(tlw, updateImmediately); return; @@ -1143,9 +1143,9 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg return; } - // If there's no partial update support we always need + // If there's no preserved contents support we always need // to do a full repaint before flushing - if (!windowSurface->hasPartialUpdateSupport()) + if (!windowSurface->hasFeature(QWindowSurface::PreservedContents)) fullUpdatePending = true; // Nothing to repaint. diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 39bf66c..05f4bfc 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -262,8 +262,7 @@ private: } inline bool hasStaticContents() const - { return !staticWidgets.isEmpty() && windowSurface->hasStaticContentsSupport() - && windowSurface->hasPartialUpdateSupport(); } + { return !staticWidgets.isEmpty() && windowSurface->hasFeature(QWindowSurface::StaticContents); } friend QRegion qt_dirtyRegion(QWidget *); friend class QWidgetPrivate; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 46a6f81..d1dd7ef 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -319,14 +319,9 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const return m_windowSurface->offset(widget); } -bool QRuntimeWindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const { - return m_windowSurface->hasStaticContentsSupport(); -} - -bool QRuntimeWindowSurface::hasPartialUpdateSupport() const -{ - return m_windowSurface->hasPartialUpdateSupport(); + return m_windowSurface->features(); } QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 998fa98..26d3777 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -129,8 +129,7 @@ public: virtual QPoint offset(const QWidget *widget) const; - virtual bool hasStaticContentsSupport() const; - virtual bool hasPartialUpdateSupport() const; + virtual WindowSurfaceFeatures features() const; QScopedPointer<QWindowSurface> m_windowSurface; QScopedPointer<QWindowSurface> m_pendingWindowSurface; diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index fac356c..dd4b3db 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -54,8 +54,6 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); extern void qt_format_text(const QFont &font, const QRectF &_r, int tf, const QTextOption *option, const QString& str, QRectF *brect, int tabstops, int* tabarray, int tabarraylen, diff --git a/src/gui/painting/qpaintengine_alpha.cpp b/src/gui/painting/qpaintengine_alpha.cpp index 339a002..171850d 100644 --- a/src/gui/painting/qpaintengine_alpha.cpp +++ b/src/gui/painting/qpaintengine_alpha.cpp @@ -46,6 +46,7 @@ #include "private/qpaintengine_alpha_p.h" #include "private/qpicture_p.h" +#include "private/qfont_p.h" #include "QtGui/qpicture.h" QT_BEGIN_NAMESPACE @@ -93,9 +94,6 @@ bool QAlphaPaintEngine::begin(QPaintDevice *pdev) return true; } -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); - bool QAlphaPaintEngine::end() { Q_D(QAlphaPaintEngine); diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index 2f35dcd..8aab7c7 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -972,7 +972,7 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co return; bool differentSize = (QRectF(0, 0, pm.width(), pm.height()) != sr), doRestore = false; - CGRect rect = CGRectMake(qRound(r.x()), qRound(r.y()), qRound(r.width()), qRound(r.height())); + CGRect rect = CGRectMake(r.x(), r.y(), r.width(), r.height()); QCFType<CGImageRef> image; bool isBitmap = (pm.depth() == 1); if (isBitmap) { diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h index 5c459ee..3e71d6c 100644 --- a/src/gui/painting/qpaintengine_mac_p.h +++ b/src/gui/painting/qpaintengine_mac_p.h @@ -57,15 +57,12 @@ #include "private/qt_mac_p.h" #include "private/qpaintengine_p.h" #include "private/qpolygonclipper_p.h" +#include "private/qfont_p.h" #include "QtCore/qhash.h" typedef struct CGColorSpace *CGColorSpaceRef; QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); -extern int qt_defaultDpiX(); -extern int qt_defaultDpiY(); - class QCoreGraphicsPaintEnginePrivate; class QCoreGraphicsPaintEngine : public QPaintEngine { diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 64ef549..50d65e6 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -6468,7 +6468,8 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const const qreal underlineOffset = fe->underlinePosition().toReal(); // deliberately ceil the offset to avoid the underline coming too close to // the text above it. - const qreal underlinePos = pos.y() + qCeil(underlineOffset); + const qreal aliasedCoordinateDelta = 0.5 - 0.015625; + const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta; if (underlineStyle == QTextCharFormat::SpellCheckUnderline) { underlineStyle = QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle)); diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 49f1a5f..2058040 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1897,39 +1897,39 @@ static bool qt_painterpath_isect_line_rect(qreal x1, qreal y1, qreal x2, qreal y return false; } -static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2) +static bool qt_isect_curve_horizontal(const QBezier &bezier, qreal y, qreal x1, qreal x2, int depth = 0) { QRectF bounds = bezier.bounds(); if (y >= bounds.top() && y < bounds.bottom() && bounds.right() >= x1 && bounds.left() < x2) { const qreal lower_bound = qreal(.01); - if (bounds.width() < lower_bound && bounds.height() < lower_bound) + if (depth == 32 || bounds.width() < lower_bound && bounds.height() < lower_bound) return true; QBezier first_half, second_half; bezier.split(&first_half, &second_half); - if (qt_isect_curve_horizontal(first_half, y, x1, x2) - || qt_isect_curve_horizontal(second_half, y, x1, x2)) + if (qt_isect_curve_horizontal(first_half, y, x1, x2, depth + 1) + || qt_isect_curve_horizontal(second_half, y, x1, x2, depth + 1)) return true; } return false; } -static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2) +static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qreal y2, int depth = 0) { QRectF bounds = bezier.bounds(); if (x >= bounds.left() && x < bounds.right() && bounds.bottom() >= y1 && bounds.top() < y2) { const qreal lower_bound = qreal(.01); - if (bounds.width() < lower_bound && bounds.height() < lower_bound) + if (depth == 32 || bounds.width() < lower_bound && bounds.height() < lower_bound) return true; QBezier first_half, second_half; bezier.split(&first_half, &second_half); - if (qt_isect_curve_vertical(first_half, x, y1, y2) - || qt_isect_curve_vertical(second_half, x, y1, y2)) + if (qt_isect_curve_vertical(first_half, x, y1, y2, depth + 1) + || qt_isect_curve_vertical(second_half, x, y1, y2, depth + 1)) return true; } return false; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index bc30038..0271a39 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -47,6 +47,7 @@ #include "private/qcups_p.h" #include "qprinterinfo.h" #include <qnumeric.h> +#include "private/qfont_p.h" #ifdef Q_OS_UNIX #include "private/qcore_unix_p.h" // overrides QT_OPEN @@ -54,8 +55,6 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT extern int qt_defaultDpi(); - #ifndef QT_NO_PRINTER extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); diff --git a/src/gui/painting/qprintengine_mac.mm b/src/gui/painting/qprintengine_mac.mm index ec842a9..1dce303 100644 --- a/src/gui/painting/qprintengine_mac.mm +++ b/src/gui/painting/qprintengine_mac.mm @@ -49,7 +49,6 @@ QT_BEGIN_NAMESPACE extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size); -extern int qt_defaultDpi(); QMacPrintEngine::QMacPrintEngine(QPrinter::PrinterMode mode) : QPaintEngine(*(new QMacPrintEnginePrivate)) { diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 727852d..53f025f 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -168,7 +168,7 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const continue; if (listItemCoordinates.contains(GlyphAndSubPixelPosition(glyph, subPixelPosition))) continue; - glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, m_transform, format); + glyph_metrics_t metrics = fontEngine->alphaMapBoundingBox(glyph, subPixelPosition, m_transform, format); #ifdef CACHE_DEBUG printf("(%4x): w=%.2f, h=%.2f, xoff=%.2f, yoff=%.2f, x=%.2f, y=%.2f\n", diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 9b71818..0fb9bf7 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -307,11 +307,6 @@ QPoint QWindowSurface::offset(const QWidget *widget) const window surface. */ -bool QWindowSurface::hasStaticContentsSupport() const -{ - return false; -} - void QWindowSurface::setStaticContents(const QRegion ®ion) { d_ptr->staticContents = region; @@ -324,12 +319,12 @@ QRegion QWindowSurface::staticContents() const bool QWindowSurface::hasStaticContents() const { - return hasStaticContentsSupport() && !d_ptr->staticContents.isEmpty(); + return hasFeature(QWindowSurface::StaticContents) && !d_ptr->staticContents.isEmpty(); } -bool QWindowSurface::hasPartialUpdateSupport() const +QWindowSurface::WindowSurfaceFeatures QWindowSurface::features() const { - return true; + return PartialUpdates | PreservedContents; } #ifdef Q_WS_QPA diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 4a2775f..a3fea67 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -68,6 +68,14 @@ class QPlatformWindow; class Q_GUI_EXPORT QWindowSurface { public: + enum WindowSurfaceFeature { + PartialUpdates = 0x00000001, // Supports doing partial updates. + PreservedContents = 0x00000002, // Supports doing flush without first doing a repaint. + StaticContents = 0x00000004, // Supports having static content regions when being resized. + AllFeatures = 0xffffffff // For convenience + }; + Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature) + QWindowSurface(QWidget *window, bool setDefaultSurface = true); virtual ~QWindowSurface(); @@ -100,8 +108,8 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; - virtual bool hasStaticContentsSupport() const; - virtual bool hasPartialUpdateSupport() const; + bool hasFeature(WindowSurfaceFeature feature) const; + virtual WindowSurfaceFeatures features() const; void setStaticContents(const QRegion ®ion); QRegion staticContents() const; @@ -113,11 +121,18 @@ private: QWindowSurfacePrivate *d_ptr; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures) + inline QRect QWindowSurface::rect(const QWidget *widget) const { return widget->rect().translated(offset(widget)); } +inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const +{ + return (features() & feature) != 0; +} + QT_END_NAMESPACE #endif // QWINDOWSURFACE_P_H diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index a5c45c0..9860841 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -410,12 +410,11 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) #endif } -bool QRasterWindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const { - return true; + return QWindowSurface::AllFeatures; } - void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) { Q_D(QRasterWindowSurface); diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 669511d..06abcd3 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -109,7 +109,7 @@ public: void beginPaint(const QRegion &rgn); void setGeometry(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; #ifdef QT_MAC_USE_COCOA CGContextRef imageContext(); diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 4fa25cb..9fa01ed 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -239,9 +239,9 @@ void QS60WindowSurface::setGeometry(const QRect& rect) QWindowSurface::setGeometry(rect); } -bool QS60WindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const { - return true; + return QWindowSurface::AllFeatures; } CFbsBitmap* QS60WindowSurface::symbianBitmap() const diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index f730c87..25018d8 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -79,7 +79,7 @@ public: void setGeometry(const QRect &rect); - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; CFbsBitmap *symbianBitmap() const; diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index ab4f53e..deb83b4 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -250,13 +250,16 @@ QPixmap QX11WindowSurface::grabWidget(const QWidget *widget, return px; } -bool QX11WindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QX11WindowSurface::features() const { + WindowSurfaceFeatures features = QWindowSurface::PartialUpdates | QWindowSurface::PreservedContents; #ifndef QT_NO_XRENDER - return !d_ptr->translucentBackground; + if (!d_ptr->translucentBackground) + features |= QWindowSurface::StaticContents; #else - return true; + features |= QWindowSurface::StaticContents; #endif + return features; } QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h index d5179dd..df76f98 100644 --- a/src/gui/painting/qwindowsurface_x11_p.h +++ b/src/gui/painting/qwindowsurface_x11_p.h @@ -80,7 +80,8 @@ public: bool scroll(const QRegion &area, int dx, int dy); QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; + private: QX11WindowSurfacePrivate *d_ptr; GC gc; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index ac897b5..680e007 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -77,14 +77,12 @@ #include "private/qcombobox_p.h" #include "private/qwidget_p.h" #include "private/qapplication_p.h" +#include "private/qfont_p.h" #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) QT_BEGIN_NAMESPACE -// from text/qfont.cpp -extern Q_GUI_EXPORT int qt_defaultDpiY(); - const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFlags = SkinElementFlags(SF_PointNorth | SF_StateEnabled); @@ -107,8 +105,8 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = { // *** generated pixel metrics *** {5,0,-909,0,0,2,0,2,-1,7,12,22,15,15,7,198,-909,-909,-909,20,13,2,0,0,21,7,18,30,3,3,1,-909,-909,0,1,0,0,12,20,15,15,18,18,1,115,18,0,-909,-909,-909,-909,0,0,16,2,-909,0,0,-909,16,-909,-909,-909,-909,32,18,55,24,55,4,4,4,9,13,-909,5,51,11,5,0,3,3,6,8,3,3,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {5,0,-909,0,0,1,0,2,-1,8,14,22,15,15,7,164,-909,-909,-909,19,15,2,0,0,21,8,27,28,4,4,1,-909,-909,0,7,6,0,13,23,17,17,21,21,7,115,21,0,-909,-909,-909,-909,0,0,15,1,-909,0,0,-909,15,-909,-909,-909,-909,32,21,65,27,65,3,3,5,10,15,-909,5,58,13,5,0,4,4,7,9,4,4,-909,2,-909,-909,-909,-909,6,6,3,1,106}, -{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,26,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, -{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,6,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,5,-1,25,69,46,37,37,9,258,-909,-909,-909,23,19,11,0,0,32,25,72,44,5,5,2,-909,-909,0,7,21,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,25,2,-909,0,0,-909,25,-909,-909,-909,-909,87,27,77,35,77,13,3,6,8,19,-909,7,74,19,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, +{7,0,-909,0,0,2,0,5,-1,25,68,46,37,37,9,258,-909,-909,-909,31,19,13,0,0,32,25,60,52,5,5,2,-909,-909,0,7,32,0,17,29,22,22,27,27,7,173,29,0,-909,-909,-909,-909,0,0,26,2,-909,0,0,-909,26,-909,-909,-909,-909,87,27,96,35,96,12,3,6,8,19,-909,7,74,22,7,0,5,5,8,12,5,5,-909,3,-909,-909,-909,-909,7,7,3,1,135}, {7,0,-909,0,0,2,0,2,-1,10,20,27,18,18,9,301,-909,-909,-909,29,18,5,0,0,35,7,32,30,5,5,2,-909,-909,0,2,8,0,16,28,21,21,26,26,2,170,26,0,-909,-909,-909,-909,0,0,21,6,-909,0,0,-909,-909,-909,-909,-909,-909,54,26,265,34,265,5,5,6,3,18,-909,7,72,19,7,0,5,6,8,11,6,5,-909,2,-909,-909,-909,-909,5,5,3,1,106}, {9,0,-909,0,0,2,0,5,-1,34,99,76,51,51,25,352,-909,-909,-909,29,25,7,0,0,43,34,42,76,7,7,2,-909,-909,0,9,14,0,23,39,30,30,37,37,9,391,40,0,-909,-909,-909,-909,0,0,29,2,-909,0,0,-909,29,-909,-909,-909,-909,115,37,96,48,96,19,19,9,1,25,-909,9,101,24,9,0,7,7,7,16,7,7,-909,3,-909,-909,-909,-909,9,9,3,1,184} // *** End of generated data *** @@ -1743,16 +1741,26 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, QStyleOptionMenuItem optionMenuItem = *menuItem; bool drawSubMenuIndicator = false; + bool drawSeparator = false; switch(menuItem->menuItemType) { - case QStyleOptionMenuItem::Scroller: case QStyleOptionMenuItem::Separator: - return; // no separators or scrollers in S60 menus + drawSeparator = true; + break; + case QStyleOptionMenuItem::Scroller: + return; // no scrollers in S60 menus case QStyleOptionMenuItem::SubMenu: drawSubMenuIndicator = true; break; default: break; } + if (drawSeparator) { + painter->save(); + painter->setPen(QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 10, 0)); + painter->drawLine(optionMenuItem.rect.topLeft(), optionMenuItem.rect.bottomRight()); + painter->restore(); + return; + } const bool enabled = optionMenuItem.state & State_Enabled; const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable; bool ignoreCheckMark = false; @@ -1856,20 +1864,26 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, //In Sym^3, native menu items have "lines" between them if (QS60StylePrivate::isSingleClickUi()) { - const QColor lineColorAlpha = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 15, 0); - const int spacing = QS60StylePrivate::pixelMetric(PM_FrameCornerWidth); - //native platform sets each color byte to same value for "line 16" which just defines alpha for - //menuitem lines; lets use first byte "red". - QColor lineColor = optionMenuItem.palette.text().color(); - if (lineColorAlpha.isValid()) - lineColor.setAlpha(lineColorAlpha.red()); - painter->save(); - painter->setPen(lineColor); - - const int lineStartX = optionMenuItem.rect.left() + (QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - 2) + spacing; - const int lineEndX = optionMenuItem.rect.right() - (QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - 2) - spacing; - painter->drawLine(QPoint(lineStartX, optionMenuItem.rect.bottom()), QPoint(lineEndX, optionMenuItem.rect.bottom())); - painter->restore(); + int diff = widget->geometry().bottom() - optionMenuItem.rect.bottom(); + if (const QComboBox *cb = qobject_cast<const QComboBox*>(widget)) + diff = cb->view()->geometry().bottom() - optionMenuItem.rect.bottom(); + + // Skip drawing the horizontal line for the last menu item. + if (diff > optionMenuItem.rect.height()) { + const QColor lineColorAlpha = QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnLineColors, 15, 0); + //native platform sets each color byte to same value for "line 16" which just defines alpha for + //menuitem lines; lets use first byte "red". + QColor lineColor = optionMenuItem.palette.text().color(); + if (lineColorAlpha.isValid()) + lineColor.setAlpha(lineColorAlpha.red()); + painter->save(); + painter->setPen(lineColor); + const int horizontalMargin = 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth) - QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth); + const int lineStartX = optionMenuItem.rect.left() + horizontalMargin; + const int lineEndX = optionMenuItem.rect.right() - horizontalMargin; + painter->drawLine(QPoint(lineStartX, optionMenuItem.rect.bottom()), QPoint(lineEndX, optionMenuItem.rect.bottom())); + painter->restore(); + } } if (!enabled) painter->restore(); @@ -2264,13 +2278,16 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti #endif //QT_NO_MENU ) { //Need extra check since dialogs have their own theme background - if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) && - QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) - //todo: for combobox listviews, the background should include area for menu scrollers, - //but this produces drawing issues as we need to turn clipping off. - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, option->rect, flags); - else + if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) + && QS60StylePrivate::equalToThemePalette(option->palette.window().texture().cacheKey(), QPalette::Window)) { + const bool comboMenu = qobject_cast<const QComboBoxListView *>(widget); + // Add margin area to the background, to avoid background being cut for first and last item. + const int verticalMenuAdjustment = comboMenu ? QS60StylePrivate::pixelMetric(PM_MenuVMargin) : 0; + const QRect adjustedMenuRect = option->rect.adjusted(0, -verticalMenuAdjustment, 0, verticalMenuAdjustment); + QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_PopupBackground, painter, adjustedMenuRect, flags); + } else { commonStyleDraws = true; + } } break; case PE_FrameWindow: @@ -2538,17 +2555,16 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal; if (parentCanGrowHorizontally) { - int visibleButtons = 0; + int buttons = 0; //Make the auto-stretch to happen only for horizontal orientation if (tb && tb->orientation() == Qt::Horizontal) { QList<QAction*> actionList = tb->actions(); for (int i = 0; i < actionList.count(); i++) { - if (actionList.at(i)->isVisible()) - visibleButtons++; + buttons++; } } - if (widget->parentWidget() && visibleButtons > 0) { + if (widget->parentWidget() && buttons > 0) { QWidget *w = const_cast<QWidget *>(widget); int toolBarMaxWidth = 0; int totalMargin = 0; @@ -2571,7 +2587,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, toolBarMaxWidth -= totalMargin; //ensure that buttons are side-by-side and not on top of each other - const int toolButtonWidth = (toolBarMaxWidth / visibleButtons) + const int toolButtonWidth = (toolBarMaxWidth / buttons) - pixelMetric(QStyle::PM_ToolBarItemSpacing) - pixelMetric(QStyle::PM_ToolBarItemMargin) //toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action @@ -2604,10 +2620,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz += QSize(2 * f->lineWidth, 4 * f->lineWidth); break; case CT_TabBarTab: { - const QSize naviPaneSize = QS60StylePrivate::naviPaneSize(); sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget); - if (naviPaneSize.height() > sz.height()) - sz.setHeight(naviPaneSize.height()); // Adjust beginning tabbar item size, if scrollbuttons are used. This is to ensure that the // tabbar item content fits, since scrollbuttons are making beginning tabbar item smaller. int scrollButtonSize = 0; @@ -2627,7 +2640,7 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, case CT_ItemViewItem: if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) { if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) { - sz = QSize(); + sz = QSize(menuItem->rect.width() - 2 * pixelMetric(PM_MenuHMargin) - 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth), 1); break; } } diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 3628b27..e146a4e 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -562,8 +562,6 @@ public: void handleSkinChange(); #endif // Q_WS_S60 - static QSize naviPaneSize(); - //Checks that the current brush is transparent or has BrushStyle NoBrush, //so that theme graphic background can be drawn. static bool canDrawThemeBackground(const QBrush &backgroundBrush, const QWidget *widget); diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 64d2ad2..6a7158c 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -158,7 +158,6 @@ public: static bool disabledPartGraphic(QS60StyleEnums::SkinParts &part); static bool disabledFrameGraphic(QS60StylePrivate::SkinFrameElements &frame); static QPixmap generateMissingThemeGraphic(QS60StyleEnums::SkinParts &part, const QSize &size, QS60StylePrivate::SkinElementFlags flags); - static QSize naviPaneSize(); static TAknsItemID partSpecificThemeId(int part); static QVariant themeDefinition(QS60StyleEnums::ThemeDefinitions definition, QS60StyleEnums::SkinParts part); @@ -1478,23 +1477,6 @@ void QS60StylePrivate::handleSkinChange() #endif } -QSize QS60StylePrivate::naviPaneSize() -{ - return QS60StyleModeSpecifics::naviPaneSize(); -} - -QSize QS60StyleModeSpecifics::naviPaneSize() -{ - CAknNavigationControlContainer* naviContainer; - if (S60->statusPane()) { - TRAPD(err, naviContainer = static_cast<CAknNavigationControlContainer*> - (S60->statusPane()->ControlL(TUid::Uid(EEikStatusPaneUidNavi)))); - if (err==KErrNone) - return QSize(naviContainer->Size().iWidth, naviContainer->Size().iHeight); - } - return QSize(0,0); -} - int QS60StylePrivate::currentAnimationFrame(QS60StyleEnums::SkinParts part) { QS60StyleAnimation *animation = animationDefinition(part); diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp index 7223c6b..a5aeac3 100644 --- a/src/gui/styles/qs60style_simulated.cpp +++ b/src/gui/styles/qs60style_simulated.cpp @@ -318,11 +318,6 @@ QPixmap QS60StylePrivate::backgroundTexture(bool /*skipCreation*/) return *m_background; } -QSize QS60StylePrivate::naviPaneSize() -{ - return QSize(0, 0); -} - bool QS60StylePrivate::isTouchSupported() { #ifdef QT_KEYPAD_NAVIGATION diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index c1a5048..43dca81 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -281,6 +281,10 @@ public: int timer_id; }; +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); +Q_GUI_EXPORT int qt_defaultDpi(); + QT_END_NAMESPACE #endif // QFONT_P_H diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index cbe0423..94f21b8 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -89,8 +89,6 @@ QT_BEGIN_NAMESPACE #define SMOOTH_SCALABLE 0xffff -Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp - bool qt_enable_test_font = false; Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 08eb6bb..ffdaaa7 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -791,106 +791,6 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, return load_flags; } -QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const -{ - Glyph *g = set->getGlyph(glyph); - if (g && g->format == format) - return g; - - bool hsubpixel = false; - int vfactor = 1; - int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor); - - // apply our matrix to this, but note that the metrics will not be affected by this. - FT_Face face = lockFace(); - FT_Matrix matrix = this->matrix; - FT_Matrix_Multiply(&set->transformationMatrix, &matrix); - FT_Set_Transform(face, &matrix, 0); - freetype->matrix = matrix; - - bool transform = matrix.xx != 0x10000 || matrix.yy != 0x10000 || matrix.xy != 0 || matrix.yx != 0; - if (transform) - load_flags |= FT_LOAD_NO_BITMAP; - - FT_Error err = FT_Load_Glyph(face, glyph, load_flags); - if (err && (load_flags & FT_LOAD_NO_BITMAP)) { - load_flags &= ~FT_LOAD_NO_BITMAP; - err = FT_Load_Glyph(face, glyph, load_flags); - } - if (err == FT_Err_Too_Few_Arguments) { - // this is an error in the bytecode interpreter, just try to run without it - load_flags |= FT_LOAD_FORCE_AUTOHINT; - err = FT_Load_Glyph(face, glyph, load_flags); - } - if (err != FT_Err_Ok) - qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph); - - unlockFace(); - if (set->outline_drawing) - return 0; - - if (!g) { - g = new Glyph; - g->uploadedToServer = false; - g->data = 0; - } - - FT_GlyphSlot slot = face->glyph; - if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot); - int left = slot->metrics.horiBearingX; - int right = slot->metrics.horiBearingX + slot->metrics.width; - int top = slot->metrics.horiBearingY; - int bottom = slot->metrics.horiBearingY - slot->metrics.height; - if(transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics - int l, r, t, b; - FT_Vector vector; - vector.x = left; - vector.y = top; - FT_Vector_Transform(&vector, &matrix); - l = r = vector.x; - t = b = vector.y; - vector.x = right; - vector.y = top; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - vector.x = right; - vector.y = bottom; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - vector.x = left; - vector.y = bottom; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - left = l; - right = r; - top = t; - bottom = b; - } - left = FLOOR(left); - right = CEIL(right); - bottom = FLOOR(bottom); - top = CEIL(top); - - g->linearAdvance = face->glyph->linearHoriAdvance >> 10; - g->width = TRUNC(right-left); - g->height = TRUNC(top-bottom); - g->x = TRUNC(left); - g->y = TRUNC(top); - g->advance = TRUNC(ROUND(face->glyph->advance.x)); - g->format = Format_None; - - return g; -} - QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat format, @@ -1792,10 +1692,10 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph) glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matrix) { - return alphaMapBoundingBox(glyph, matrix, QFontEngine::Format_None); + return alphaMapBoundingBox(glyph, 0, matrix, QFontEngine::Format_None); } -glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, QFontEngine::GlyphFormat format) +glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixelPosition, const QTransform &matrix, QFontEngine::GlyphFormat format) { FT_Face face = 0; glyph_metrics_t overall; @@ -1842,7 +1742,10 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, const QTransfo Glyph * g = glyphSet->getGlyph(glyph); if (!g || g->format != format) { face = lockFace(); - g = loadGlyphMetrics(glyphSet, glyph, format); + FT_Matrix m = this->matrix; + FT_Matrix_Multiply(&glyphSet->transformationMatrix, &m); + freetype->matrix = m; + g = loadGlyph(glyphSet, glyph, subPixelPosition, format); } if (g) { diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index fc3ac82..451d26e 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -257,7 +257,9 @@ private: virtual QImage alphaMapForGlyph(glyph_t g) { return alphaMapForGlyph(g, 0); } virtual QImage alphaMapForGlyph(glyph_t, QFixed); virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); - virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, + virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, + QFixed subPixelPosition, + const QTransform &matrix, QFontEngine::GlyphFormat format); virtual void removeGlyphFromCache(glyph_t glyph); @@ -333,7 +335,6 @@ protected: bool embeddedbitmap; private: - QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const; int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const; GlyphFormat defaultFormat; diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f501141..7b29993 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -203,7 +203,7 @@ public: virtual QImage alphaMapForGlyph(glyph_t, QFixed subPixelPosition, const QTransform &t); virtual QImage alphaRGBMapForGlyph(glyph_t, QFixed subPixelPosition, int margin, const QTransform &t); - virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QTransform &matrix, GlyphFormat /*format*/) + virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, QFixed /*subPixelPosition*/, const QTransform &matrix, GlyphFormat /*format*/) { return boundingBox(glyph, matrix); } diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 5cd85fb..2ec245e 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -63,7 +63,6 @@ extern void qt_format_text(const QFont& font, const QRectF &_r, int tf, const QString &text, QRectF *brect, int tabStops, int *tabArray, int tabArrayLen, QPainter *painter); -Q_GUI_EXPORT extern int qt_defaultDpi(); /***************************************************************************** QFontMetrics member functions diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 452b60a..1cfb4b6 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -420,9 +420,6 @@ QStaticTextPrivate *QStaticTextPrivate::get(const QStaticText *q) return q->data.data(); } -Q_GUI_EXPORT extern int qt_defaultDpiX(); -Q_GUI_EXPORT extern int qt_defaultDpiY(); - namespace { class DrawTextItemRecorder: public QPaintEngine diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index b7a2697..66ce64b 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1552,7 +1552,7 @@ void QTextControlPrivate::mousePressEvent(QEvent *e, Qt::MouseButton button, con extendBlockwiseSelection(cursorPos); else if (selectedWordOnDoubleClick.hasSelection()) extendWordwiseSelection(cursorPos, pos.x()); - else if (wordSelectionEnabled) + else if (!wordSelectionEnabled) setCursorPosition(cursorPos, QTextCursor::KeepAnchor); } else { diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index be67279..6dbd755 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -60,6 +60,7 @@ #include <qdir.h> #include <qapplication.h> #include "qtextcontrol_p.h" +#include "qfont_p.h" #include "private/qtextedit_p.h" #include "private/qdataurl_p.h" @@ -1671,8 +1672,6 @@ static void printPage(int index, QPainter *painter, const QTextDocument *doc, co painter->restore(); } -Q_GUI_EXPORT extern int qt_defaultDpi(); - /*! Prints the document to the given \a printer. The QPrinter must be set up before being used with this function. diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 684de00..ce157be 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -75,8 +75,6 @@ QT_BEGIN_NAMESPACE -Q_GUI_EXPORT extern int qt_defaultDpi(); - // ################ should probably add frameFormatChange notification! struct QTextLayoutStruct; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 6aa333c..08d0eca 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -856,8 +856,6 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -Q_GUI_EXPORT extern int qt_defaultDpiY(); // in qfont.cpp - void QTextEngine::shapeText(int item) const { Q_ASSERT(item < layoutData->items.size()); @@ -2611,8 +2609,6 @@ void QTextEngine::splitItem(int item, int pos) const // qDebug("split at position %d itempos=%d", pos, item); } -Q_GUI_EXPORT extern int qt_defaultDpiY(); - QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const { const QScriptItem &si = layoutData->items[item]; diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index a6d085a..bbff79c 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -123,7 +123,6 @@ static QSize getPixmapSize(QTextDocument *doc, const QTextImageFormat &format) qreal scale = 1.0; QPaintDevice *pdev = doc->documentLayout()->paintDevice(); if (pdev) { - Q_GUI_EXPORT extern int qt_defaultDpi(); if (pm.isNull()) pm = getPixmap(doc, format); if (!pm.isNull()) @@ -191,7 +190,6 @@ static QSize getImageSize(QTextDocument *doc, const QTextImageFormat &format) qreal scale = 1.0; QPaintDevice *pdev = doc->documentLayout()->paintDevice(); if (pdev) { - extern int qt_defaultDpi(); if (image.isNull()) image = getImage(doc, format); if (!image.isNull()) diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index c2e47f3..c5ea0cf 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -124,6 +124,7 @@ public: manifestWriter.writeNamespace(manifestNS, QString::fromLatin1("manifest")); manifestWriter.writeStartDocument(); manifestWriter.writeStartElement(manifestNS, QString::fromLatin1("manifest")); + manifestWriter.writeAttribute(manifestNS, QString::fromLatin1("version"), QString::fromLatin1("1.2")); addFile(QString::fromLatin1("/"), QString::fromLatin1("application/vnd.oasis.opendocument.text")); addFile(QString::fromLatin1("content.xml"), QString::fromLatin1("text/xml")); } @@ -786,6 +787,7 @@ bool QTextOdfWriter::writeAll() writer.writeNamespace(svgNS, QString::fromLatin1("svg")); writer.writeStartDocument(); writer.writeStartElement(officeNS, QString::fromLatin1("document-content")); + writer.writeAttribute(officeNS, QString::fromLatin1("version"), QString::fromLatin1("1.2")); // add fragments. (for character formats) QTextDocumentPrivate::FragmentIterator fragIt = m_document->docHandle()->begin(); diff --git a/src/gui/widgets/qabstractscrollarea.cpp b/src/gui/widgets/qabstractscrollarea.cpp index f948af9..dabfec0 100644 --- a/src/gui/widgets/qabstractscrollarea.cpp +++ b/src/gui/widgets/qabstractscrollarea.cpp @@ -511,7 +511,7 @@ QAbstractScrollArea::QAbstractScrollArea(QAbstractScrollAreaPrivate &dd, QWidget /*! Constructs a viewport. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. */ QAbstractScrollArea::QAbstractScrollArea(QWidget *parent) :QFrame(*new QAbstractScrollAreaPrivate, parent) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index cb36398..2570496 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -265,7 +265,7 @@ void QAbstractSliderPrivate::setSteps(int single, int page) /*! Constructs an abstract slider. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. The \l minimum defaults to 0, the \l maximum to 99, with a \l singleStep size of 1 and a \l pageStep size of 10, and an initial diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index d63ccfb..5f00afa 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -947,7 +947,10 @@ QComboBox::QComboBox(bool rw, QWidget *parent, const char *name) to set and get item data (e.g., setItemData() and itemText()). You can also set a new model and view (with setModel() and setView()). For the text and icon in the combobox label, the data in the model - that has the Qt::DisplayRole and Qt::DecorationRole is used. + that has the Qt::DisplayRole and Qt::DecorationRole is used. Note + that you cannot alter the \l{QAbstractItemView::}{SelectionMode} + of the view(), e.g., by using + \l{QAbstractItemView::}{setSelectionMode()}. \image qstyle-comboboxes.png Comboboxes in the different built-in styles. @@ -2360,7 +2363,12 @@ void QComboBox::showPopup() initStyleOption(&opt); QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); +#ifndef Q_WS_S60 QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); +#else + QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); +#endif + QPoint below = mapToGlobal(listRect.bottomLeft()); int belowHeight = screen.bottom() - below.y(); QPoint above = mapToGlobal(listRect.topLeft()); @@ -2465,12 +2473,7 @@ void QComboBox::showPopup() // available screen geometry.This may override the vertical position, but it is more // important to show as much as possible of the popup. const int height = !boundToScreen ? listRect.height() : qMin(listRect.height(), screen.height()); -#ifdef Q_WS_S60 - //popup needs to be stretched with screen minimum dimension - listRect.setHeight(qMin(screen.height(), screen.width())); -#else listRect.setHeight(height); -#endif if (boundToScreen) { if (listRect.top() < screen.top()) @@ -2488,18 +2491,10 @@ void QComboBox::showPopup() listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty()) { - TRect cbaRect = TRect(); - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); - AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); - switch (cbaLocation) { - case AknLayoutUtils::EAknCbaLocationRight: - listRect.setRight(screen.right()); - break; - case AknLayoutUtils::EAknCbaLocationLeft: - listRect.setLeft(screen.left()); - break; - } + if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { + // landscape without stacon, menu should be at the right + (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : + listRect.setLeft(screen.left()); } } #endif @@ -2718,7 +2713,7 @@ void QComboBox::changeEvent(QEvent *e) initStyleOption(&opt); if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) { - const QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this)); + QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()); QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxListBoxPopup, this)); @@ -2733,13 +2728,14 @@ void QComboBox::changeEvent(QEvent *e) listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty()) { + if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { // landscape without stacon, menu should be at the right (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : listRect.setLeft(screen.left()); } - d->container->setGeometry(listRect); } + + d->container->setGeometry(listRect); } } #endif @@ -2772,6 +2768,10 @@ void QComboBox::changeEvent(QEvent *e) void QComboBox::resizeEvent(QResizeEvent *) { Q_D(QComboBox); +#ifdef Q_WS_S60 + if (d->viewContainer() && d->viewContainer()->isVisible()) + showPopup(); +#endif d->updateLineEditGeometry(); } diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index c09b5a4..b12e5c5 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1247,37 +1247,15 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) response to button presses; these are just like context menus except for how they are invoked. - \raw HTML - <table align="center" cellpadding="0"> - <tr> - <td> - \endraw - \inlineimage plastique-menu.png - \raw HTML - </td> - <td> - \endraw - \inlineimage windowsxp-menu.png - \raw HTML - </td> - <td> - \endraw - \inlineimage macintosh-menu.png - \raw HTML - </td> - - </tr> - <tr> - <td colspan="3"> - \endraw - A menu shown in \l{Plastique Style Widget Gallery}{Plastique widget style}, + \table 100% + \row + \o \inlineimage plastique-menu.png + \o \inlineimage windowsxp-menu.png + \o \inlineimage macintosh-menu.png + \endtable + \caption Fig. A menu shown in \l{Plastique Style Widget Gallery}{Plastique widget style}, \l{Windows XP Style Widget Gallery}{Windows XP widget style}, and \l{Macintosh Style Widget Gallery}{Macintosh widget style}. - \raw HTML - </td> - </tr> - </table> - \endraw \section1 Actions diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index c895b1b..87738a0 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -330,7 +330,7 @@ void QScrollBar::initStyleOption(QStyleOptionSlider *option) const /*! Constructs a vertical scroll bar. - The \a parent arguments is sent to the QWidget constructor. + The \a parent argument is sent to the QWidget constructor. The \l {QAbstractSlider::minimum} {minimum} defaults to 0, the \l {QAbstractSlider::maximum} {maximum} to 99, with a diff --git a/src/gui/widgets/qsplitter.cpp b/src/gui/widgets/qsplitter.cpp index 964a6e1..ca8fc37 100644 --- a/src/gui/widgets/qsplitter.cpp +++ b/src/gui/widgets/qsplitter.cpp @@ -1016,7 +1016,7 @@ QSplitterLayoutStruct *QSplitterPrivate::insertWidget(int index, QWidget *w) /*! Constructs a horizontal splitter with the \a parent - arguments is passed on to the QFrame constructor. + argument passed on to the QFrame constructor. \sa setOrientation() */ |