summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible_mac_cocoa.mm4
-rw-r--r--src/gui/dialogs/qfiledialog_mac.mm18
-rw-r--r--src/gui/dialogs/qprintdialog.qdoc38
-rw-r--r--src/gui/egl/qegl_x11.cpp5
-rw-r--r--src/gui/graphicsview/qgraphicsgridlayout.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp5
-rw-r--r--src/gui/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp34
-rw-r--r--src/gui/graphicsview/qgridlayoutengine_p.h4
-rw-r--r--src/gui/image/image.pri18
-rw-r--r--src/gui/image/qbmphandler.cpp10
-rw-r--r--src/gui/image/qimage.cpp287
-rw-r--r--src/gui/image/qimage_p.h3
-rw-r--r--src/gui/image/qimagereader.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp3
-rw-r--r--src/gui/image/qpixmap_raster.cpp201
-rw-r--r--src/gui/image/qpixmap_raster_p.h3
-rw-r--r--src/gui/image/qpixmap_x11.cpp6
-rw-r--r--src/gui/image/qpixmapcache.cpp29
-rw-r--r--src/gui/image/qpixmapdata.cpp2
-rw-r--r--src/gui/image/qpnghandler.cpp10
-rw-r--r--src/gui/image/qppmhandler.cpp10
-rw-r--r--src/gui/image/qxbmhandler.cpp10
-rw-r--r--src/gui/image/qxpmhandler.cpp8
-rw-r--r--src/gui/inputmethod/qximinputcontext_x11.cpp14
-rw-r--r--src/gui/itemviews/qabstractitemdelegate.cpp10
-rw-r--r--src/gui/itemviews/qtreewidget.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp28
-rw-r--r--src/gui/kernel/qapplication_win.cpp61
-rw-r--r--src/gui/kernel/qclipboard_x11.cpp4
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm2
-rw-r--r--src/gui/kernel/qdesktopwidget.qdoc36
-rw-r--r--src/gui/kernel/qdnd_mac.mm4
-rw-r--r--src/gui/kernel/qgesturemanager.cpp8
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp33
-rw-r--r--src/gui/kernel/qkeymapper_qws.cpp2
-rw-r--r--src/gui/kernel/qkeymapper_x11.cpp21
-rw-r--r--src/gui/kernel/qkeymapper_x11_p.cpp14
-rw-r--r--src/gui/kernel/qsizepolicy.qdoc36
-rw-r--r--src/gui/kernel/qstandardgestures.cpp3
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm7
-rw-r--r--src/gui/kernel/qt_s60_p.h55
-rw-r--r--src/gui/kernel/qwhatsthis.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp83
-rw-r--r--src/gui/kernel/qwidget_mac.mm19
-rw-r--r--src/gui/kernel/qwidget_p.h14
-rw-r--r--src/gui/kernel/qwidget_qws.cpp2
-rw-r--r--src/gui/kernel/qwidget_s60.cpp4
-rw-r--r--src/gui/kernel/qwidget_win.cpp1
-rw-r--r--src/gui/kernel/qwidget_x11.cpp1
-rw-r--r--src/gui/kernel/qwinnativepangesturerecognizer_win_p.h33
-rw-r--r--src/gui/painting/painting.pri9
-rw-r--r--src/gui/painting/qcolormap.qdoc36
-rw-r--r--src/gui/painting/qgraphicssystem_runtime_p.h2
-rw-r--r--src/gui/painting/qgrayraster.c35
-rw-r--r--src/gui/painting/qgrayraster_p.h4
-rw-r--r--src/gui/painting/qoutlinemapper.cpp12
-rw-r--r--src/gui/painting/qoutlinemapper_p.h2
-rw-r--r--src/gui/painting/qpaintdevice.qdoc36
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp129
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp5
-rw-r--r--src/gui/painting/qpaintengineex.cpp4
-rw-r--r--src/gui/painting/qpainter.cpp18
-rw-r--r--src/gui/painting/qprinterinfo.qdoc36
-rw-r--r--src/gui/painting/qrasterdefs_p.h6
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp2
-rw-r--r--src/gui/styles/qcommonstyle.cpp4
-rw-r--r--src/gui/styles/qgtkstyle.cpp3
-rw-r--r--src/gui/styles/qmacstyle.qdoc36
-rw-r--r--src/gui/styles/qmacstyle_mac.mm2
-rw-r--r--src/gui/styles/qs60style.cpp122
-rw-r--r--src/gui/styles/qs60style_p.h48
-rw-r--r--src/gui/styles/qs60style_s60.cpp84
-rw-r--r--src/gui/text/qfontdatabase.cpp15
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp43
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_mac.mm27
-rw-r--r--src/gui/text/qfontengine_s60.cpp2
-rw-r--r--src/gui/text/qstatictext.cpp43
-rw-r--r--src/gui/text/qstatictext.h5
-rw-r--r--src/gui/text/qstatictext_p.h6
-rw-r--r--src/gui/text/qtextcursor.cpp5
-rw-r--r--src/gui/text/qtextdocument.cpp11
-rw-r--r--src/gui/text/qtextdocument_p.cpp19
-rw-r--r--src/gui/text/qtextdocument_p.h2
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp8
-rw-r--r--src/gui/text/qtextengine.cpp28
-rw-r--r--src/gui/text/qtextengine_p.h1
-rw-r--r--src/gui/text/qtextformat.cpp7
-rw-r--r--src/gui/text/qtextlayout.cpp63
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp43
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/gui/text/qtextoption.cpp12
-rw-r--r--src/gui/text/qtextoption.h6
-rw-r--r--src/gui/text/text.pri3
-rw-r--r--src/gui/util/qsystemtrayicon.cpp5
-rw-r--r--src/gui/util/qsystemtrayicon_mac.mm5
-rw-r--r--src/gui/util/qsystemtrayicon_p.h2
-rw-r--r--src/gui/util/qsystemtrayicon_qws.cpp5
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp163
-rw-r--r--src/gui/util/qsystemtrayicon_wince.cpp15
-rw-r--r--src/gui/util/qsystemtrayicon_x11.cpp5
-rw-r--r--src/gui/widgets/qcombobox.cpp5
-rw-r--r--src/gui/widgets/qcommandlinkbutton.cpp18
-rw-r--r--src/gui/widgets/qlinecontrol_p.h11
-rw-r--r--src/gui/widgets/qlineedit.cpp5
-rw-r--r--src/gui/widgets/qslider.cpp2
110 files changed, 1615 insertions, 848 deletions
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm
index 1688404..ada927e 100644
--- a/src/gui/accessible/qaccessible_mac_cocoa.mm
+++ b/src/gui/accessible/qaccessible_mac_cocoa.mm
@@ -58,11 +58,15 @@ QT_BEGIN_NAMESPACE
//#define MAC_ACCESSIBILTY_DEVELOPER_MODE
+#ifndef QT_NO_DEBUG_STREAM
#ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE
#define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug)
#else
#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug)
#endif
+#else
+#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug)
+#endif
typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap;
Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap);
diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm
index b07b1ea..f1afaa9 100644
--- a/src/gui/dialogs/qfiledialog_mac.mm
+++ b/src/gui/dialogs/qfiledialog_mac.mm
@@ -284,6 +284,15 @@ QT_USE_NAMESPACE
if ([filename length] == 0)
return NO;
+ // Always accept directories regardless of their names (unless it is a bundle):
+ BOOL isDir;
+ if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) {
+ if ([mSavePanel treatsFilePackagesAsDirectories] == NO) {
+ if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
+ return YES;
+ }
+ }
+
QString qtFileName = QT_PREPEND_NAMESPACE(qt_mac_NSStringToQString)(filename);
QFileInfo info(qtFileName.normalized(QT_PREPEND_NAMESPACE(QString::NormalizationForm_C)));
QString path = info.absolutePath();
@@ -295,15 +304,6 @@ QT_USE_NAMESPACE
if (!mQDirFilterEntryList->contains(info.fileName()))
return NO;
- // Always accept directories regardless of their names (unless it is a bundle):
- BOOL isDir;
- if ([[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir] && isDir) {
- if ([mSavePanel treatsFilePackagesAsDirectories] == NO) {
- if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:filename] == NO)
- return YES;
- }
- }
-
// No filter means accept everything
if (mSelectedNameFilter->isEmpty())
return YES;
diff --git a/src/gui/dialogs/qprintdialog.qdoc b/src/gui/dialogs/qprintdialog.qdoc
index 76fe234..bd406c1 100644
--- a/src/gui/dialogs/qprintdialog.qdoc
+++ b/src/gui/dialogs/qprintdialog.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 969acc4..fea6e8d 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -415,7 +415,10 @@ 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:
- return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0);
+ if (surf == EGL_NO_SURFACE)
+ qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError());
+ return surf;
}
if (x11PixmapData) {
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 6ca799d..83db3ec 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -572,6 +572,18 @@ void QGraphicsGridLayout::removeAt(int index)
if (QGraphicsLayoutItem *layoutItem = gridItem->layoutItem())
layoutItem->setParentLayoutItem(0);
d->engine.removeItem(gridItem);
+
+ // recalculate rowInfo.count if we remove an item that is on the right/bottommost row
+ for (int j = 0; j < NOrientations; ++j) {
+ // 0: Hor, 1: Ver
+ const Qt::Orientation orient = (j == 0 ? Qt::Horizontal : Qt::Vertical);
+ const int oldCount = d->engine.rowCount(orient);
+ if (gridItem->lastRow(orient) == oldCount - 1) {
+ const int newCount = d->engine.effectiveLastRow(orient) + 1;
+ d->engine.removeRows(newCount, oldCount - newCount, orient);
+ }
+ }
+
delete gridItem;
invalidate();
}
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 6867410..0dc1e6b 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3277,7 +3277,8 @@ void QGraphicsItemPrivate::setFocusHelper(Qt::FocusReason focusReason, bool clim
*/
void QGraphicsItem::clearFocus()
{
- d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
+ if (hasFocus())
+ d_ptr->clearFocusHelper(/* giveFocusToParent = */ true);
}
/*!
@@ -3864,7 +3865,7 @@ qreal QGraphicsItem::scale() const
The scale is combined with the item's rotation(), transform() and
transformations() to map the item's coordinate system to the parent item.
- \sa scale(), setTransformOriginPoint(), {Transformations}
+ \sa scale(), setTransformOriginPoint(), {Transformations Example}
*/
void QGraphicsItem::setScale(qreal factor)
{
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 9722683..b828722 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -147,7 +147,7 @@ void QGraphicsLinearLayoutPrivate::removeGridItem(QGridLayoutItem *gridItem)
{
int index = gridItem->firstRow(orientation);
engine.removeItem(gridItem);
- engine.removeRow(index, orientation);
+ engine.removeRows(index, 1, orientation);
}
void QGraphicsLinearLayoutPrivate::fixIndex(int *index) const
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 7b0722e..e5264da 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -885,8 +885,7 @@ void QGraphicsScenePrivate::removePopup(QGraphicsWidget *widget, bool itemIsDyin
ungrabKeyboard(static_cast<QGraphicsItem *>(widget), itemIsDying);
}
if (!itemIsDying && widget->isVisible()) {
- widget->hide();
- widget->QGraphicsItem::d_ptr->explicitlyHidden = 0;
+ widget->QGraphicsItem::d_ptr->setVisibleHelper(false, /* explicit = */ false);
}
}
}
@@ -4163,6 +4162,25 @@ void QGraphicsScene::wheelEvent(QGraphicsSceneWheelEvent *wheelEvent)
wheelEvent->scenePos(),
wheelEvent->widget());
+#ifdef Q_WS_MAC
+ // On Mac, ignore the event if the first item under the mouse is not the last opened
+ // popup (or one of its descendant)
+ if (!d->popupWidgets.isEmpty() && !wheelCandidates.isEmpty() && wheelCandidates.first() != d->popupWidgets.back() && !d->popupWidgets.back()->isAncestorOf(wheelCandidates.first())) {
+ wheelEvent->accept();
+ return;
+ }
+#else
+ // Find the first popup under the mouse (including the popup's descendants) starting from the last.
+ // Remove all popups after the one found, or all or them if no popup is under the mouse.
+ // Then continue with the event.
+ QList<QGraphicsWidget *>::const_iterator iter = d->popupWidgets.end();
+ while (--iter >= d->popupWidgets.begin() && !wheelCandidates.isEmpty()) {
+ if (wheelCandidates.first() == *iter || (*iter)->isAncestorOf(wheelCandidates.first()))
+ break;
+ d->removePopup(*iter);
+ }
+#endif
+
bool hasSetFocus = false;
foreach (QGraphicsItem *item, wheelCandidates) {
if (!hasSetFocus && item->isEnabled()
@@ -6100,8 +6118,15 @@ void QGraphicsScenePrivate::gestureEventHandler(QGestureEvent *event)
if (ev.isAccepted() || ev.isAccepted(g)) {
conflictedGestures.remove(g);
// mark the item as a gesture target
- if (item)
+ if (item) {
gestureTargets.insert(g, item.data());
+ QHash<QGraphicsObject *, QSet<QGesture *> >::iterator it, e;
+ it = cachedItemGestures.begin();
+ e = cachedItemGestures.end();
+ for(; it != e; ++it)
+ it.value().remove(g);
+ cachedItemGestures[item.data()].insert(g);
+ }
DEBUG() << "QGraphicsScenePrivate::gestureEventHandler:"
<< "override was accepted:"
<< g << item.data();
@@ -6270,7 +6295,8 @@ void QGraphicsScenePrivate::cancelGesturesForChildren(QGesture *original)
{
Q_ASSERT(original);
QGraphicsItem *originalItem = gestureTargets.value(original);
- Q_ASSERT(originalItem);
+ if (originalItem == 0) // we only act on accepted gestures, which implies it has a target.
+ return;
// iterate over all active gestures and for each find the owner
// if the owner is part of our sub-hierarchy, cancel it.
diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h
index cbf704e..9ac9a8e 100644
--- a/src/gui/graphicsview/qgridlayoutengine_p.h
+++ b/src/gui/graphicsview/qgridlayoutengine_p.h
@@ -363,8 +363,8 @@ public:
QGridLayoutItem *itemAt(int row, int column, Qt::Orientation orientation = Qt::Vertical) const;
inline void insertRow(int row, Qt::Orientation orientation = Qt::Vertical)
{ insertOrRemoveRows(row, +1, orientation); }
- inline void removeRow(int row, Qt::Orientation orientation = Qt::Vertical)
- { insertOrRemoveRows(row, -1, orientation); }
+ inline void removeRows(int row, int count, Qt::Orientation orientation)
+ { insertOrRemoveRows(row, -count, orientation); }
void invalidate();
void setGeometries(const QLayoutStyleInfo &styleInfo, const QRectF &contentsGeometry);
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index 8d75fdd..f5f1bc0 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -63,7 +63,7 @@ embedded {
}
x11 {
HEADERS += image/qpixmap_x11_p.h
- SOURCES += image/qpixmap_x11.cpp
+ SOURCES += image/qpixmap_x11.cpp
}
mac {
HEADERS += image/qpixmap_mac_p.h
@@ -93,12 +93,12 @@ SOURCES += \
SOURCES += image/qpnghandler.cpp
contains(QT_CONFIG, system-png) {
- unix:LIBS_PRIVATE += -lpng
- win32:LIBS += libpng.lib
+ unix|win32-g++*:LIBS_PRIVATE += -lpng
+ win32:!win32-g++*:LIBS += libpng.lib
} else {
- DEFINES *= QT_USE_BUNDLED_LIBPNG
+ DEFINES *= QT_USE_BUNDLED_LIBPNG
!isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE
- INCLUDEPATH += ../3rdparty/libpng ../3rdparty/zlib
+ INCLUDEPATH += ../3rdparty/libpng
SOURCES += ../3rdparty/libpng/png.c \
../3rdparty/libpng/pngerror.c \
../3rdparty/libpng/pngget.c \
@@ -114,6 +114,14 @@ SOURCES += \
../3rdparty/libpng/pngwrite.c \
../3rdparty/libpng/pngwtran.c \
../3rdparty/libpng/pngwutil.c
+
+ contains(QT_CONFIG, system-zlib) {
+ symbian:LIBS_PRIVATE += -llibz
+ else:if(unix|win32-g++*):LIBS_PRIVATE += -lz
+ else:LIBS += zdll.lib
+ } else {
+ INCLUDEPATH += ../3rdparty/zlib
+ }
}
} else {
DEFINES *= QT_NO_IMAGEFORMAT_PNG
diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp
index 42e19b8..074b8f0 100644
--- a/src/gui/image/qbmphandler.cpp
+++ b/src/gui/image/qbmphandler.cpp
@@ -674,13 +674,15 @@ bool QBmpHandler::readHeader()
bool QBmpHandler::canRead() const
{
- if (state == Ready) {
- if (!canRead(device()))
- return false;
+ if (state == Ready && !canRead(device()))
+ return false;
+
+ if (state != Error) {
setFormat("bmp");
return true;
}
- return state != Error;
+
+ return false;
}
bool QBmpHandler::canRead(QIODevice *device)
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d89ffe6..bb8a994 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -2274,6 +2274,8 @@ bool QImage::create(const QSize& size, int depth, int numColors, QImage::Endian
typedef void (*Image_Converter)(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags);
+typedef bool (*InPlace_Image_Converter)(QImageData *data, Qt::ImageConversionFlags);
+
static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_ARGB32);
@@ -2298,6 +2300,169 @@ static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt:
}
}
+static bool convert_ARGB_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_ARGB32);
+
+ const int pad = (data->bytes_per_line >> 2) - data->width;
+ QRgb *rgb_data = (QRgb *) data->data;
+
+ for (int i = 0; i < data->height; ++i) {
+ const QRgb *end = rgb_data + data->width;
+ while (rgb_data < end) {
+ *rgb_data = PREMUL(*rgb_data);
+ ++rgb_data;
+ }
+ rgb_data += pad;
+ }
+ data->format = QImage::Format_ARGB32_Premultiplied;
+ return true;
+}
+
+static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 32;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes; // end of src
+ quint32 *dest_data = (quint32 *) (newData + nbytes); // end of dest > end of src
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 2) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ const uint pixel = data->colortable[*src_data];
+ *dest_data = (quint32) PREMUL(pixel);
+ }
+ }
+
+ data->format = QImage::Format_ARGB32_Premultiplied;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_indexed8_to_RGB_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 32;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes;
+ quint32 *dest_data = (quint32 *) (newData + nbytes);
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 2) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ *dest_data = (quint32) data->colortable[*src_data];
+ }
+ }
+
+ data->format = QImage::Format_RGB32;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_indexed8_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_Indexed8);
+ const int depth = 16;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, nbytes);
+ if (!newData)
+ return false;
+
+ data->data = newData;
+
+ // start converting from the end because the end image is bigger than the source
+ uchar *src_data = newData + data->nbytes;
+ quint16 *dest_data = (quint16 *) (newData + nbytes);
+ const int width = data->width;
+ const int src_pad = data->bytes_per_line - width;
+ const int dest_pad = (dst_bytes_per_line >> 1) - width;
+
+ for (int i = 0; i < data->height; ++i) {
+ src_data -= src_pad;
+ dest_data -= dest_pad;
+ for (int pixI = 0; pixI < width; ++pixI) {
+ --src_data;
+ --dest_data;
+ const uint pixel = data->colortable[*src_data];
+ *dest_data = qt_colorConvert<quint16, quint32>(pixel, 0);
+ }
+ }
+
+ data->format = QImage::Format_RGB16;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = nbytes;
+
+ return true;
+}
+
+static bool convert_RGB_to_RGB16_inplace(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_RGB32);
+ const int depth = 16;
+
+ const int dst_bytes_per_line = ((data->width * depth + 31) >> 5) << 2;
+ const int src_bytes_per_line = data->bytes_per_line;
+ quint32 *src_data = (quint32 *) data->data;
+ quint16 *dst_data = (quint16 *) data->data;
+
+ for (int i = 0; i < data->height; ++i) {
+ qt_memconvert(dst_data, src_data, data->width);
+ src_data = (quint32 *) (((char*)src_data) + src_bytes_per_line);
+ dst_data = (quint16 *) (((char*)dst_data) + dst_bytes_per_line);
+ }
+ data->format = QImage::Format_RGB16;
+ data->bytes_per_line = dst_bytes_per_line;
+ data->depth = depth;
+ data->nbytes = dst_bytes_per_line * data->height;
+ uchar *const newData = (uchar *)realloc(data->data, data->nbytes);
+ if (newData) {
+ data->data = newData;
+ return true;
+ } else {
+ return false;
+ }
+}
+
static void convert_ARGB_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied);
@@ -3447,6 +3612,103 @@ static const Image_Converter converter_map[QImage::NImageFormats][QImage::NImage
} // Format_ARGB4444_Premultiplied
};
+static const InPlace_Image_Converter inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
+{
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ },
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_Mono
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_MonoLSB
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_indexed8_to_RGB_inplace,
+ convert_indexed8_to_ARGB_PM_inplace,
+ convert_indexed8_to_RGB16_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_Indexed8
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_RGB_to_RGB16_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_ARGB32
+ {
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ convert_ARGB_to_ARGB_PM_inplace,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ }, // Format_ARGB32
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB32_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB16
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB8565_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB666
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB6666_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB555
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_ARGB8555_Premultiplied
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB888
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ }, // Format_RGB444
+ {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ } // Format_ARGB4444_Premultiplied
+};
+
/*!
Returns a copy of the image in the given \a format.
@@ -4210,6 +4472,7 @@ QImage QImage::createHeuristicMask(bool clipTight) const
int w = width();
int h = height();
QImage m(w, h, Format_MonoLSB);
+ QIMAGE_SANITYCHECK_MEMORY(m);
m.setColorCount(2);
m.setColor(0, QColor(Qt::color0).rgba());
m.setColor(1, QColor(Qt::color1).rgba());
@@ -4302,6 +4565,7 @@ QImage QImage::createMaskFromColor(QRgb color, Qt::MaskMode mode) const
if (!d)
return QImage();
QImage maskImage(size(), QImage::Format_MonoLSB);
+ QIMAGE_SANITYCHECK_MEMORY(maskImage);
maskImage.fill(0);
uchar *s = maskImage.bits();
@@ -4362,6 +4626,7 @@ QImage QImage::mirrored(bool horizontal, bool vertical) const
int h = d->height;
// Create result image, copy colormap
QImage result(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(result);
// check if we ran out of of memory..
if (!result.d)
@@ -4499,6 +4764,7 @@ QImage QImage::rgbSwapped() const
case Format_ARGB32:
case Format_ARGB32_Premultiplied:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
uint *q = (uint*)res.scanLine(i);
uint *p = (uint*)scanLine(i);
@@ -4512,6 +4778,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_RGB16:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
ushort *q = (ushort*)res.scanLine(i);
const ushort *p = (const ushort*)scanLine(i);
@@ -4525,6 +4792,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_ARGB8565_Premultiplied:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
quint8 *p = (quint8*)scanLine(i);
const quint8 *end = p + d->width * sizeof(qargb8565);
@@ -4537,6 +4805,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_RGB666:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
qrgb666 *q = reinterpret_cast<qrgb666*>(res.scanLine(i));
const qrgb666 *p = reinterpret_cast<const qrgb666*>(scanLine(i));
@@ -4549,6 +4818,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_ARGB6666_Premultiplied:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
qargb6666 *q = reinterpret_cast<qargb6666*>(res.scanLine(i));
const qargb6666 *p = reinterpret_cast<const qargb6666*>(scanLine(i));
@@ -4561,6 +4831,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_RGB555:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
ushort *q = (ushort*)res.scanLine(i);
const ushort *p = (const ushort*)scanLine(i);
@@ -4574,6 +4845,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_ARGB8555_Premultiplied:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
quint8 *p = (quint8*)scanLine(i);
const quint8 *end = p + d->width * sizeof(qargb8555);
@@ -4586,6 +4858,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_RGB888:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
@@ -4601,6 +4874,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_RGB444:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
@@ -4615,6 +4889,7 @@ QImage QImage::rgbSwapped() const
break;
case Format_ARGB4444_Premultiplied:
res = QImage(d->width, d->height, d->format);
+ QIMAGE_SANITYCHECK_MEMORY(res);
for (int i = 0; i < d->height; i++) {
quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i));
const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i));
@@ -6263,6 +6538,18 @@ QTransform QImage::trueMatrix(const QTransform &matrix, int w, int h)
return matrix * QTransform().translate(-delta.x(), -delta.y());
}
+bool QImageData::convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags flags)
+{
+ if (format == newFormat)
+ return true;
+
+ const InPlace_Image_Converter *const converterPtr = &inplace_converter_map[format][newFormat];
+ InPlace_Image_Converter converter = *converterPtr;
+ if (converter)
+ return converter(this, flags);
+ else
+ return false;
+}
/*!
\typedef QImage::DataPtr
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 0c19647..f1a0c47 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -96,6 +96,9 @@ struct Q_GUI_EXPORT QImageData { // internal image data
bool checkForAlphaPixels() const;
+ // Convert the image in-place, minimizing memory reallocation
+ // Return false if the conversion cannot be done in-place.
+ bool convertInPlace(QImage::Format newFormat, Qt::ImageConversionFlags);
#ifndef QT_NO_IMAGE_TEXT
QMap<QString, QString> text;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 93d5cd3..af43e90 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -301,7 +301,7 @@ static QImageIOHandler *createReadHandlerHelper(QIODevice *device,
if (!handler && !testFormat.isEmpty()) {
if (false) {
#ifndef QT_NO_IMAGEFORMAT_PNG
- } else if (testFormat == "png") {
+ } else if (testFormat == "png") {
handler = new QPngHandler;
#endif
#ifndef QT_NO_IMAGEFORMAT_BMP
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 20e4b50..fd2c139 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1766,6 +1766,9 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
function returns the actual matrix used for transforming the
pixmap.
+ \note When using the native X11 graphics system, the pixmap
+ becomes invalid when the QApplication instance is destroyed.
+
\sa QBitmap, QImage, QImageReader, QImageWriter
*/
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 9dc15fc..13c03a1 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -47,6 +47,9 @@
#include "qbitmap.h"
#include "qimage.h"
+#include <QBuffer>
+#include <QImageReader>
+#include <private/qsimd_p.h>
#include <private/qwidget_p.h>
#include <private/qdrawhelper_p.h>
@@ -127,91 +130,26 @@ void QRasterPixmapData::resize(int width, int height)
setSerialNumber(image.serialNumber());
}
+bool QRasterPixmapData::fromData(const uchar *buffer, uint len, const char *format,
+ Qt::ImageConversionFlags flags)
+{
+ QByteArray a = QByteArray::fromRawData(reinterpret_cast<const char *>(buffer), len);
+ QBuffer b(&a);
+ b.open(QIODevice::ReadOnly);
+ QImage image = QImageReader(&b, format).read();
+ if (image.isNull())
+ return false;
+
+ createPixmapForImage(image, flags, /* inplace = */true);
+ return !isNull();
+}
+
void QRasterPixmapData::fromImage(const QImage &sourceImage,
Qt::ImageConversionFlags flags)
{
Q_UNUSED(flags);
-
-#ifdef Q_WS_QWS
- QImage::Format format;
- if (pixelType() == BitmapType) {
- format = QImage::Format_Mono;
- } else {
- format = QScreen::instance()->pixelFormat();
- if (format == QImage::Format_Invalid)
- format = QImage::Format_ARGB32_Premultiplied;
- else if (format == QImage::Format_Indexed8) // currently not supported
- format = QImage::Format_RGB444;
- }
-
- if (sourceImage.hasAlphaChannel()
- && ((flags & Qt::NoOpaqueDetection)
- || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
- switch (format) {
- case QImage::Format_RGB16:
- format = QImage::Format_ARGB8565_Premultiplied;
- break;
- case QImage::Format_RGB666:
- format = QImage::Format_ARGB6666_Premultiplied;
- break;
- case QImage::Format_RGB555:
- format = QImage::Format_ARGB8555_Premultiplied;
- break;
- case QImage::Format_RGB444:
- format = QImage::Format_ARGB4444_Premultiplied;
- break;
- default:
- format = QImage::Format_ARGB32_Premultiplied;
- break;
- }
- } else if (format == QImage::Format_Invalid) {
- format = QImage::Format_ARGB32_Premultiplied;
- }
-
- image = sourceImage.convertToFormat(format);
-#else
- if (pixelType() == BitmapType) {
- image = sourceImage.convertToFormat(QImage::Format_MonoLSB);
- } else {
- if (sourceImage.depth() == 1) {
- image = sourceImage.hasAlphaChannel()
- ? sourceImage.convertToFormat(QImage::Format_ARGB32_Premultiplied)
- : sourceImage.convertToFormat(QImage::Format_RGB32);
- } else {
-
- QImage::Format opaqueFormat = QNativeImage::systemFormat();
- QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
-
-#ifndef QT_HAVE_NEON
- switch (opaqueFormat) {
- case QImage::Format_RGB16:
- alphaFormat = QImage::Format_ARGB8565_Premultiplied;
- break;
- default: // We don't care about the others...
- break;
- }
-#endif
-
- if (!sourceImage.hasAlphaChannel()
- || ((flags & Qt::NoOpaqueDetection) == 0
- && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
- image = sourceImage.convertToFormat(opaqueFormat);
- } else {
- image = sourceImage.convertToFormat(alphaFormat);
- }
- }
- }
-#endif
- if (image.d) {
- w = image.d->width;
- h = image.d->height;
- d = image.d->depth;
- } else {
- w = h = d = 0;
- }
- is_null = (w <= 0 || h <= 0);
-
- setSerialNumber(image.serialNumber());
+ QImage image = sourceImage;
+ createPixmapForImage(image, flags, /* inplace = */false);
}
// from qwindowsurface.cpp
@@ -240,7 +178,7 @@ void QRasterPixmapData::fill(const QColor &color)
if (alpha != 255) {
if (!image.hasAlphaChannel()) {
QImage::Format toFormat;
-#ifndef QT_HAVE_NEON
+#if !(defined(QT_HAVE_NEON) || defined(QT_ALWAYS_HAVE_SSE2))
if (image.format() == QImage::Format_RGB16)
toFormat = QImage::Format_ARGB8565_Premultiplied;
else if (image.format() == QImage::Format_RGB666)
@@ -398,6 +336,105 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
return 0;
}
+void QRasterPixmapData::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace)
+{
+ QImage::Format format;
+#ifdef Q_WS_QWS
+ if (pixelType() == BitmapType) {
+ format = QImage::Format_Mono;
+ } else {
+ format = QScreen::instance()->pixelFormat();
+ if (format == QImage::Format_Invalid)
+ format = QImage::Format_ARGB32_Premultiplied;
+ else if (format == QImage::Format_Indexed8) // currently not supported
+ format = QImage::Format_RGB444;
+ }
+
+ if (sourceImage.hasAlphaChannel()
+ && ((flags & Qt::NoOpaqueDetection)
+ || const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())) {
+ switch (format) {
+ case QImage::Format_RGB16:
+ format = QImage::Format_ARGB8565_Premultiplied;
+ break;
+ case QImage::Format_RGB666:
+ format = QImage::Format_ARGB6666_Premultiplied;
+ break;
+ case QImage::Format_RGB555:
+ format = QImage::Format_ARGB8555_Premultiplied;
+ break;
+ case QImage::Format_RGB444:
+ format = QImage::Format_ARGB4444_Premultiplied;
+ break;
+ default:
+ format = QImage::Format_ARGB32_Premultiplied;
+ break;
+ }
+ } else if (format == QImage::Format_Invalid) {
+ format = QImage::Format_ARGB32_Premultiplied;
+ }
+#else
+ if (pixelType() == BitmapType) {
+ format = QImage::Format_MonoLSB;
+ } else {
+ if (sourceImage.depth() == 1) {
+ format = sourceImage.hasAlphaChannel()
+ ? QImage::Format_ARGB32_Premultiplied
+ : QImage::Format_RGB32;
+ } else {
+ QImage::Format opaqueFormat = QNativeImage::systemFormat();
+ QImage::Format alphaFormat = QImage::Format_ARGB32_Premultiplied;
+
+#if !defined(QT_HAVE_NEON) && !defined(QT_ALWAYS_HAVE_SSE2)
+ switch (opaqueFormat) {
+ case QImage::Format_RGB16:
+ alphaFormat = QImage::Format_ARGB8565_Premultiplied;
+ break;
+ default: // We don't care about the others...
+ break;
+ }
+#endif
+
+ if (!sourceImage.hasAlphaChannel()) {
+ format = opaqueFormat;
+ } else if ((flags & Qt::NoOpaqueDetection) == 0
+ && !const_cast<QImage &>(sourceImage).data_ptr()->checkForAlphaPixels())
+ {
+ // image has alpha format but is really opaque, so try to do a
+ // more efficient conversion
+ if (sourceImage.format() == QImage::Format_ARGB32
+ || sourceImage.format() == QImage::Format_ARGB32_Premultiplied)
+ {
+ if (!inPlace)
+ sourceImage.detach();
+ sourceImage.d->format = QImage::Format_RGB32;
+ }
+ format = opaqueFormat;
+ } else {
+ format = alphaFormat;
+ }
+ }
+ }
+#endif
+
+ if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
+ image = sourceImage;
+ } else {
+ image = sourceImage.convertToFormat(format);
+ }
+
+ if (image.d) {
+ w = image.d->width;
+ h = image.d->height;
+ d = image.d->depth;
+ } else {
+ w = h = d = 0;
+ }
+ is_null = (w <= 0 || h <= 0);
+
+ setSerialNumber(image.serialNumber());
+}
+
QImage* QRasterPixmapData::buffer()
{
return &image;
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 6cdd3d7..d7e3f85 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -72,6 +72,7 @@ public:
void resize(int width, int height);
void fromFile(const QString &filename, Qt::ImageConversionFlags flags);
+ bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags);
void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
bool scroll(int dx, int dy, const QRect &rect);
@@ -85,6 +86,8 @@ public:
protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const;
+ void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
+ void setImage(const QImage &image);
QImage image;
private:
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 6bebefc..e8dc5ae 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -1250,10 +1250,8 @@ void QX11PixmapData::release()
pengine = 0;
if (!X11) {
-#ifndef QT_NO_DEBUG
- qWarning("~QX11PixmapData(): QPixmap objects must be destroyed before the QApplication"
- " object, otherwise the native pixmap object will be leaked.");
-#endif
+ // At this point, the X server will already have freed our resources,
+ // so there is nothing to do.
return;
}
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 7a6a73f..ca21a0c 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -196,9 +196,10 @@ public:
static QPixmapCache::KeyData* getKeyData(QPixmapCache::Key *key);
QList< QPair<QString,QPixmap> > allPixmaps() const;
- void flushDetachedPixmaps(bool nt);
+ bool flushDetachedPixmaps(bool nt);
private:
+ enum { soon_time = 10000, flush_time = 30000 };
int *keyArray;
int theid;
int ps;
@@ -236,38 +237,44 @@ QPMCache::~QPMCache()
cleaning-up, and to not cut down the size of the cache while the
cache is in active use.
- When the last pixmap has been deleted from the cache, kill the
- timer so Qt won't keep the CPU from going into sleep mode.
+ When the last detached pixmap has been deleted from the cache, kill the
+ timer so Qt won't keep the CPU from going into sleep mode. Currently
+ the timer is not restarted when the pixmap becomes unused, but it does
+ restart once something else is added (i.e. the cache space is actually needed).
+
+ Returns true if any were removed.
*/
-void QPMCache::flushDetachedPixmaps(bool nt)
+bool QPMCache::flushDetachedPixmaps(bool nt)
{
int mc = maxCost();
setMaxCost(nt ? totalCost() * 3 / 4 : totalCost() -1);
setMaxCost(mc);
ps = totalCost();
+ bool any = false;
QHash<QString, QPixmapCache::Key>::iterator it = cacheKeys.begin();
while (it != cacheKeys.end()) {
if (!contains(it.value())) {
releaseKey(it.value());
it = cacheKeys.erase(it);
+ any = true;
} else {
++it;
}
}
+
+ return any;
}
void QPMCache::timerEvent(QTimerEvent *)
{
bool nt = totalCost() == ps;
- flushDetachedPixmaps(nt);
-
- if (!size()) {
+ if (!flushDetachedPixmaps(nt)) {
killTimer(theid);
theid = 0;
} else if (nt != t) {
killTimer(theid);
- theid = startTimer(nt ? 10000 : 30000);
+ theid = startTimer(nt ? soon_time : flush_time);
t = nt;
}
}
@@ -315,7 +322,7 @@ bool QPMCache::insert(const QString& key, const QPixmap &pixmap, int cost)
if (success) {
cacheKeys.insert(key, cacheKey);
if (!theid) {
- theid = startTimer(30000);
+ theid = startTimer(flush_time);
t = false;
}
} else {
@@ -331,7 +338,7 @@ QPixmapCache::Key QPMCache::insert(const QPixmap &pixmap, int cost)
bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
if (success) {
if (!theid) {
- theid = startTimer(30000);
+ theid = startTimer(flush_time);
t = false;
}
} else {
@@ -352,7 +359,7 @@ bool QPMCache::replace(const QPixmapCache::Key &key, const QPixmap &pixmap, int
bool success = QCache<QPixmapCache::Key, QPixmapCacheEntry>::insert(cacheKey, new QPixmapCacheEntry(cacheKey, pixmap), cost);
if (success) {
if(!theid) {
- theid = startTimer(30000);
+ theid = startTimer(flush_time);
t = false;
}
const_cast<QPixmapCache::Key&>(key) = cacheKey;
diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp
index ea4fe6b..31ca909 100644
--- a/src/gui/image/qpixmapdata.cpp
+++ b/src/gui/image/qpixmapdata.cpp
@@ -146,7 +146,7 @@ bool QPixmapData::fromData(const uchar *buf, uint len, const char *format, Qt::I
void QPixmapData::copy(const QPixmapData *data, const QRect &rect)
{
- fromImage(data->toImage().copy(rect), Qt::AutoColor);
+ fromImage(data->toImage().copy(rect), Qt::NoOpaqueDetection);
}
bool QPixmapData::scroll(int dx, int dy, const QRect &rect)
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index dd31834..2cf8222 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -892,13 +892,15 @@ QPngHandler::~QPngHandler()
bool QPngHandler::canRead() const
{
- if (d->state == QPngHandlerPrivate::Ready) {
- if (!canRead(device()))
- return false;
+ if (d->state == QPngHandlerPrivate::Ready && !canRead(device()))
+ return false;
+
+ if (d->state != QPngHandlerPrivate::Error) {
setFormat("png");
return true;
}
- return d->state != QPngHandlerPrivate::Error;
+
+ return false;
}
bool QPngHandler::canRead(QIODevice *device)
diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp
index cbbbef4..a9e796c 100644
--- a/src/gui/image/qppmhandler.cpp
+++ b/src/gui/image/qppmhandler.cpp
@@ -409,13 +409,15 @@ bool QPpmHandler::readHeader()
bool QPpmHandler::canRead() const
{
- if (state == Ready) {
- if (!canRead(device(), &subType))
- return false;
+ if (state == Ready && !canRead(device(), &subType))
+ return false;
+
+ if (state != Error) {
setFormat(subType);
return true;
}
- return state != Error;
+
+ return false;
}
bool QPpmHandler::canRead(QIODevice *device, QByteArray *subType)
diff --git a/src/gui/image/qxbmhandler.cpp b/src/gui/image/qxbmhandler.cpp
index 385340a..0dd4e99 100644
--- a/src/gui/image/qxbmhandler.cpp
+++ b/src/gui/image/qxbmhandler.cpp
@@ -261,13 +261,15 @@ bool QXbmHandler::readHeader()
bool QXbmHandler::canRead() const
{
- if (state == Ready) {
- if (!canRead(device()))
- return false;
+ if (state == Ready && !canRead(device()))
+ return false;
+
+ if (state != Error) {
setFormat("xbm");
return true;
}
- return state != Error;
+
+ return false;
}
bool QXbmHandler::canRead(QIODevice *device)
diff --git a/src/gui/image/qxpmhandler.cpp b/src/gui/image/qxpmhandler.cpp
index a475cd0..b97afd3 100644
--- a/src/gui/image/qxpmhandler.cpp
+++ b/src/gui/image/qxpmhandler.cpp
@@ -1225,11 +1225,15 @@ bool QXpmHandler::readImage(QImage *image)
bool QXpmHandler::canRead() const
{
- if (state == Ready && canRead(device())) {
+ if (state == Ready && !canRead(device()))
+ return false;
+
+ if (state != Error) {
setFormat("xpm");
return true;
}
- return state != Error;
+
+ return false;
}
bool QXpmHandler::canRead(QIODevice *device)
diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp
index d048b36..ed5aa23 100644
--- a/src/gui/inputmethod/qximinputcontext_x11.cpp
+++ b/src/gui/inputmethod/qximinputcontext_x11.cpp
@@ -346,10 +346,7 @@ static XFontSet getFontSet(const QFont &f)
extern bool qt_use_rtl_extensions; // from qapplication_x11.cpp
#ifndef QT_NO_XKB
-extern void q_getLocaleAndDirection(QLocale *locale,
- Qt::LayoutDirection *direction,
- const QByteArray &layoutName,
- const QByteArray &variantName);
+extern QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName);
#endif
QXIMInputContext::QXIMInputContext()
@@ -407,17 +404,12 @@ QXIMInputContext::QXIMInputContext()
QList<QByteArray> layoutNames = QByteArray::fromRawData(names[2], qstrlen(names[2])).split(',');
QList<QByteArray> variantNames = QByteArray::fromRawData(names[3], qstrlen(names[3])).split(',');
for (int i = 0; i < qMin(layoutNames.count(), variantNames.count()); ++i ) {
- QLocale keyboardInputLocale;
- Qt::LayoutDirection keyboardInputDirection;
QByteArray variantName = variantNames.at(i);
const int dashPos = variantName.indexOf("-");
if (dashPos >= 0)
variantName.truncate(dashPos);
- q_getLocaleAndDirection(&keyboardInputLocale,
- &keyboardInputDirection,
- layoutNames.at(i),
- variantName);
- if (keyboardInputDirection == Qt::RightToLeft)
+ QLocale keyboardInputLocale = q_getKeyboardLocale(layoutNames.at(i), variantName);
+ if (keyboardInputLocale.textDirection() == Qt::RightToLeft)
qt_use_rtl_extensions = true;
}
}
diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp
index 775bf7d..0ea6d67 100644
--- a/src/gui/itemviews/qabstractitemdelegate.cpp
+++ b/src/gui/itemviews/qabstractitemdelegate.cpp
@@ -291,8 +291,14 @@ void QAbstractItemDelegate::updateEditorGeometry(QWidget *,
}
/*!
- Whenever an event occurs, this function is called with the \a event
- \a model \a option and the \a index that corresponds to the item being edited.
+ When editing of an item starts, this function is called with the
+ \a event that triggered the editing, the \a model, the \a index of
+ the item, and the \a option used for rendering the item.
+
+ Mouse events are sent to editorEvent() even if they don't start
+ editing of the item. This can, for instance, be useful if you wish
+ to open a context menu when the right mouse button is pressed on
+ an item.
The base implementation returns false (indicating that it has not
handled the event).
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 0e06f34..8f55734 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -1472,6 +1472,10 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after
/*!
Destroys this tree widget item.
+
+ The item will be removed from \l{QTreeWidget}s to which it has
+ been added. This makes it safe to delete an item at any time.
+
*/
QTreeWidgetItem::~QTreeWidgetItem()
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 72e5c58..4f557d6 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -146,7 +146,7 @@ static void initResources()
QT_BEGIN_NAMESPACE
-Q_DECL_IMPORT extern void qt_call_post_routines();
+Q_CORE_EXPORT void qt_call_post_routines();
QApplication::Type qt_appType=QApplication::Tty;
QApplicationPrivate *QApplicationPrivate::self = 0;
@@ -3542,7 +3542,7 @@ int QApplication::startDragDistance()
void QApplication::setLayoutDirection(Qt::LayoutDirection direction)
{
- if (layout_direction == direction)
+ if (layout_direction == direction || direction == Qt::LayoutDirectionAuto)
return;
layout_direction = direction;
@@ -5306,6 +5306,7 @@ void QApplication::setInputContext(QInputContext *inputContext)
}
delete QApplicationPrivate::inputContext;
QApplicationPrivate::inputContext = inputContext;
+ QApplicationPrivate::inputContext->setParent(this);
}
/*!
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 9f47112..0b00808 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -1441,6 +1441,8 @@ void qt_init(QApplicationPrivate * /* priv */, int)
qRegisterMetaType<WId>("WId");
}
+extern void qt_cleanup_symbianFontDatabaseExtras(); // qfontdatabase_s60.cpp
+
/*****************************************************************************
qt_cleanup() - cleans up when the application is finished
*****************************************************************************/
@@ -1451,6 +1453,7 @@ void qt_cleanup()
qt_S60Beep = 0;
}
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
+ qt_cleanup_symbianFontDatabaseExtras();
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
// It's important that this happens here, before the event dispatcher gets
@@ -2196,4 +2199,29 @@ void QApplication::restoreOverrideCursor()
#endif // QT_NO_CURSOR
+QS60ThreadLocalData::QS60ThreadLocalData()
+{
+ CCoeEnv *env = CCoeEnv::Static();
+ if (env) {
+ //if this is the UI thread, share objects owned by CONE
+ usingCONEinstances = true;
+ wsSession = env->WsSession();
+ screenDevice = env->ScreenDevice();
+ }
+ else {
+ usingCONEinstances = false;
+ qt_symbian_throwIfError(wsSession.Connect(qt_s60GetRFs()));
+ screenDevice = new CWsScreenDevice(wsSession);
+ screenDevice->Construct();
+ }
+}
+
+QS60ThreadLocalData::~QS60ThreadLocalData()
+{
+ if (!usingCONEinstances) {
+ delete screenDevice;
+ wsSession.Close();
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index e10a6b0..1af45ba 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -118,8 +118,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
# include <winable.h>
#endif
-#include "private/qwinnativepangesturerecognizer_win_p.h"
-
#ifndef WM_TOUCH
# define WM_TOUCH 0x0240
@@ -955,6 +953,9 @@ const QString qt_reg_winclass(QWidget *w) // register window class
if (qt_widget_private(w)->isGLWidget) {
cname = QLatin1String("QGLWidget");
style = CS_DBLCLKS;
+#ifndef Q_WS_WINCE
+ style |= CS_OWNDC;
+#endif
icon = true;
} else if (flags & Qt::MSWindowsOwnDC) {
cname = QLatin1String("QWidgetOwnDC");
@@ -3062,6 +3063,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
break;
}
}
+#ifndef Q_OS_WINCE
+ static bool trackMouseEventLookup = false;
+ typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
+ static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
+#endif
state = translateButtonState(msg.wParam, type, button); // button state
const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y));
QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos);
@@ -3126,9 +3132,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
#ifndef Q_OS_WINCE
if (curWin != 0) {
- static bool trackMouseEventLookup = false;
- typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT);
- static PtrTrackMouseEvent ptrTrackMouseEvent = 0;
if (!trackMouseEventLookup) {
trackMouseEventLookup = true;
ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
@@ -3242,6 +3245,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
qt_button_down = 0;
}
+#ifndef Q_OS_WINCE
+ if (type == QEvent::MouseButtonPress
+ && QApplication::activePopupWidget() != activePopupWidget
+ && ptrTrackMouseEvent
+ && curWin) {
+ // Since curWin is already the window we clicked on,
+ // we have to setup the mouse tracking here.
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(TRACKMOUSEEVENT);
+ tme.dwFlags = 0x00000002; // TME_LEAVE
+ tme.hwndTrack = curWin; // Track on window receiving msgs
+ tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT
+ ptrTrackMouseEvent(&tme);
+ }
+#endif
if (type == QEvent::MouseButtonPress
&& QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {
@@ -4062,36 +4080,9 @@ PtrCloseTouchInputHandle QApplicationPrivate::CloseTouchInputHandle = 0;
void QApplicationPrivate::initializeMultitouch_sys()
{
- static const IID QT_IID_IInkTablets = {0x112086D9, 0x7779, 0x4535, {0xA6, 0x99, 0x86, 0x2B, 0x43, 0xAC, 0x18, 0x63} };
- static const IID QT_IID_IInkTablet2 = {0x90c91ad2, 0xfa36, 0x49d6, {0x95, 0x16, 0xce, 0x8d, 0x57, 0x0f, 0x6f, 0x85} };
- static const CLSID QT_CLSID_InkTablets = {0x6E4FCB12, 0x510A, 0x4d40, {0x93, 0x04, 0x1D, 0xA1, 0x0A, 0xE9, 0x14, 0x7C} };
-
- IInkTablets *iInkTablets = 0;
- HRESULT hr = CoCreateInstance(QT_CLSID_InkTablets, NULL, CLSCTX_ALL, QT_IID_IInkTablets, (void**)&iInkTablets);
- if (SUCCEEDED(hr)) {
- long count = 0;
- iInkTablets->get_Count(&count);
- for (long i = 0; i < count; ++i) {
- IInkTablet *iInkTablet = 0;
- hr = iInkTablets->Item(i, &iInkTablet);
- if (FAILED(hr))
- continue;
- IInkTablet2 *iInkTablet2 = 0;
- hr = iInkTablet->QueryInterface(QT_IID_IInkTablet2, (void**)&iInkTablet2);
- iInkTablet->Release();
- if (FAILED(hr))
- continue;
- TabletDeviceKind kind;
- hr = iInkTablet2->get_DeviceKind(&kind);
- iInkTablet2->Release();
- if (FAILED(hr))
- continue;
- if (kind == TDK_Touch) {
- QApplicationPrivate::HasTouchSupport = true;
- break;
- }
- }
- iInkTablets->Release();
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_WINDOWS7) {
+ static const int QT_SM_DIGITIZER = 94;
+ QApplicationPrivate::HasTouchSupport = GetSystemMetrics(QT_SM_DIGITIZER);
}
QLibrary library(QLatin1String("user32"));
diff --git a/src/gui/kernel/qclipboard_x11.cpp b/src/gui/kernel/qclipboard_x11.cpp
index 3bdc971..9fcc718 100644
--- a/src/gui/kernel/qclipboard_x11.cpp
+++ b/src/gui/kernel/qclipboard_x11.cpp
@@ -1518,7 +1518,7 @@ bool qt_xfixes_selection_changed(Window selectionOwner, Time timestamp)
(unsigned int)(d ? d->timestamp : 0), (unsigned int)timestamp);
#endif
if (!owner || (selectionOwner && selectionOwner != owner->internalWinId()) ||
- (!selectionOwner && d->timestamp != CurrentTime && d->timestamp < timestamp))
+ (!selectionOwner && (d->timestamp == CurrentTime || d->timestamp < timestamp)))
return qt_check_selection_sentinel();
return false;
}
@@ -1532,7 +1532,7 @@ bool qt_xfixes_clipboard_changed(Window clipboardOwner, Time timestamp)
(unsigned int)(d ? d->timestamp : 0), (unsigned int)timestamp);
#endif
if (!owner || (clipboardOwner && clipboardOwner != owner->internalWinId()) ||
- (!clipboardOwner && d->timestamp != CurrentTime && d->timestamp < timestamp))
+ (!clipboardOwner && (d->timestamp == CurrentTime || d->timestamp < timestamp)))
return qt_check_clipboard_sentinel();
return false;
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 10ff365..3665557 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -1585,6 +1585,8 @@ Qt::DropAction QDragManager::drag(QDrag *o)
}
}
}
+ o->setMimeData(0);
+ o->deleteLater();
return performedAction;
}
diff --git a/src/gui/kernel/qdesktopwidget.qdoc b/src/gui/kernel/qdesktopwidget.qdoc
index 571c32b..2d72bf9 100644
--- a/src/gui/kernel/qdesktopwidget.qdoc
+++ b/src/gui/kernel/qdesktopwidget.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qdnd_mac.mm b/src/gui/kernel/qdnd_mac.mm
index 189d535..844f5e3 100644
--- a/src/gui/kernel/qdnd_mac.mm
+++ b/src/gui/kernel/qdnd_mac.mm
@@ -675,6 +675,8 @@ Qt::DropAction QDragManager::drag(QDrag *o)
}
if (atleastOne){
DisposeDrag(dragRef);
+ o->setMimeData(0);
+ o->deleteLater();
return action;
}
}
@@ -682,6 +684,8 @@ Qt::DropAction QDragManager::drag(QDrag *o)
DragActions ret = kDragActionNothing;
GetDragDropAction(dragRef, &ret);
DisposeDrag(dragRef); //cleanup
+ o->setMimeData(0);
+ o->deleteLater();
return qt_mac_dnd_map_mac_default_action(ret);
}
DisposeDrag(dragRef); //cleanup
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 2af031b..e43a560 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -286,6 +286,9 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
// check if a running gesture switched back to maybe state
QSet<QGesture *> activeToMaybeGestures = m_activeGestures & newMaybeGestures;
+ // check if a maybe gesture switched to canceled - reset it but don't send an event
+ QSet<QGesture *> maybeToCanceledGestures = m_maybeGestures & notGestures;
+
// check if a running gesture switched back to not gesture state,
// i.e. were canceled
QSet<QGesture *> canceledGestures = m_activeGestures & notGestures;
@@ -345,7 +348,8 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
<< "\n\tstarted:" << startedGestures
<< "\n\ttriggered:" << triggeredGestures
<< "\n\tfinished:" << finishedGestures
- << "\n\tcanceled:" << canceledGestures;
+ << "\n\tcanceled:" << canceledGestures
+ << "\n\tmaybe-canceled:" << maybeToCanceledGestures;
}
QSet<QGesture *> undeliveredGestures;
@@ -366,7 +370,7 @@ bool QGestureManager::filterEventThroughContexts(const QMultiMap<QObject *,
// reset gestures that ended
QSet<QGesture *> endedGestures =
- finishedGestures + canceledGestures + undeliveredGestures;
+ finishedGestures + canceledGestures + undeliveredGestures + maybeToCanceledGestures;
foreach (QGesture *gesture, endedGestures) {
recycle(gesture);
m_gestureTargets.remove(gesture);
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index a7145d4..3dc6afc 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -672,23 +672,7 @@ QKeyMapperPrivate::updateKeyboard()
#endif
if (iso639Code) {
keyboardInputLocale = QLocale(QCFString::toQString(iso639Code));
- QString monday = keyboardInputLocale.dayName(1);
- bool rtl = false;
- for (int i = 0; i < monday.length(); ++i) {
- switch (monday.at(i).direction()) {
- default:
- break;
- case QChar::DirR:
- case QChar::DirAL:
- case QChar::DirRLE:
- case QChar::DirRLO:
- rtl = true;
- break;
- }
- if (rtl)
- break;
- }
- keyboardInputDirection = rtl ? Qt::RightToLeft : Qt::LeftToRight;
+ keyboardInputDirection = keyboardInputLocale.textDirection();
} else {
keyboardInputLocale = QLocale::c();
keyboardInputDirection = Qt::LeftToRight;
@@ -882,14 +866,27 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
UInt32 macModifiers = 0;
GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
sizeof(macModifiers), 0, &macModifiers);
+#ifdef QT_MAC_USE_COCOA
+ // The unicode characters in the range 0xF700-0xF747 are reserved
+ // by Mac OS X for transient use as keyboard function keys. We
+ // wont send 'text' for such key events. This is done to match
+ // behavior on other platforms.
+ unsigned int *unicodeKey = (unsigned int*)info;
+ if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747)
+ text = QString();
+ bool isAccepted;
+#endif
handled_event = QKeyMapper::sendKeyEvent(widget, grab,
(ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress,
qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0,
macScanCode, macVirtualKey, macModifiers
#ifdef QT_MAC_USE_COCOA
- ,static_cast<bool *>(info)
+ ,&isAccepted
#endif
);
+#ifdef QT_MAC_USE_COCOA
+ *unicodeKey = (unsigned int)isAccepted;
+#endif
}
return handled_event;
}
diff --git a/src/gui/kernel/qkeymapper_qws.cpp b/src/gui/kernel/qkeymapper_qws.cpp
index 5b6b1c4..63bb46b 100644
--- a/src/gui/kernel/qkeymapper_qws.cpp
+++ b/src/gui/kernel/qkeymapper_qws.cpp
@@ -52,7 +52,7 @@ QT_USE_NAMESPACE
QKeyMapperPrivate::QKeyMapperPrivate()
{
keyboardInputLocale = QLocale::system();
- keyboardInputDirection = Qt::RightToLeft;
+ keyboardInputDirection = keyboardInputLocale.textDirection();
}
QKeyMapperPrivate::~QKeyMapperPrivate()
diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp
index 807959c..825edbc 100644
--- a/src/gui/kernel/qkeymapper_x11.cpp
+++ b/src/gui/kernel/qkeymapper_x11.cpp
@@ -80,22 +80,15 @@ QT_BEGIN_NAMESPACE
(((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF))
#endif
-void q_getLocaleAndDirection(QLocale *locale,
- Qt::LayoutDirection *direction,
- const QByteArray &layoutName,
- const QByteArray &variantName)
+QLocale q_getKeyboardLocale(const QByteArray &layoutName, const QByteArray &variantName)
{
int i = 0;
while (xkbLayoutData[i].layout != 0) {
- if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant) {
- *locale = QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
- *direction = xkbLayoutData[i].direction;
- return;
- }
+ if (layoutName == xkbLayoutData[i].layout && variantName == xkbLayoutData[i].variant)
+ return QLocale(xkbLayoutData[i].language, xkbLayoutData[i].country);
++i;
}
- *locale = QLocale::c();
- *direction = Qt::LeftToRight;
+ return QLocale::c();
}
#endif // QT_NO_XKB
@@ -523,10 +516,8 @@ void QKeyMapperPrivate::clearMappings()
// if (keyboardLayoutName.isEmpty())
// qWarning("Qt: unable to determine keyboard layout, please talk to qt-bugs@trolltech.com"); ?
- q_getLocaleAndDirection(&keyboardInputLocale,
- &keyboardInputDirection,
- layoutName,
- variantName);
+ keyboardInputLocale = q_getKeyboardLocale(layoutName, variantName);
+ keyboardInputDirection = keyboardInputLocale.textDirection();
#if 0
qDebug() << "keyboard input locale ="
diff --git a/src/gui/kernel/qkeymapper_x11_p.cpp b/src/gui/kernel/qkeymapper_x11_p.cpp
index 20fcc86..6308973 100644
--- a/src/gui/kernel/qkeymapper_x11_p.cpp
+++ b/src/gui/kernel/qkeymapper_x11_p.cpp
@@ -271,13 +271,13 @@ static struct {
// name = is:nodeadkeys, description = Iceland
{ "is", "nodeadkeys", Qt::LeftToRight, QLocale::Icelandic, QLocale::Iceland },
// name = il, description = Israel
- { "il", "", Qt::LeftToRight, QLocale::Hebrew, QLocale::Israel },
+ { "il", "", Qt::RightToLeft, QLocale::Hebrew, QLocale::Israel },
// name = il:lyx, description = Israel
- { "il", "lyx", Qt::LeftToRight, QLocale::Hebrew, QLocale::Israel },
+ { "il", "lyx", Qt::RightToLeft, QLocale::Hebrew, QLocale::Israel },
// name = il:si1452, description = Israel
- { "il", "si1452", Qt::LeftToRight, QLocale::Hebrew, QLocale::Israel },
+ { "il", "si1452", Qt::RightToLeft, QLocale::Hebrew, QLocale::Israel },
// name = il:phonetic, description = Israel
- { "il", "phonetic", Qt::LeftToRight, QLocale::Hebrew, QLocale::Israel },
+ { "il", "phonetic", Qt::RightToLeft, QLocale::Hebrew, QLocale::Israel },
// name = it, description = Italy
{ "it", "", Qt::LeftToRight, QLocale::Italian, QLocale::Italy },
// name = it:nodeadkeys, description = Italy
@@ -419,11 +419,11 @@ static struct {
// name = ch:fr_sundeadkeys, description = Switzerland
{ "ch", "fr_sundeadkeys", Qt::LeftToRight, QLocale::French, QLocale::Switzerland },
// name = sy, description = Syria
- { "sy", "", Qt::RightToLeft, QLocale::Arabic, QLocale::SyrianArabRepublic },
+ { "sy", "", Qt::RightToLeft, QLocale::Syriac, QLocale::SyrianArabRepublic },
// name = sy:syc, description = Syria
- { "sy", "syc", Qt::RightToLeft, QLocale::Arabic, QLocale::SyrianArabRepublic },
+ { "sy", "syc", Qt::RightToLeft, QLocale::Syriac, QLocale::SyrianArabRepublic },
// name = sy:syc_phonetic, description = Syria
- { "sy", "syc_phonetic", Qt::RightToLeft, QLocale::Arabic, QLocale::SyrianArabRepublic },
+ { "sy", "syc_phonetic", Qt::RightToLeft, QLocale::Syriac, QLocale::SyrianArabRepublic },
// name = tj, description = Tajikistan
{ "tj", "", Qt::LeftToRight, QLocale::Tajik, QLocale::Tajikistan },
// name = lk, description = Sri Lanka
diff --git a/src/gui/kernel/qsizepolicy.qdoc b/src/gui/kernel/qsizepolicy.qdoc
index 292e029..7cd05c5 100644
--- a/src/gui/kernel/qsizepolicy.qdoc
+++ b/src/gui/kernel/qsizepolicy.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/kernel/qstandardgestures.cpp b/src/gui/kernel/qstandardgestures.cpp
index 6960838..8a3e89e 100644
--- a/src/gui/kernel/qstandardgestures.cpp
+++ b/src/gui/kernel/qstandardgestures.cpp
@@ -112,6 +112,7 @@ QGestureRecognizer::Result QPanGestureRecognizer::recognize(QGesture *state,
p1.pos().y() - p1.startPos().y() + p2.pos().y() - p2.startPos().y()) / 2;
if (d->offset.x() > 10 || d->offset.y() > 10 ||
d->offset.x() < -10 || d->offset.y() < -10) {
+ q->setHotSpot(p1.startScreenPos());
result = QGestureRecognizer::TriggerGesture;
} else {
result = QGestureRecognizer::MayBeGesture;
@@ -441,6 +442,7 @@ QGestureRecognizer::Result QTapGestureRecognizer::recognize(QGesture *state,
switch (event->type()) {
case QEvent::TouchBegin: {
d->position = ev->touchPoints().at(0).pos();
+ q->setHotSpot(ev->touchPoints().at(0).screenPos());
result = QGestureRecognizer::TriggerGesture;
break;
}
@@ -523,6 +525,7 @@ QTapAndHoldGestureRecognizer::recognize(QGesture *state, QObject *object,
if (d->timerId)
q->killTimer(d->timerId);
d->timerId = q->startTimer(TimerInterval);
+ q->setHotSpot(ev->touchPoints().at(0).startScreenPos());
result = QGestureRecognizer::TriggerGesture;
break;
case QEvent::TouchEnd:
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index de4e125..e3478e6 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -719,10 +719,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
NSEvent *event = static_cast<NSEvent *>(keyEvent);
EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef]));
Q_ASSERT(key_event);
+ unsigned int info = 0;
if ([event type] == NSKeyDown) {
NSString *characters = [event characters];
unichar value = [characters characterAtIndex:0];
qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value);
+ info = value;
}
// Redirect keys to alien widgets.
@@ -738,9 +740,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve
if (mustUseCocoaKeyEvent())
return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent);
- bool isAccepted;
- bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true);
- return consumed && isAccepted;
+ bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true);
+ return consumed && (info != 0);
#endif
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index fe3fa57..204e38c 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -63,6 +63,7 @@
#include "qpointer.h"
#include "qapplication.h"
#include "qelapsedtimer.h"
+#include "QtCore/qthreadstorage.h"
#include <w32std.h>
#include <coecntrl.h>
#include <eikenv.h>
@@ -86,10 +87,21 @@ const TInt KInternalStatusPaneChange = 0x50000000;
//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
+class QS60ThreadLocalData
+{
+public:
+ QS60ThreadLocalData();
+ ~QS60ThreadLocalData();
+ bool usingCONEinstances;
+ RWsSession wsSession;
+ CWsScreenDevice *screenDevice;
+};
+
class QS60Data
{
public:
QS60Data();
+ QThreadStorage<QS60ThreadLocalData *> tls;
TUid uid;
int screenDepth;
QPoint lastCursorPos;
@@ -132,9 +144,9 @@ public:
int memoryLimitForHwRendering;
QApplication::QS60MainApplicationFactory s60ApplicationFactory; // typedef'ed pointer type
static inline void updateScreenSize();
- static inline RWsSession& wsSession();
+ inline RWsSession& wsSession();
static inline RWindowGroup& windowGroup();
- static inline CWsScreenDevice* screenDevice();
+ inline CWsScreenDevice* screenDevice();
static inline CCoeAppUi* appUi();
static inline CEikMenuBar* menuBar();
#ifdef Q_WS_S60
@@ -241,8 +253,35 @@ private:
};
inline QS60Data::QS60Data()
+: uid(TUid::Null()),
+ screenDepth(0),
+ screenWidthInPixels(0),
+ screenHeightInPixels(0),
+ screenWidthInTwips(0),
+ screenHeightInTwips(0),
+ defaultDpiX(0),
+ defaultDpiY(0),
+ curWin(0),
+ virtualMousePressedKeys(0),
+ virtualMouseAccelDX(0),
+ virtualMouseAccelDY(0),
+ virtualMouseMaxAccel(0),
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ brokenPointerCursors(0),
+#endif
+ hasTouchscreen(0),
+ mouseInteractionEnabled(0),
+ virtualMouseRequired(0),
+ qtOwnsS60Environment(0),
+ supportsPremultipliedAlpha(0),
+ avkonComponentsSupportTransparency(0),
+ menuBeingConstructed(0),
+ memoryLimitForHwRendering(0),
+ s60ApplicationFactory(0),
+#ifdef Q_WS_S60
+ s60InstalledTrapHandler(0)
+#endif
{
- memclr(this, sizeof(QS60Data)); //zero init data
}
inline void QS60Data::updateScreenSize()
@@ -265,7 +304,10 @@ inline void QS60Data::updateScreenSize()
inline RWsSession& QS60Data::wsSession()
{
- return CCoeEnv::Static()->WsSession();
+ if(!tls.hasLocalData()) {
+ tls.setLocalData(new QS60ThreadLocalData);
+ }
+ return tls.localData()->wsSession;
}
inline RWindowGroup& QS60Data::windowGroup()
@@ -275,7 +317,10 @@ inline RWindowGroup& QS60Data::windowGroup()
inline CWsScreenDevice* QS60Data::screenDevice()
{
- return CCoeEnv::Static()->ScreenDevice();
+ if(!tls.hasLocalData()) {
+ tls.setLocalData(new QS60ThreadLocalData);
+ }
+ return tls.localData()->screenDevice;
}
inline CCoeAppUi* QS60Data::appUi()
diff --git a/src/gui/kernel/qwhatsthis.cpp b/src/gui/kernel/qwhatsthis.cpp
index 6181b62..ff4641e 100644
--- a/src/gui/kernel/qwhatsthis.cpp
+++ b/src/gui/kernel/qwhatsthis.cpp
@@ -143,7 +143,7 @@ QT_BEGIN_NAMESPACE
\sa QToolTip
*/
-Q_DECL_IMPORT extern void qDeleteInEventHandler(QObject *o);
+Q_CORE_EXPORT void qDeleteInEventHandler(QObject *o);
class QWhatsThat : public QWidget
{
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 77e9288..2627960 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -67,6 +67,7 @@
# include "qt_mac_p.h"
# include "qt_cocoa_helpers_mac_p.h"
# include "qmainwindow.h"
+# include "qtoolbar.h"
#endif
#if defined(Q_WS_QWS)
# include "qwsdisplay_qws.h"
@@ -379,6 +380,8 @@ void QWidget::setInputContext(QInputContext *context)
if (d->ic)
delete d->ic;
d->ic = context;
+ if (d->ic)
+ d->ic->setParent(this);
#endif
}
@@ -1066,7 +1069,6 @@ struct QWidgetExceptionCleaner
\sa windowFlags
*/
-
QWidget::QWidget(QWidget *parent, Qt::WindowFlags f)
: QObject(*new QWidgetPrivate, 0), QPaintDevice()
{
@@ -4817,6 +4819,11 @@ void QWidget::setLayoutDirection(Qt::LayoutDirection direction)
{
Q_D(QWidget);
+ if (direction == Qt::LayoutDirectionAuto) {
+ unsetLayoutDirection();
+ return;
+ }
+
setAttribute(Qt::WA_SetLayoutDirection);
d->setLayoutDirection_helper(direction);
}
@@ -9717,46 +9724,58 @@ QWidget *QWidget::childAt(const QPoint &p) const
QWidget *QWidgetPrivate::childAt_helper(const QPoint &p, bool ignoreChildrenInDestructor) const
{
- Q_Q(const QWidget);
+ if (children.isEmpty())
+ return 0;
+
#ifdef Q_WS_MAC
+ Q_Q(const QWidget);
+ // Unified tool bars on the Mac require special handling since they live outside
+ // QMainWindow's geometry(). See commit: 35667fd45ada49269a5987c235fdedfc43e92bb8
bool includeFrame = q->isWindow() && qobject_cast<const QMainWindow *>(q)
&& static_cast<const QMainWindow *>(q)->unifiedTitleAndToolBarOnMac();
+ if (includeFrame)
+ return childAtRecursiveHelper(p, ignoreChildrenInDestructor, includeFrame);
#endif
- if (
-#ifdef Q_WS_MAC
- !includeFrame &&
-#endif
- !q->rect().contains(p))
+ if (!pointInsideRectAndMask(p))
return 0;
+ return childAtRecursiveHelper(p, ignoreChildrenInDestructor);
+}
- for (int i = children.size(); i > 0 ;) {
- --i;
- QWidget *w = qobject_cast<QWidget *>(children.at(i));
- if (w && !w->isWindow() && !w->isHidden()
- && (w->geometry().contains(p)
-#ifdef Q_WS_MAC
- || (includeFrame && w->geometry().contains(qt_mac_nativeMapFromParent(w, p)))
+QWidget *QWidgetPrivate::childAtRecursiveHelper(const QPoint &p, bool ignoreChildrenInDestructor, bool includeFrame) const
+{
+#ifndef Q_WS_MAC
+ Q_UNUSED(includeFrame);
#endif
- )) {
- if (ignoreChildrenInDestructor && w->data->in_destructor)
- continue;
- if (w->testAttribute(Qt::WA_TransparentForMouseEvents))
- continue;
- QPoint childPoint = w->mapFromParent(p);
-#ifdef Q_WS_MAC
- if (includeFrame && !w->geometry().contains(p))
- childPoint = qt_mac_nativeMapFromParent(w, p);
-#endif
- if (QWidget *t = w->d_func()->childAt_helper(childPoint, ignoreChildrenInDestructor))
- return t;
- // if WMouseNoMask is set the widget mask is ignored, if
- // the widget has no mask then the WMouseNoMask flag has no
- // effect
- if (w->testAttribute(Qt::WA_MouseNoMask) || w->mask().contains(childPoint)
- || w->mask().isEmpty())
- return w;
+ for (int i = children.size() - 1; i >= 0; --i) {
+ QWidget *child = qobject_cast<QWidget *>(children.at(i));
+ if (!child || child->isWindow() || child->isHidden() || child->testAttribute(Qt::WA_TransparentForMouseEvents)
+ || (ignoreChildrenInDestructor && child->data->in_destructor)) {
+ continue;
}
+
+ // Map the point 'p' from parent coordinates to child coordinates.
+ QPoint childPoint = p;
+#ifdef Q_WS_MAC
+ // 'includeFrame' is true if the child's parent is a top-level QMainWindow with an unified tool bar.
+ // An unified tool bar on the Mac lives outside QMainWindow's geometry(), so a normal
+ // QWidget::mapFromParent won't do the trick.
+ if (includeFrame && qobject_cast<QToolBar *>(child))
+ childPoint = qt_mac_nativeMapFromParent(child, p);
+ else
+#endif
+ childPoint -= child->data->crect.topLeft();
+
+ // Check if the point hits the child.
+ if (!child->d_func()->pointInsideRectAndMask(childPoint))
+ continue;
+
+ // Do the same for the child's descendants.
+ if (QWidget *w = child->d_func()->childAtRecursiveHelper(childPoint, ignoreChildrenInDestructor))
+ return w;
+
+ // We have found our target; namely the child at position 'p'.
+ return child;
}
return 0;
}
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 56e72af..20e82a9 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2688,6 +2688,7 @@ QWidget::macCGHandle() const
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
+ d->aboutToDestroy();
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
@@ -2803,7 +2804,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
QList<QWidget *> widgets = q->findChildren<QWidget *>();
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = widgets.at(i);
- if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created)) {
+ if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) {
if (set)
[qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove];
else
@@ -2860,9 +2861,11 @@ void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
}
if (wasWindow) {
oldToolbar = [oldWindow toolbar];
- [oldToolbar retain];
- oldToolbarVisible = [oldToolbar isVisible];
- [oldWindow setToolbar:nil];
+ if (oldToolbar) {
+ [oldToolbar retain];
+ oldToolbarVisible = [oldToolbar isVisible];
+ [oldWindow setToolbar:nil];
+ }
}
#endif
}
@@ -3994,10 +3997,10 @@ static void qt_mac_update_widget_position(QWidget *q, QRect oldRect, QRect newRe
(oldRect.isValid() == false || newRect.isValid() == false) ||
// the position update is a part of a drag-and-drop operation
- QDragManager::self()->object ||
-
- // we are on Panther (no HIViewSetNeedsDisplayInRect)
- QSysInfo::MacintoshVersion < QSysInfo::MV_10_4
+ QDragManager::self()->object ||
+
+ // we are on Panther (no HIViewSetNeedsDisplayInRect)
+ QSysInfo::MacintoshVersion < QSysInfo::MV_10_4
){
HIViewSetFrame(view, &bounds);
return;
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index d432263..9118919 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -543,13 +543,20 @@ public:
bool setMaximumSize_helper(int &maxw, int &maxh);
virtual bool hasHeightForWidth() const;
void setConstraints_sys();
+ bool pointInsideRectAndMask(const QPoint &) const;
QWidget *childAt_helper(const QPoint &, bool) const;
+ QWidget *childAtRecursiveHelper(const QPoint &p, bool, bool includeFrame = false) const;
void updateGeometry_helper(bool forceUpdate);
void getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const;
void setLayoutItemMargins(int left, int top, int right, int bottom);
void setLayoutItemMargins(QStyle::SubElement element, const QStyleOption *opt = 0);
+ // aboutToDestroy() is called just before the contents of
+ // QWidget::destroy() is executed. It's used to signal QWidget
+ // sub-classes that their internals are about to be released.
+ virtual void aboutToDestroy() {}
+
QInputContext *inputContext() const;
inline QWidget *effectiveFocusWidget() {
QWidget *w = q_func();
@@ -969,6 +976,13 @@ inline void QWidgetPrivate::setSharedPainter(QPainter *painter)
x->sharedPainter = painter;
}
+inline bool QWidgetPrivate::pointInsideRectAndMask(const QPoint &p) const
+{
+ Q_Q(const QWidget);
+ return q->rect().contains(p) && (!extra || !extra->hasMask || q->testAttribute(Qt::WA_MouseNoMask)
+ || extra->mask.contains(p));
+}
+
inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const
{
Q_Q(const QWidget);
diff --git a/src/gui/kernel/qwidget_qws.cpp b/src/gui/kernel/qwidget_qws.cpp
index b827e8b..3145136 100644
--- a/src/gui/kernel/qwidget_qws.cpp
+++ b/src/gui/kernel/qwidget_qws.cpp
@@ -256,7 +256,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool /*destro
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
-
+ d->aboutToDestroy();
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 86b858d..3f351d9 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -738,9 +738,6 @@ void QWidgetPrivate::s60UpdateIsOpaque()
if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground))
return;
- if ((data.window_flags & Qt::FramelessWindowHint) == 0)
- return;
-
RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
#ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE
@@ -1177,6 +1174,7 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
+ d->aboutToDestroy();
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(geometry());
d->deactivateWidgetCleanup();
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 9d96fcb..0f05c6b 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -544,6 +544,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
+ d->aboutToDestroy();
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 43f510c..e01489f 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -1023,6 +1023,7 @@ bool QWidgetPrivate::isBackgroundInherited() const
void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
{
Q_D(QWidget);
+ d->aboutToDestroy();
if (!isWindow() && parentWidget())
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
diff --git a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
index 64addeb..9d0e6f7 100644
--- a/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
+++ b/src/gui/kernel/qwinnativepangesturerecognizer_win_p.h
@@ -55,39 +55,6 @@
#include <QGestureRecognizer>
-#include <objbase.h>
-
-class IInkRectangle;
-class TabletHardwareCapabilities;
-class TabletPropertyMetricUnit;
-DECLARE_INTERFACE_(IInkTablet, IDispatch)
-{
- STDMETHOD(get_Name)(THIS_ BSTR *Name) PURE;
- STDMETHOD(get_PlugAndPlayId)(THIS_ BSTR *Id) PURE;
- STDMETHOD(get_MaximumInputRectangle)(THIS_ IInkRectangle **Rectangle) PURE;
- STDMETHOD(get_HardwareCapabilities)(THIS_ TabletHardwareCapabilities *Capabilities) PURE;
- STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName) PURE;
- STDMETHOD(GetPropertyMetrics)(THIS_ BSTR propertyName, long *Minimum, long *Maximum, TabletPropertyMetricUnit *Units, float *Resolution) PURE;
-};
-enum TabletDeviceKind
-{
- TDK_Mouse = 0,
- TDK_Pen = 1,
- TDK_Touch = 2
-};
-DECLARE_INTERFACE_(IInkTablet2, IDispatch)
-{
- STDMETHOD(get_DeviceKind)(THIS_ TabletDeviceKind *Kind) PURE;
-};
-DECLARE_INTERFACE_(IInkTablets, IDispatch)
-{
- STDMETHOD(get_Count)(THIS_ long *Count) PURE;
- STDMETHOD(get__NewEnum)(THIS_ IUnknown **_NewEnum) PURE;
- STDMETHOD(get_DefaultTablet)(THIS_ IInkTablet **DefaultTablet) PURE;
- STDMETHOD(Item)(THIS_ long Index, IInkTablet **Tablet) PURE;
- STDMETHOD(IsPacketPropertySupported)(THIS_ BSTR packetPropertyName, VARIANT_BOOL *Supported) PURE;
-};
-
#ifndef QT_NO_GESTURES
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 123af1c..a5cfb84 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -234,7 +234,7 @@ contains(QMAKE_MAC_XARCH, no) {
IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp
}
- win32-g++|!win32:!*-icc* {
+ win32-g++*|!win32:!*-icc* {
mmx {
mmx_compiler.commands = $$QMAKE_CXX -c -Winline
@@ -403,9 +403,10 @@ neon:*-g++* {
}
contains(QT_CONFIG, zlib) {
- INCLUDEPATH += ../3rdparty/zlib
+ INCLUDEPATH += ../3rdparty/zlib
} else:!contains(QT_CONFIG, no-zlib) {
- unix:LIBS_PRIVATE += -lz
-# win32:LIBS += libz.lib
+ symbian:LIBS_PRIVATE += -llibz
+ else:if(unix|win32-g++*):LIBS_PRIVATE += -lz
+ else:LIBS += zdll.lib
}
diff --git a/src/gui/painting/qcolormap.qdoc b/src/gui/painting/qcolormap.qdoc
index 22a73fd..ec3d2ba 100644
--- a/src/gui/painting/qcolormap.qdoc
+++ b/src/gui/painting/qcolormap.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h
index 445f83d..101a8e7 100644
--- a/src/gui/painting/qgraphicssystem_runtime_p.h
+++ b/src/gui/painting/qgraphicssystem_runtime_p.h
@@ -170,7 +170,7 @@ public:
int windowSurfaceDestroyPolicy() const { return m_windowSurfaceDestroyPolicy; }
- int memoryUsage() const { return m_memoryUsage; }
+ uint memoryUsage() const { return m_memoryUsage; }
private:
diff --git a/src/gui/painting/qgrayraster.c b/src/gui/painting/qgrayraster.c
index ff2469c..5e7c67a 100644
--- a/src/gui/painting/qgrayraster.c
+++ b/src/gui/painting/qgrayraster.c
@@ -156,6 +156,7 @@
#define ErrRaster_Invalid_Outline -1
#define ErrRaster_Invalid_Argument -3
#define ErrRaster_Memory_Overflow -4
+#define ErrRaster_OutOfMemory -6
#define QT_FT_BEGIN_HEADER
#define QT_FT_END_HEADER
@@ -222,7 +223,6 @@
#define DOWNSCALE( x ) ( (x) << ( 6 - PIXEL_BITS ) )
#endif
-
/*************************************************************************/
/* */
/* TYPE DEFINITIONS */
@@ -1757,8 +1757,7 @@
#ifdef DEBUG_GRAYS
fprintf( stderr, "Rotten glyph!\n" );
#endif
- /* == Raster_Err_OutOfMemory in qblackraster.c */
- return -6;
+ return ErrRaster_OutOfMemory;
}
if ( bottom-top >= ras.band_size )
@@ -1784,7 +1783,7 @@
static int
- gray_raster_render( PRaster raster,
+ gray_raster_render( QT_FT_Raster raster,
const QT_FT_Raster_Params* params )
{
const QT_FT_Outline* outline = (const QT_FT_Outline*)params->source;
@@ -1795,6 +1794,12 @@
if ( !raster || !raster->buffer || !raster->buffer_size )
return ErrRaster_Invalid_Argument;
+ // If raster object and raster buffer are allocated, but
+ // raster size isn't of the minimum size, indicate out of
+ // memory.
+ if (raster && raster->buffer && raster->buffer_size < MINIMUM_POOL_SIZE )
+ return ErrRaster_OutOfMemory;
+
/* return immediately if the outline is empty */
if ( outline->n_points == 0 || outline->n_contours <= 0 )
return 0;
@@ -1874,19 +1879,15 @@
/**** a static object. *****/
static int
- gray_raster_new( void * memory,
- QT_FT_Raster* araster )
+ gray_raster_new( QT_FT_Raster* araster )
{
- if (memory)
- fprintf(stderr, "gray_raster_new(), memory ignored");
- memory = malloc(sizeof(TRaster));
- if (!memory) {
+ *araster = malloc(sizeof(TRaster));
+ if (!*araster) {
*araster = 0;
return ErrRaster_Memory_Overflow;
}
- QT_FT_MEM_ZERO(memory, sizeof(TRaster));
+ QT_FT_MEM_ZERO(*araster, sizeof(TRaster));
- *araster = (QT_FT_Raster) memory;
return 0;
}
@@ -1905,10 +1906,9 @@
{
PRaster rast = (PRaster)raster;
-
if ( raster )
{
- if ( pool_base && pool_size >= (long)sizeof ( TWorker ) + 2048 )
+ if ( pool_base && ( pool_size >= MINIMUM_POOL_SIZE ) )
{
PWorker worker = (PWorker)pool_base;
@@ -1923,6 +1923,13 @@
rast->band_size = (int)( rast->buffer_size /
( sizeof ( TCell ) * 8 ) );
}
+ else if ( pool_base)
+ { // Case when there is a raster pool allocated, but it
+ // doesn't have the minimum size (and so memory will be reallocated)
+ rast->buffer = pool_base;
+ rast->worker = NULL;
+ rast->buffer_size = pool_size;
+ }
else
{
rast->buffer = NULL;
diff --git a/src/gui/painting/qgrayraster_p.h b/src/gui/painting/qgrayraster_p.h
index 4463fc9..ad595b8 100644
--- a/src/gui/painting/qgrayraster_p.h
+++ b/src/gui/painting/qgrayraster_p.h
@@ -89,6 +89,10 @@
#define QT_FT_EXPORT_VAR( x ) extern x
#endif
+/* Minimum buffer size for raster object, that accounts
+ for TWorker and TCell sizes.*/
+#define MINIMUM_POOL_SIZE 4096
+
QT_FT_EXPORT_VAR( const QT_FT_Raster_Funcs ) qt_ft_grays_raster;
diff --git a/src/gui/painting/qoutlinemapper.cpp b/src/gui/painting/qoutlinemapper.cpp
index 1b01960..bf03545 100644
--- a/src/gui/painting/qoutlinemapper.cpp
+++ b/src/gui/painting/qoutlinemapper.cpp
@@ -234,12 +234,12 @@ void QOutlineMapper::endOutline()
// Check for out of dev bounds...
- const bool do_clip = (controlPointRect.left() < -QT_RASTER_COORD_LIMIT
+ const bool do_clip = !m_in_clip_elements && ((controlPointRect.left() < -QT_RASTER_COORD_LIMIT
|| controlPointRect.right() > QT_RASTER_COORD_LIMIT
|| controlPointRect.top() < -QT_RASTER_COORD_LIMIT
|| controlPointRect.bottom() > QT_RASTER_COORD_LIMIT
|| controlPointRect.width() > QT_RASTER_COORD_LIMIT
- || controlPointRect.height() > QT_RASTER_COORD_LIMIT);
+ || controlPointRect.height() > QT_RASTER_COORD_LIMIT));
if (do_clip) {
clipElements(elements, elementTypes(), element_count);
@@ -353,7 +353,13 @@ void QOutlineMapper::clipElements(const QPointF *elements,
// instead of going through convenience functionallity, but since
// this part of code hardly every used, it shouldn't matter.
+ m_in_clip_elements = true;
+
QPainterPath path;
+
+ if (!(m_outline.flags & QT_FT_OUTLINE_EVEN_ODD_FILL))
+ path.setFillRule(Qt::WindingFill);
+
if (types) {
for (int i=0; i<element_count; ++i) {
switch (types[i]) {
@@ -389,6 +395,8 @@ void QOutlineMapper::clipElements(const QPointF *elements,
else
convertPath(clippedPath);
m_txop = old_txop;
+
+ m_in_clip_elements = false;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qoutlinemapper_p.h b/src/gui/painting/qoutlinemapper_p.h
index 39b7593..d534f76 100644
--- a/src/gui/painting/qoutlinemapper_p.h
+++ b/src/gui/painting/qoutlinemapper_p.h
@@ -95,6 +95,7 @@ public:
m_tags(0),
m_contours(0),
m_polygon_dev(0),
+ m_in_clip_elements(false),
m_round_coords(false)
{
}
@@ -235,6 +236,7 @@ public:
qreal m_dy;
bool m_valid;
+ bool m_in_clip_elements;
private:
bool m_round_coords;
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 340db39..38a1575 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 06effd4..fb93152 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -68,6 +68,7 @@
// #include <private/qrasterizer_p.h>
#include <private/qimage_p.h>
#include <private/qstatictext_p.h>
+#include "qmemrotate_p.h"
#include "qpaintengine_raster_p.h"
// #include "qbezier_p.h"
@@ -344,7 +345,7 @@ void QRasterPaintEngine::init()
// The antialiasing raster.
d->grayRaster.reset(new QT_FT_Raster);
Q_CHECK_PTR(d->grayRaster.data());
- if (qt_ft_grays_raster.raster_new(0, d->grayRaster.data()))
+ if (qt_ft_grays_raster.raster_new(d->grayRaster.data()))
QT_THROW(std::bad_alloc()); // an error creating the raster is caused by a bad malloc
@@ -458,13 +459,12 @@ bool QRasterPaintEngine::begin(QPaintDevice *device)
QRasterPaintEngineState *s = state();
ensureOutlineMapper();
- d->outlineMapper->m_clip_rect = d->deviceRect.adjusted(-10, -10, 10, 10);
-
- // This is the upp
- QRect bounds(-QT_RASTER_COORD_LIMIT, -QT_RASTER_COORD_LIMIT,
- QT_RASTER_COORD_LIMIT*2 - 1, QT_RASTER_COORD_LIMIT * 2 - 1);
- d->outlineMapper->m_clip_rect = bounds.intersected(d->outlineMapper->m_clip_rect);
+ d->outlineMapper->m_clip_rect = d->deviceRect;
+ if (d->outlineMapper->m_clip_rect.width() > QT_RASTER_COORD_LIMIT)
+ d->outlineMapper->m_clip_rect.setWidth(QT_RASTER_COORD_LIMIT);
+ if (d->outlineMapper->m_clip_rect.height() > QT_RASTER_COORD_LIMIT)
+ d->outlineMapper->m_clip_rect.setHeight(QT_RASTER_COORD_LIMIT);
d->rasterizer->setClipRect(d->deviceRect);
@@ -2521,6 +2521,58 @@ QRectF qt_mapRect_non_normalizing(const QRectF &r, const QTransform &t)
return QRectF(r.topLeft() * t, r.bottomRight() * t);
}
+namespace {
+ enum RotationType {
+ Rotation90,
+ Rotation180,
+ Rotation270,
+ NoRotation
+ };
+
+ inline RotationType qRotationType(const QTransform &transform)
+ {
+ QTransform::TransformationType type = transform.type();
+
+ if (type > QTransform::TxRotate)
+ return NoRotation;
+
+ if (type == QTransform::TxRotate && qFuzzyIsNull(transform.m11()) && qFuzzyCompare(transform.m12(), qreal(-1))
+ && qFuzzyCompare(transform.m21(), qreal(1)) && qFuzzyIsNull(transform.m22()))
+ return Rotation90;
+
+ if (type == QTransform::TxScale && qFuzzyCompare(transform.m11(), qreal(-1)) && qFuzzyIsNull(transform.m12())
+ && qFuzzyIsNull(transform.m21()) && qFuzzyCompare(transform.m22(), qreal(-1)))
+ return Rotation180;
+
+ if (type == QTransform::TxRotate && qFuzzyIsNull(transform.m11()) && qFuzzyCompare(transform.m12(), qreal(1))
+ && qFuzzyCompare(transform.m21(), qreal(-1)) && qFuzzyIsNull(transform.m22()))
+ return Rotation270;
+
+ return NoRotation;
+ }
+
+ template <typename T> void memRotate(RotationType type, const T *srcBase, int w, int h, int sbpl, T *dstBase, int dbpl)
+ {
+ switch (type) {
+ case Rotation90:
+ qt_memrotate90(srcBase, w, h, sbpl, dstBase, dbpl);
+ break;
+ case Rotation180:
+ qt_memrotate180(srcBase, w, h, sbpl, dstBase, dbpl);
+ break;
+ case Rotation270:
+ qt_memrotate270(srcBase, w, h, sbpl, dstBase, dbpl);
+ break;
+ case NoRotation:
+ break;
+ }
+ }
+
+ inline bool isPixelAligned(const QRectF &rect) {
+ return QRectF(rect.toRect()) == rect;
+ }
+}
+
/*!
\reimp
*/
@@ -2582,6 +2634,58 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
const QClipData *clip = d->clip();
+ if (s->matrix.type() > QTransform::TxTranslate
+ && !stretch_sr
+ && (!clip || clip->hasRectClip)
+ && s->intOpacity == 256
+ && (d->rasterBuffer->compositionMode == QPainter::CompositionMode_SourceOver
+ || d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)
+ && d->rasterBuffer->format == img.format()
+ && (d->rasterBuffer->format == QImage::Format_RGB16
+ || d->rasterBuffer->format == QImage::Format_RGB32
+ || (d->rasterBuffer->format == QImage::Format_ARGB32_Premultiplied
+ && d->rasterBuffer->compositionMode == QPainter::CompositionMode_Source)))
+ {
+ RotationType rotationType = qRotationType(s->matrix);
+
+ if (rotationType != NoRotation && img.rect().contains(sr.toAlignedRect())) {
+ QRectF transformedTargetRect = s->matrix.mapRect(r);
+
+ if ((!(s->renderHints & QPainter::SmoothPixmapTransform) && !(s->renderHints & QPainter::Antialiasing))
+ || (isPixelAligned(transformedTargetRect) && isPixelAligned(sr)))
+ {
+ QRect clippedTransformedTargetRect = transformedTargetRect.toRect().intersected(clip ? clip->clipRect : d->deviceRect);
+ if (clippedTransformedTargetRect.isNull())
+ return;
+
+ QRectF clippedTargetRect = s->matrix.inverted().mapRect(QRectF(clippedTransformedTargetRect));
+
+ QRect clippedSourceRect
+ = QRectF(sr.x() + clippedTargetRect.x() - r.x(), sr.y() + clippedTargetRect.y() - r.y(),
+ clippedTargetRect.width(), clippedTargetRect.height()).toRect();
+
+ uint dbpl = d->rasterBuffer->bytesPerLine();
+ uint sbpl = img.bytesPerLine();
+
+ uchar *dst = d->rasterBuffer->buffer();
+ uint bpp = img.depth() >> 3;
+
+ const uchar *srcBase = img.bits() + clippedSourceRect.y() * sbpl + clippedSourceRect.x() * bpp;
+ uchar *dstBase = dst + clippedTransformedTargetRect.y() * dbpl + clippedTransformedTargetRect.x() * bpp;
+
+ uint cw = clippedSourceRect.width();
+ uint ch = clippedSourceRect.height();
+
+ if (d->rasterBuffer->format == QImage::Format_RGB16)
+ memRotate(rotationType, (quint16 *)srcBase, cw, ch, sbpl, (quint16 *)dstBase, dbpl);
+ else
+ memRotate(rotationType, (quint32 *)srcBase, cw, ch, sbpl, (quint32 *)dstBase, dbpl);
+
+ return;
+ }
+ }
+ }
+
if (s->matrix.type() > QTransform::TxTranslate || stretch_sr) {
if (s->flags.fast_images) {
@@ -3685,6 +3789,7 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect)
if (((qpen_style(s->lastPen) == Qt::SolidLine && s->flags.fast_pen)
|| (qpen_style(s->lastPen) == Qt::NoPen && !s->flags.antialiased))
&& qMax(rect.width(), rect.height()) < QT_RASTER_COORD_LIMIT
+ && !rect.isEmpty()
&& s->matrix.type() <= QTransform::TxScale) // no shear
{
ensureBrush();
@@ -4081,7 +4186,11 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
return;
}
- const int rasterPoolInitialSize = 8192;
+ // Initial size for raster pool is MINIMUM_POOL_SIZE so as to
+ // minimize memory reallocations. However if initial size for
+ // raster pool is changed for lower value, reallocations will
+ // occur normally.
+ const int rasterPoolInitialSize = MINIMUM_POOL_SIZE;
int rasterPoolSize = rasterPoolInitialSize;
unsigned char *rasterPoolBase;
#if defined(Q_WS_WIN64)
@@ -4125,7 +4234,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
error = qt_ft_grays_raster.raster_render(*grayRaster.data(), &rasterParams);
// Out of memory, reallocate some more and try again...
- if (error == -6) { // -6 is Result_err_OutOfMemory
+ if (error == -6) { // ErrRaster_OutOfMemory from qgrayraster.c
int new_size = rasterPoolSize * 2;
if (new_size > 1024 * 1024) {
qWarning("QPainter: Rasterization of primitive failed");
@@ -4151,7 +4260,7 @@ void QRasterPaintEnginePrivate::rasterize(QT_FT_Outline *outline,
Q_CHECK_PTR(rasterPoolBase); // note: we just freed the old rasterPoolBase. I hope it's not fatal.
qt_ft_grays_raster.raster_done(*grayRaster.data());
- qt_ft_grays_raster.raster_new(0, grayRaster.data());
+ qt_ft_grays_raster.raster_new(grayRaster.data());
qt_ft_grays_raster.raster_reset(*grayRaster.data(), rasterPoolBase, rasterPoolSize);
} else {
done = true;
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index b8ad9b3..910b2df 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1453,6 +1453,11 @@ void QX11PaintEngine::drawEllipse(const QRectF &rect)
void QX11PaintEngine::drawEllipse(const QRect &rect)
{
+ if (rect.isEmpty()) {
+ drawRects(&rect, 1);
+ return;
+ }
+
Q_D(QX11PaintEngine);
QRect devclip(SHRT_MIN, SHRT_MIN, SHRT_MAX*2 - 1, SHRT_MAX*2 - 1);
QRect r(rect);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index ff82d59..e0746fb 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -494,11 +494,9 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
} else {
d->activeStroker->moveTo(points[0], points[1]);
points += 2;
- ++types;
while (points < lastPoint) {
d->activeStroker->lineTo(points[0], points[1]);
points += 2;
- ++types;
}
if (path.hasImplicitClose())
d->activeStroker->lineTo(path.points()[0], path.points()[1]);
@@ -561,12 +559,10 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
QPointF p = ((QPointF *)points)[0] * state()->matrix;
d->activeStroker->moveTo(p.x(), p.y());
points += 2;
- ++types;
while (points < lastPoint) {
QPointF p = ((QPointF *)points)[0] * state()->matrix;
d->activeStroker->lineTo(p.x(), p.y());
points += 2;
- ++types;
}
if (path.hasImplicitClose())
d->activeStroker->lineTo(p.x(), p.y());
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 312cc95..1bf90e3 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -1566,7 +1566,6 @@ void QPainter::initFrom(const QWidget *widget)
d->engine->setDirty(QPaintEngine::DirtyBrush);
d->engine->setDirty(QPaintEngine::DirtyFont);
}
- d->state->layoutDirection = widget->layoutDirection();
}
@@ -1876,7 +1875,7 @@ bool QPainter::begin(QPaintDevice *pd)
QWidget *widget = static_cast<QWidget *>(d->original_device);
initFrom(widget);
} else {
- d->state->layoutDirection = QApplication::layoutDirection();
+ d->state->layoutDirection = Qt::LayoutDirectionAuto;
// make sure we have a font compatible with the paintdevice
d->state->deviceFont = d->state->font = QFont(d->state->deviceFont, device());
}
@@ -2394,6 +2393,8 @@ void QPainter::setCompositionMode(CompositionMode mode)
qWarning("QPainter::setCompositionMode: Painter not active");
return;
}
+ if (d->state->composition_mode == mode)
+ return;
if (d->extended) {
d->state->composition_mode = mode;
d->extended->compositionModeChanged();
@@ -4241,8 +4242,6 @@ void QPainter::drawEllipse(const QRectF &r)
return;
QRectF rect(r.normalized());
- if (rect.isEmpty())
- return;
if (d->extended) {
d->extended->drawEllipse(rect);
@@ -4284,8 +4283,6 @@ void QPainter::drawEllipse(const QRect &r)
return;
QRect rect(r.normalized());
- if (rect.isEmpty())
- return;
if (d->extended) {
d->extended->drawEllipse(rect);
@@ -8087,7 +8084,10 @@ start_lengthVariant:
Sets the layout direction used by the painter when drawing text,
to the specified \a direction.
- \sa layoutDirection(), drawText(), {QPainter#Settings}{Settings}
+ The default is Qt::LayoutDirectionAuto, which will implicitly determine the
+ direction from the text drawn.
+
+ \sa QTextOption::setTextDirection(), layoutDirection(), drawText(), {QPainter#Settings}{Settings}
*/
void QPainter::setLayoutDirection(Qt::LayoutDirection direction)
{
@@ -8099,12 +8099,12 @@ void QPainter::setLayoutDirection(Qt::LayoutDirection direction)
/*!
Returns the layout direction used by the painter when drawing text.
- \sa setLayoutDirection(), drawText(), {QPainter#Settings}{Settings}
+ \sa QTextOption::textDirection(), setLayoutDirection(), drawText(), {QPainter#Settings}{Settings}
*/
Qt::LayoutDirection QPainter::layoutDirection() const
{
Q_D(const QPainter);
- return d->state ? d->state->layoutDirection : Qt::LeftToRight;
+ return d->state ? d->state->layoutDirection : Qt::LayoutDirectionAuto;
}
QPainterState::QPainterState(const QPainterState *s)
diff --git a/src/gui/painting/qprinterinfo.qdoc b/src/gui/painting/qprinterinfo.qdoc
index 7e1a097..7374675 100644
--- a/src/gui/painting/qprinterinfo.qdoc
+++ b/src/gui/painting/qprinterinfo.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/painting/qrasterdefs_p.h b/src/gui/painting/qrasterdefs_p.h
index c33fa57..19a0b16 100644
--- a/src/gui/painting/qrasterdefs_p.h
+++ b/src/gui/painting/qrasterdefs_p.h
@@ -81,7 +81,6 @@
QT_FT_BEGIN_HEADER
-
/*************************************************************************/
/* */
/* <Section> */
@@ -837,7 +836,7 @@ QT_FT_BEGIN_HEADER
/* A handle (pointer) to a raster object. Each object can be used */
/* independently to convert an outline into a bitmap or pixmap. */
/* */
- typedef struct QT_FT_RasterRec_* QT_FT_Raster;
+ typedef struct TRaster_ *QT_FT_Raster;
/*************************************************************************/
@@ -1118,8 +1117,7 @@ QT_FT_BEGIN_HEADER
/* ignored by a given raster implementation. */
/* */
typedef int
- (*QT_FT_Raster_NewFunc)( void* memory,
- QT_FT_Raster* raster );
+ (*QT_FT_Raster_NewFunc)( QT_FT_Raster* raster );
#define QT_FT_Raster_New_Func QT_FT_Raster_NewFunc
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 423cce9..47b7758 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1626,7 +1626,7 @@ static QPainterPath mapProjective(const QTransform &transform, const QPainterPat
QPainterPath QTransform::map(const QPainterPath &path) const
{
TransformationType t = inline_type();
- if (t == TxNone || path.isEmpty())
+ if (t == TxNone || path.elementCount() == 0)
return path;
if (t >= TxProject)
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index cb48def..de50ef8 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -884,7 +884,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem,
}
painter->restore();
break;
-#ifndef QT_NO_LINEDIT
+#ifndef QT_NO_LINEEDIT
case PE_FrameLineEdit:
// fall through
#endif // QT_NO_LINEEDIT
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 4978565..039a6da 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -762,7 +762,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
#ifndef QT_NO_ITEMVIEWS
case PE_PanelItemViewRow:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
? QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;
@@ -775,7 +775,7 @@ void QCommonStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, Q
break;
case PE_PanelItemViewItem:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
- QPalette::ColorGroup cg = vopt->state & QStyle::State_Enabled
+ QPalette::ColorGroup cg = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled))
? QPalette::Normal : QPalette::Disabled;
if (cg == QPalette::Normal && !(vopt->state & QStyle::State_Active))
cg = QPalette::Inactive;
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index b59a033..c989bd3 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -855,9 +855,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
key = QLS("a");
GTK_WIDGET_SET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
}
+ bool isEnabled = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled));
gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect,
option->state & State_Selected ? GTK_STATE_SELECTED :
- option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
+ isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
GTK_SHADOW_OUT, gtkTreeView->style, key);
if (isActive )
GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
diff --git a/src/gui/styles/qmacstyle.qdoc b/src/gui/styles/qmacstyle.qdoc
index f4afed3..a86f2ed 100644
--- a/src/gui/styles/qmacstyle.qdoc
+++ b/src/gui/styles/qmacstyle.qdoc
@@ -6,35 +6,21 @@
**
** This file is part of the documentation of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 8cd7417..2005e4a 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -1808,7 +1808,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush
painter->setClipRegion(rgn);
- CGContextRef cg = qt_mac_cg_context(target);
+ QCFType<CGContextRef> cg = qt_mac_cg_context(target);
CGContextSaveGState(cg);
HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationInverted);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index d28e1d9..45bcc00 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -135,13 +135,13 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_TableHeaderItem, QS60StyleEnums::SP_QsnFrCaleHeadingCenter},
{SE_ToolTip, QS60StyleEnums::SP_QsnFrPopupPreviewCenter},
{SE_ToolBar, QS60StyleEnums::SP_QsnFrPopupSubCenter},
- {SE_ToolBarButton, QS60StyleEnums::SP_QsnFrSctrlButtonCenter},
- {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
+ {SE_ToolBarButton, QS60StyleEnums::SP_QgnFrSctrlButtonCenter},
+ {SE_ToolBarButtonPressed, QS60StyleEnums::SP_QgnFrSctrlButtonCenterPressed},
{SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
{SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
{SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
{SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed},
- {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListPressed},
+ {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListCenterPressed},
};
static const int frameElementsCount =
@@ -1750,45 +1750,77 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
}
const bool enabled = optionMenuItem.state & State_Enabled;
const bool checkable = optionMenuItem.checkType != QStyleOptionMenuItem::NotCheckable;
+ bool ignoreCheckMark = false;
+
+#ifndef QT_NO_COMBOBOX
+ if (qobject_cast<const QComboBox*>(widget))
+ ignoreCheckMark = true; //ignore the checkmarks provided by the QComboMenuDelegate
+#endif
uint text_flags = Qt::AlignLeading | Qt::TextShowMnemonic | Qt::TextDontClip
| Qt::TextSingleLine | Qt::AlignVCenter;
if (!styleHint(SH_UnderlineShortcut, menuItem, widget))
text_flags |= Qt::TextHideMnemonic;
- const bool selected = (option->state & State_Selected) && (option->state & State_Enabled);
- if (selected)
- QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags);
-
QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget);
QRect textRect = subElementRect(SE_ItemViewItemText, &optionMenuItem, widget);
//todo: move the vertical spacing stuff into subElementRect
const int vSpacing = QS60StylePrivate::pixelMetric(PM_LayoutVerticalSpacing);
- if (checkable){
- const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing);
- QStyleOptionMenuItem optionCheckBox;
- optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem);
- optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth));
- optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight));
- optionCheckBox.rect.moveCenter(QPoint(
- optionCheckBox.rect.center().x(),
- menuItem->rect.center().y()));
- const int moveByX = optionCheckBox.rect.width() + vSpacing;
- if (optionMenuItem.direction == Qt::LeftToRight) {
- textRect.translate(moveByX, 0);
+ QStyleOptionMenuItem optionCheckBox;
+
+ //Regardless of checkbox visibility, make room for it, this mirrors native implementation,
+ //where text and icon placement is static regardless of content of menu item.
+ const int hSpacing = QS60StylePrivate::pixelMetric(PM_LayoutHorizontalSpacing);
+ optionCheckBox.QStyleOptionMenuItem::operator=(*menuItem);
+ optionCheckBox.rect.setWidth(pixelMetric(PM_IndicatorWidth));
+ optionCheckBox.rect.setHeight(pixelMetric(PM_IndicatorHeight));
+ optionCheckBox.rect.moveCenter(QPoint(
+ optionCheckBox.rect.center().x(),
+ menuItem->rect.center().y()));
+ const int moveByX = optionCheckBox.rect.width() + vSpacing +
+ pixelMetric(PM_DefaultFrameWidth);
+ if (optionMenuItem.direction == Qt::LeftToRight) {
+ if (iconRect.isValid()) {
iconRect.translate(moveByX, 0);
iconRect.setWidth(iconRect.width() + vSpacing);
+ }
+ if (textRect.isValid()) {
+ textRect.translate(moveByX, 0);
textRect.setWidth(textRect.width() - moveByX - vSpacing);
- optionCheckBox.rect.translate(vSpacing >> 1, hSpacing >> 1);
- } else {
+ }
+ optionCheckBox.rect.translate(vSpacing + pixelMetric(PM_DefaultFrameWidth), hSpacing >> 1);
+ } else {
+ if (textRect.isValid())
textRect.setWidth(textRect.width() - moveByX);
+ if (iconRect.isValid()) {
iconRect.setWidth(iconRect.width() + vSpacing);
iconRect.translate(-optionCheckBox.rect.width() - vSpacing, 0);
- optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0);
}
- drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
+ optionCheckBox.rect.translate(textRect.width() + iconRect.width(), 0);
}
+
+ const bool selected = (option->state & State_Selected) && (option->state & State_Enabled);
+ if (selected) {
+ const int spacing = pixelMetric(PM_DefaultFrameWidth) * 2;
+ int start; int end;
+ if (QApplication::layoutDirection() == Qt::LeftToRight) {
+ start = optionMenuItem.rect.left() + spacing;
+ end = qMax(textRect.right(), iconRect.right() + spacing);
+ } else {
+ start = qMax(spacing, qMin(textRect.left(), iconRect.left() - spacing));
+ end = optionMenuItem.rect.right() - spacing;
+ }
+ //-1 adjustment to avoid highlight being on top of possible separator item
+ const QRect highlightRect = QRect(
+ QPoint(start, option->rect.top()),
+ QPoint(end, option->rect.bottom() - 1));
+ QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags);
+ }
+
+ if (checkable && !ignoreCheckMark)
+ drawPrimitive(PE_IndicatorMenuCheckMark, &optionCheckBox, painter, widget);
+
//draw icon and/or checkState
QPixmap pix = menuItem->icon.pixmap(pixelMetric(PM_SmallIconSize),
enabled ? QIcon::Normal : QIcon::Disabled);
@@ -1799,7 +1831,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
textRect.translate(vSpacing, 0);
else
textRect.translate(-vSpacing, 0);
- textRect.setWidth(textRect.width()-vSpacing);
+ textRect.setWidth(textRect.width() - vSpacing);
}
//draw indicators
@@ -1817,7 +1849,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QS60StylePrivate::SF_PointNorth : QS60StylePrivate::SF_PointSouth;
painter->save();
painter->setPen(option->palette.windowText().color());
- QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubMenu, painter, arrowOptions.rect,
+ QS60StylePrivate::drawSkinPart(QS60StyleEnums::SP_QgnIndiSubmenu, painter, arrowOptions.rect,
(flags | QS60StylePrivate::SF_ColorSkinned | arrowDirection));
painter->restore();
}
@@ -1837,6 +1869,24 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
QCommonStyle::drawItemText(painter, textRect, text_flags,
optionMenuItem.palette, enabled,
optionMenuItem.text, QPalette::Text);
+
+ //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();
+ }
if (!enabled)
painter->restore();
}
@@ -2233,6 +2283,8 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget) &&
option->palette.window().texture().cacheKey() ==
QS60StylePrivate::m_themePalette->window().texture().cacheKey())
+ //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
commonStyleDraws = true;
@@ -2548,10 +2600,12 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
}
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
+ //native items have small empty areas at the beginning and end of menu item
+ sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth));
if (QS60StylePrivate::isTouchSupported())
//Make itemview easier to use in touch devices
//QCommonStyle does not adjust height with horizontal margin, it only adjusts width
- sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin));
+ sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values
break;
#ifndef QT_NO_COMBOBOX
case CT_ComboBox: {
@@ -2816,16 +2870,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
}
break;
case SC_ComboBoxListBoxPopup: {
- const QRect desktopContent = QApplication::desktop()->availableGeometry();
-
- // take the size of this and position bottom above available area
- QRect popupRect;
- const int width = desktopContent.width() - pixelMetric(PM_LayoutRightMargin) - pixelMetric(PM_LayoutLeftMargin);
- popupRect.setWidth(width);
- popupRect.setHeight(desktopContent.height()); //combobox resets height anyway based on content
- popupRect.setBottom(desktopContent.bottom());
- popupRect.translate(pixelMetric(PM_LayoutLeftMargin), 0);
- ret = popupRect;
+ ret = QApplication::desktop()->availableGeometry();
}
break;
default:
@@ -2989,7 +3034,6 @@ QRect QS60Style::subElementRect(SubElement element, const QStyleOption *opt, con
ret.setWidth(indicatorWidth);
}
} else {
- ret = menuItem->rect;
if (!menuItem->icon.isNull())
if (menuItem->direction == Qt::LeftToRight)
ret.adjust(indicatorWidth, 0, 0, 0);
@@ -3321,13 +3365,13 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
part = QS60StyleEnums::SP_QgnNoteErased;
break;
case SP_ToolBarHorizontalExtensionButton:
- part = QS60StyleEnums::SP_QgnIndiSubMenu;
+ part = QS60StyleEnums::SP_QgnIndiSubmenu;
if (QApplication::layoutDirection() == Qt::RightToLeft)
adjustedFlags |= QS60StylePrivate::SF_PointSouth;
break;
case SP_ToolBarVerticalExtensionButton:
adjustedFlags |= QS60StylePrivate::SF_PointEast;
- part = QS60StyleEnums::SP_QgnIndiSubMenu;
+ part = QS60StyleEnums::SP_QgnIndiSubmenu;
break;
default:
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index d8c31f8..836969a 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -154,7 +154,7 @@ public:
SP_QgnIndiRadiobuttOn,
SP_QgnGrafNsliderMarker,
SP_QgnGrafNsliderMarkerSelected,
- SP_QgnIndiSubMenu,
+ SP_QgnIndiSubmenu,
SP_QgnNoteErased,
SP_QgnNoteError,
SP_QgnNoteInfo,
@@ -166,6 +166,24 @@ public:
SP_QgnPropFolderSmall,
SP_QgnPropFolderSmallNew,
SP_QgnPropPhoneMemcLarge,
+ SP_QgnFrSctrlButtonCornerTl, // Toolbar button
+ SP_QgnFrSctrlButtonCornerTr,
+ SP_QgnFrSctrlButtonCornerBl,
+ SP_QgnFrSctrlButtonCornerBr,
+ SP_QgnFrSctrlButtonSideT,
+ SP_QgnFrSctrlButtonSideB,
+ SP_QgnFrSctrlButtonSideL,
+ SP_QgnFrSctrlButtonSideR,
+ SP_QgnFrSctrlButtonCenter,
+ SP_QgnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed
+ SP_QgnFrSctrlButtonCornerTrPressed,
+ SP_QgnFrSctrlButtonCornerBlPressed,
+ SP_QgnFrSctrlButtonCornerBrPressed,
+ SP_QgnFrSctrlButtonSideTPressed,
+ SP_QgnFrSctrlButtonSideBPressed,
+ SP_QgnFrSctrlButtonSideLPressed,
+ SP_QgnFrSctrlButtonSideRPressed,
+ SP_QgnFrSctrlButtonCenterPressed,
SP_QsnCpScrollHandleBottomPressed, //ScrollBar handle, pressed state
SP_QsnCpScrollHandleMiddlePressed,
SP_QsnCpScrollHandleTopPressed,
@@ -198,10 +216,10 @@ public:
SP_QsnFrCaleCornerTr,
SP_QsnFrCaleCornerBl,
SP_QsnFrCaleCornerBr,
- SP_QsnFrCaleGSideT,
- SP_QsnFrCaleGSideB,
- SP_QsnFrCaleGSideL,
- SP_QsnFrCaleGSideR,
+ SP_QsnFrCaleSideT,
+ SP_QsnFrCaleSideB,
+ SP_QsnFrCaleSideL,
+ SP_QsnFrCaleSideR,
SP_QsnFrCaleCenter,
SP_QsnFrCaleHeadingCornerTl, // calendar grid header
SP_QsnFrCaleHeadingCornerTr,
@@ -266,24 +284,6 @@ public:
SP_QsnFrPopupSubSideL,
SP_QsnFrPopupSubSideR,
SP_QsnFrPopupSubCenter,
- SP_QsnFrSctrlButtonCornerTl, // Toolbar button
- SP_QsnFrSctrlButtonCornerTr,
- SP_QsnFrSctrlButtonCornerBl,
- SP_QsnFrSctrlButtonCornerBr,
- SP_QsnFrSctrlButtonSideT,
- SP_QsnFrSctrlButtonSideB,
- SP_QsnFrSctrlButtonSideL,
- SP_QsnFrSctrlButtonSideR,
- SP_QsnFrSctrlButtonCenter,
- SP_QsnFrSctrlButtonCornerTlPressed, // Toolbar button, pressed
- SP_QsnFrSctrlButtonCornerTrPressed,
- SP_QsnFrSctrlButtonCornerBlPressed,
- SP_QsnFrSctrlButtonCornerBrPressed,
- SP_QsnFrSctrlButtonSideTPressed,
- SP_QsnFrSctrlButtonSideBPressed,
- SP_QsnFrSctrlButtonSideLPressed,
- SP_QsnFrSctrlButtonSideRPressed,
- SP_QsnFrSctrlButtonCenterPressed,
SP_QsnFrButtonCornerTlInactive, // Inactive button
SP_QsnFrButtonCornerTrInactive,
SP_QsnFrButtonCornerBlInactive,
@@ -310,7 +310,7 @@ public:
SP_QsnFrListSideBPressed,
SP_QsnFrListSideLPressed,
SP_QsnFrListSideRPressed,
- SP_QsnFrListPressed,
+ SP_QsnFrListCenterPressed,
};
enum ColorLists {
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index c1223af..2527662 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -50,17 +50,17 @@
#include "qapplication.h"
#include <w32std.h>
-#include <aknsconstants.h>
+#include <AknsConstants.h>
#include <aknconsts.h>
-#include <aknsitemid.h>
-#include <aknsutils.h>
-#include <aknsdrawutils.h>
-#include <aknsskininstance.h>
-#include <aknsbasicbackgroundcontrolcontext.h>
+#include <AknsItemID.h>
+#include <AknsUtils.h>
+#include <AknsDrawUtils.h>
+#include <AknsSkinInstance.h>
+#include <AknsBasicBackgroundControlContext.h>
#include <avkon.mbg>
#include <aknfontaccess.h>
#include <aknlayoutfont.h>
-#include <aknutils.h>
+#include <AknUtils.h>
#include <aknnavi.h>
#include <gulicon.h>
#include <aknbitmapanimation.h>
@@ -179,7 +179,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QgnGrafBarFrameSideR */ {KAknsIIDQgnGrafBarFrameSideR, EDrawIcon, ES60_All, -1,-1},
/* SP_QgnGrafBarProgress */ {KAknsIIDQgnGrafBarProgress, EDrawIcon, ES60_All, -1,-1},
// No drop area for 3.x non-touch devices
- /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid
+ /* SP_QgnGrafOrgBgGrid */ {KAknsIIDNone, EDrawIcon, ES60_3_X, EAknsMajorGeneric ,0x1eba}, //KAknsIIDQgnGrafOrgBgGrid
/* SP_QgnGrafScrollArrowDown */ {KAknsIIDQgnGrafScrollArrowDown, EDrawGulIcon, ES60_All, -1,-1},
/* SP_QgnGrafScrollArrowLeft */ {KAknsIIDQgnGrafScrollArrowLeft, EDrawGulIcon, ES60_All, -1,-1},
/* SP_QgnGrafScrollArrowRight */ {KAknsIIDQgnGrafScrollArrowRight, EDrawGulIcon, ES60_All, -1,-1},
@@ -214,7 +214,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
// In 3.1 there different slider graphic and no pressed state.
/* SP_QgnGrafNsliderMarker */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x19d1 /* KAknsIIDQgnGrafNsliderMarker */},
/* SP_QgnGrafNsliderMarkerSelected */ {KAknsIIDQgnIndiSliderEdit, EDrawIcon, ES60_3_1, EAknsMajorGeneric, 0x1a4a /* KAknsIIDQgnGrafNsliderMarkerSelected */},
- /* SP_QgnIndiSubMenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
+ /* SP_QgnIndiSubmenu */ {KAknsIIDQgnIndiSubmenu, EDrawIcon, ES60_All, -1,-1},
/* SP_QgnNoteErased */ {KAknsIIDQgnNoteErased, EDrawIcon, ES60_All, -1,-1},
/* SP_QgnNoteError */ {KAknsIIDQgnNoteError, EDrawIcon, ES60_All, -1,-1},
/* SP_QgnNoteInfo */ {KAknsIIDQgnNoteInfo, EDrawIcon, ES60_All, -1,-1},
@@ -227,6 +227,28 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QgnPropFolderSmallNew */ {KAknsIIDQgnPropFolderSmallNew, EDrawIcon, ES60_All, -1,-1},
/* SP_QgnPropPhoneMemcLarge */ {KAknsIIDQgnPropPhoneMemcLarge, EDrawIcon, ES60_All, -1,-1},
+ // Toolbar graphics is different in 3.1/3.2 vs. 5.0
+ /* SP_QgnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
+ /* SP_QgnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
+ /* SP_QgnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
+ /* SP_QgnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
+ /* SP_QgnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
+ /* SP_QgnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
+ /* SP_QgnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
+ /* SP_QgnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
+ /* SP_QgnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
+
+ // No pressed state for toolbar button in 3.1/3.2.
+ /* SP_QgnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQgnFrSctrlButtonCornerTlPressed*/
+ /* SP_QgnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
+ /* SP_QgnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
+ /* SP_QgnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
+ /* SP_QgnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
+ /* SP_QgnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
+ /* SP_QgnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
+ /* SP_QgnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
+ /* SP_QgnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
+
// 3.1 & 3.2 do not have pressed state for scrollbar, so use normal scrollbar graphics instead.
/* SP_QsnCpScrollHandleBottomPressed*/ {KAknsIIDQsnCpScrollHandleBottom, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f8}, /*KAknsIIDQsnCpScrollHandleBottomPressed*/
/* SP_QsnCpScrollHandleMiddlePressed*/ {KAknsIIDQsnCpScrollHandleMiddle, EDrawIcon, ES60_3_X, EAknsMajorGeneric, 0x20f9}, /*KAknsIIDQsnCpScrollHandleMiddlePressed*/
@@ -266,10 +288,10 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QsnFrCaleCornerTr */ {KAknsIIDQsnFrCaleCornerTr, ENoDraw, ES60_All, -1,-1},
/* SP_QsnFrCaleCornerBl */ {KAknsIIDQsnFrCaleCornerBl, ENoDraw, ES60_All, -1,-1},
/* SP_QsnFrCaleCornerBr */ {KAknsIIDQsnFrCaleCornerBr, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleGSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleGSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleGSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
- /* SP_QsnFrCaleGSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleSideT */ {KAknsIIDQsnFrCaleSideT, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleSideB */ {KAknsIIDQsnFrCaleSideB, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleSideL */ {KAknsIIDQsnFrCaleSideL, ENoDraw, ES60_All, -1,-1},
+ /* SP_QsnFrCaleSideR */ {KAknsIIDQsnFrCaleSideR, ENoDraw, ES60_All, -1,-1},
/* SP_QsnFrCaleCenter */ {KAknsIIDQsnFrCaleCenter, ENoDraw, ES60_All, -1,-1},
/* SP_QsnFrCaleHeadingCornerTl */ {KAknsIIDQsnFrCaleHeadingCornerTl, ENoDraw, ES60_All, -1,-1},
@@ -344,28 +366,6 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QsnFrPopupSubSideR */ {KAknsIIDQsnFrPopupSubSideR, ENoDraw, ES60_3_X, -1,-1},
/* SP_QsnFrPopupSubCenter */ {KAknsIIDQsnFrPopupCenterSubmenu, ENoDraw, ES60_3_X, -1,-1},
- // Toolbar graphics is different in 3.1/3.2 vs. 5.0
- /* SP_QsnFrSctrlButtonCornerTl */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2301}, /* KAknsIIDQgnFrSctrlButtonCornerTl*/
- /* SP_QsnFrSctrlButtonCornerTr */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2302},
- /* SP_QsnFrSctrlButtonCornerBl */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2303},
- /* SP_QsnFrSctrlButtonCornerBr */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2304},
- /* SP_QsnFrSctrlButtonSideT */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2305},
- /* SP_QsnFrSctrlButtonSideB */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2306},
- /* SP_QsnFrSctrlButtonSideL */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2307},
- /* SP_QsnFrSctrlButtonSideR */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2308},
- /* SP_QsnFrSctrlButtonCenter */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2309}, /*KAknsIIDQgnFrSctrlButtonCenter*/
-
- // No pressed state for toolbar button in 3.1/3.2.
- /* SP_QsnFrSctrlButtonCornerTlPressed */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2621}, /*KAknsIIDQsnFrSctrlButtonCornerTlPressed*/
- /* SP_QsnFrSctrlButtonCornerTrPressed */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2622},
- /* SP_QsnFrSctrlButtonCornerBlPressed */ {KAknsIIDQsnFrButtonTbCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2623},
- /* SP_QsnFrSctrlButtonCornerBrPressed */ {KAknsIIDQsnFrButtonTbCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2624},
- /* SP_QsnFrSctrlButtonSideTPressed */ {KAknsIIDQsnFrButtonTbSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2625},
- /* SP_QsnFrSctrlButtonSideBPressed */ {KAknsIIDQsnFrButtonTbSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2626},
- /* SP_QsnFrSctrlButtonSideLPressed */ {KAknsIIDQsnFrButtonTbSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2627},
- /* SP_QsnFrSctrlButtonSideRPressed */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2628},
- /* SP_QsnFrSctrlButtonCenterPressed */ {KAknsIIDQsnFrButtonTbCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2629},
-
// No inactive button graphics in 3.1/3.2
/* SP_QsnFrButtonCornerTlInactive */ {KAknsIIDQsnFrButtonTbCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b1}, /*KAknsIIDQsnFrButtonCornerTlInactive*/
/* SP_QsnFrButtonCornerTrInactive */ {KAknsIIDQsnFrButtonTbCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b2},
@@ -397,7 +397,7 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = {
/* SP_QsnFrListSideBPressed */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2690},
/* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691},
/* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692},
- /* SP_QsnFrListPressed */ {KAknsIIDQsnFrList, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693},
+ /* SP_QsnFrListCenterPressed */ {KAknsIIDQsnFrListCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693},
};
QPixmap QS60StyleModeSpecifics::skinnedGraphics(
@@ -514,7 +514,7 @@ void QS60StyleModeSpecifics::fallbackInfo(const QS60StyleEnums::SkinParts &style
case QS60StyleEnums::SP_QgnGrafNsliderMarkerSelected:
fallbackIndex = 17574; /* EMbmAvkonQgn_graf_nslider_marker_selected */
break;
- case QS60StyleEnums::SP_QgnIndiSubMenu:
+ case QS60StyleEnums::SP_QgnIndiSubmenu:
fallbackIndex = EMbmAvkonQgn_indi_submenu;
break;
case QS60StyleEnums::SP_QgnNoteErased:
@@ -1023,8 +1023,14 @@ TRect QS60StyleModeSpecifics::innerRectFromElement(QS60StylePrivate::SkinFrameEl
heightShrink = heightShrink >> 1;
break;
case QS60StylePrivate::SF_ListHighlight:
- widthShrink = widthShrink - 2;
- heightShrink = heightShrink - 2;
+ //In Sym^3 devices highlights are less blocky
+ if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) {
+ widthShrink += 2;
+ heightShrink += 2;
+ } else {
+ widthShrink -= 2;
+ heightShrink -= 2;
+ }
break;
case QS60StylePrivate::SF_PopupBackground:
widthShrink = widthShrink + 5;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index ff29462..e6c36a4 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -145,18 +145,18 @@ struct QtFontEncoding
struct QtFontSize
{
- unsigned short pixelSize;
-
#ifdef Q_WS_X11
- int count;
QtFontEncoding *encodings;
QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0,
uint yres = 0, uint avgwidth = 0, bool add = false);
+ unsigned short count : 16;
#endif // Q_WS_X11
#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
QByteArray fileName;
int fileIndex;
#endif // defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+
+ unsigned short pixelSize : 16;
};
@@ -284,7 +284,12 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add)
if (!add)
return 0;
- if (!(count % 8)) {
+ if (!pixelSizes) {
+ // Most style have only one font size, we avoid waisting memory
+ QtFontSize *newPixelSizes = (QtFontSize *)malloc(sizeof(QtFontSize));
+ Q_CHECK_PTR(newPixelSizes);
+ pixelSizes = newPixelSizes;
+ } else if (!(count % 8) || count == 1) {
QtFontSize *newPixelSizes = (QtFontSize *)
realloc(pixelSizes,
(((count+8) >> 3) << 3) * sizeof(QtFontSize));
@@ -408,7 +413,7 @@ struct QtFontFamily
bool fixedPitchComputed : 1;
#endif
#ifdef Q_WS_X11
- bool symbol_checked;
+ bool symbol_checked : 1;
#endif
QString name;
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 943df7f..0b38aab 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -118,11 +118,10 @@ public:
{
if (!font)
return;
- QS60Data::screenDevice()->ReleaseFont(font);
+ S60->screenDevice()->ReleaseFont(font);
}
};
-private:
#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
RHeap* m_heap;
CFontStore *m_store;
@@ -159,20 +158,32 @@ QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementati
#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
}
-QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
+void qt_cleanup_symbianFontDatabaseExtras()
{
+ const QSymbianFontDatabaseExtrasImplementation *dbExtras =
+ static_cast<const QSymbianFontDatabaseExtrasImplementation*>(privateDb()->symbianExtras);
+ if (!dbExtras)
+ return; // initializeDb() has never been called
#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
- qDeleteAll(m_extrasHash);
+ qDeleteAll(dbExtras->m_extrasHash);
#else // Q_SYMBIAN_HAS_FONTTABLE_API
typedef QList<const QSymbianTypeFaceExtras *>::iterator iterator;
- for (iterator p = m_extras.begin(); p != m_extras.end(); ++p) {
- m_store->ReleaseFont((*p)->fontOwner());
+ for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) {
+ dbExtras->m_store->ReleaseFont((*p)->fontOwner());
delete *p;
}
+ dbExtras->m_extras.clear();
+#endif // Q_SYMBIAN_HAS_FONTTABLE_API
+ dbExtras->m_extrasHash.clear();
+}
+QSymbianFontDatabaseExtrasImplementation::~QSymbianFontDatabaseExtrasImplementation()
+{
+ qt_cleanup_symbianFontDatabaseExtras();
+#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
delete m_store;
m_heap->Close();
-#endif // Q_SYMBIAN_HAS_FONTTABLE_API
+#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
}
#ifndef FNTSTORE_H_INLINES_SUPPORT_FMM
@@ -205,7 +216,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
CFont* font = NULL;
#ifdef Q_SYMBIAN_HAS_FONTTABLE_API
- const TInt err = QS60Data::screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
+ const TInt err = S60->screenDevice()->GetNearestFontToDesignHeightInPixels(font, searchSpec);
Q_ASSERT(err == KErrNone && font);
QScopedPointer<CFont, CFontFromScreenDeviceReleaser> sFont(font);
QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font);
@@ -260,17 +271,19 @@ QFontEngineFTS60::QFontEngineFTS60(const QFontDef &fd)
*/
qreal QFontEngineS60::pixelsToPoints(qreal pixels, Qt::Orientation orientation)
{
+ CWsScreenDevice* device = S60->screenDevice();
return (orientation == Qt::Horizontal?
- S60->screenDevice()->HorizontalPixelsToTwips(pixels)
- :S60->screenDevice()->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint;
+ device->HorizontalPixelsToTwips(pixels)
+ :device->VerticalPixelsToTwips(pixels)) / KTwipsPerPoint;
}
qreal QFontEngineS60::pointsToPixels(qreal points, Qt::Orientation orientation)
{
+ CWsScreenDevice* device = S60->screenDevice();
const int twips = points * KTwipsPerPoint;
return orientation == Qt::Horizontal?
- S60->screenDevice()->HorizontalTwipsToPixels(twips)
- :S60->screenDevice()->VerticalTwipsToPixels(twips);
+ device->HorizontalTwipsToPixels(twips)
+ :device->VerticalTwipsToPixels(twips);
}
QFontEngineMultiS60::QFontEngineMultiS60(QFontEngine *first, int script, const QStringList &fallbackFamilies)
@@ -309,16 +322,16 @@ static void initializeDb()
QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
- const int numTypeFaces = QS60Data::screenDevice()->NumTypefaces();
+ const int numTypeFaces = S60->screenDevice()->NumTypefaces();
const QSymbianFontDatabaseExtrasImplementation *dbExtras =
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
bool fontAdded = false;
for (int i = 0; i < numTypeFaces; i++) {
TTypefaceSupport typefaceSupport;
- QS60Data::screenDevice()->TypefaceSupport(typefaceSupport, i);
+ S60->screenDevice()->TypefaceSupport(typefaceSupport, i);
CFont *font; // We have to get a font instance in order to know all the details
TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
- if (QS60Data::screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
+ if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
continue;
QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font);
if (font->TypeUid() == KCFbsFontUid) {
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 7376893..7a8b1e5 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -690,7 +690,7 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format)
if (fake_oblique)
transform = true;
// fake bold
- if ((fontDef.weight == QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD))
+ if ((fontDef.weight == QFont::Bold) && !(face->style_flags & FT_STYLE_FLAG_BOLD) && !FT_IS_FIXED_WIDTH(face))
embolden = true;
// underline metrics
line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index c9b5655..f6b8758 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -237,7 +237,8 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
*nglyphs = len;
for (int i = 0; i < len; ++i) {
outGlyphs[i] = 0;
- logClusters[i] = i;
+ if (logClusters)
+ logClusters[i] = i;
outAdvances_x[i] = QFixed();
outAdvances_y[i] = QFixed();
outAttributes[i].clusterStart = true;
@@ -347,7 +348,29 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay
bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
int *nglyphs, QTextEngine::ShaperFlags flags) const
{
- return stringToCMap(str, len, glyphs, nglyphs, flags, 0, 0);
+ *nglyphs = len;
+ QVarLengthArray<CGGlyph> cgGlyphs(len);
+ CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len);
+
+ for (int i = 0; i < len; ++i)
+ glyphs->glyphs[i] = cgGlyphs[i];
+
+ if (flags & QTextEngine::GlyphIndicesOnly)
+ return true;
+
+ QVarLengthArray<CGSize> advances(len);
+ CTFontGetAdvancesForGlyphs(ctfont, kCTFontHorizontalOrientation, cgGlyphs.data(), advances.data(), len);
+
+ for (int i = 0; i < len; ++i) {
+ glyphs->advances_x[i] = QFixed::fromReal(advances[i].width);
+ glyphs->advances_y[i] = QFixed::fromReal(advances[i].height);
+ if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
+ glyphs->advances_x[i] = glyphs->advances_x[i].round();
+ glyphs->advances_y[i] = glyphs->advances_y[i].round();
+ }
+ }
+
+ return true;
}
void QCoreTextFontEngineMulti::recalcAdvances(int , QGlyphLayout *, QTextEngine::ShaperFlags) const
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 925b3bf..f691413 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -66,7 +66,7 @@ QSymbianTypeFaceExtras::QSymbianTypeFaceExtras(CFont* cFont, COpenFont *openFont
QSymbianTypeFaceExtras::~QSymbianTypeFaceExtras()
{
- QS60Data::screenDevice()->ReleaseFont(m_cFont);
+ S60->screenDevice()->ReleaseFont(m_cFont);
}
QByteArray QSymbianTypeFaceExtras::getSfntTable(uint tag) const
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 10870aa..91a6612 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -324,6 +324,26 @@ QStaticText::PerformanceHint QStaticText::performanceHint() const
}
/*!
+ Sets the text option structure that controls the layout process to the given \a textOption.
+
+ \sa textOption()
+*/
+void QStaticText::setTextOption(const QTextOption &textOption)
+{
+ detach();
+ data->textOption = textOption;
+ data->invalidate();
+}
+
+/*!
+ Returns the current text option used to control the layout process.
+*/
+QTextOption QStaticText::textOption() const
+{
+ return data->textOption;
+}
+
+/*!
Sets the preferred width for this QStaticText. If the text is wider than the specified width,
it will be broken into multiple lines and grow vertically. If the text cannot be split into
multiple lines, it will be larger than the specified \a textWidth.
@@ -401,7 +421,7 @@ namespace {
class DrawTextItemRecorder: public QPaintEngine
{
public:
- DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations, int numChars)
+ DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations)
: m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
m_untransformedCoordinates(untransformedCoordinates)
{
@@ -498,11 +518,10 @@ namespace {
class DrawTextItemDevice: public QPaintDevice
{
public:
- DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations,
- int numChars)
+ DrawTextItemDevice(bool untransformedCoordinates, bool useBackendOptimizations)
{
m_paintEngine = new DrawTextItemRecorder(untransformedCoordinates,
- useBackendOptimizations, numChars);
+ useBackendOptimizations);
}
~DrawTextItemDevice()
@@ -580,6 +599,7 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
QTextLayout textLayout;
textLayout.setText(text);
textLayout.setFont(font);
+ textLayout.setTextOption(textOption);
qreal leading = QFontMetricsF(font).leading();
qreal height = -leading;
@@ -610,21 +630,26 @@ void QStaticTextPrivate::paintText(const QPointF &topLeftPosition, QPainter *p)
.arg(QString::number(color.blue(), 16), 2, QLatin1Char('0')));
#endif
document.setDefaultFont(font);
- document.setDocumentMargin(0.0);
- if (textWidth >= 0.0)
- document.setTextWidth(textWidth);
+ document.setDocumentMargin(0.0);
#ifndef QT_NO_TEXTHTMLPARSER
document.setHtml(text);
#else
document.setPlainText(text);
#endif
+ if (textWidth >= 0.0)
+ document.setTextWidth(textWidth);
+ else
+ document.adjustSize();
+ document.setDefaultTextOption(textOption);
- document.adjustSize();
p->save();
p->translate(topLeftPosition);
document.drawContents(p);
p->restore();
+ if (textWidth >= 0.0)
+ document.adjustSize(); // Find optimal size
+
actualSize = document.size();
}
}
@@ -638,7 +663,7 @@ void QStaticTextPrivate::init()
position = QPointF(0, 0);
- DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations, text.size());
+ DrawTextItemDevice device(untransformedCoordinates, useBackendOptimizations);
{
QPainter painter(&device);
painter.setFont(font);
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index f3bef93..4febde2 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -48,7 +48,7 @@
#include <QtGui/qtransform.h>
#include <QtGui/qfont.h>
-
+#include <QtGui/qtextoption.h>
QT_BEGIN_HEADER
@@ -79,6 +79,9 @@ public:
void setTextWidth(qreal textWidth);
qreal textWidth() const;
+ void setTextOption(const QTextOption &textOption);
+ QTextOption textOption() const;
+
QSizeF size() const;
void prepare(const QTransform &matrix = QTransform(), const QFont &font = QFont());
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index 1a96291..cb60626 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -53,6 +53,8 @@
// We mean it.
//
+#include "qstatictext.h"
+
#include <private/qtextureglyphcache_p.h>
#include <QtGui/qcolor.h>
@@ -148,12 +150,14 @@ public:
QFixedPoint *positionPool; // 4 bytes per text
QChar *charPool; // 4 bytes per text
+ QTextOption textOption; // 28 bytes per text
+
unsigned char needsRelayout : 1; // 1 byte per text
unsigned char useBackendOptimizations : 1;
unsigned char textFormat : 2;
unsigned char untransformedCoordinates : 1;
// ================
- // 167 bytes per text
+ // 195 bytes per text
static QStaticTextPrivate *get(const QStaticText *q);
};
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index d6ac3aa..a9caa6b 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -362,7 +362,7 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
QTextBlock blockIt = block();
if (op >= QTextCursor::Left && op <= QTextCursor::WordRight
- && blockIt.blockFormat().layoutDirection() == Qt::RightToLeft) {
+ && blockIt.textDirection() == Qt::RightToLeft) {
if (op == QTextCursor::Left)
op = QTextCursor::NextCharacter;
else if (op == QTextCursor::Right)
@@ -2437,6 +2437,9 @@ void QTextCursor::beginEditBlock()
if (!d || !d->priv)
return;
+ if (d->priv->editBlock == 0) // we are the initial edit block, store current cursor position for undo
+ d->priv->editBlockCursorPosition = d->position;
+
d->priv->beginEditBlock();
}
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 6132d10..ac735e1 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -127,6 +127,8 @@ bool Qt::mightBeRichText(const QString& text)
tag += text[i];
else if (!tag.isEmpty() && text[i].isSpace())
break;
+ else if (!tag.isEmpty() && text[i] == QLatin1Char('/') && i + 1 == close)
+ break;
else if (!text[i].isSpace() && (!tag.isEmpty() || text[i] != QLatin1Char('!')))
return false; // that's not a tag
}
@@ -2498,13 +2500,10 @@ void QTextHtmlExporter::emitBlockAttributes(const QTextBlock &block)
QTextBlockFormat format = block.blockFormat();
emitAlignment(format.alignment());
- Qt::LayoutDirection dir = format.layoutDirection();
- if (dir == Qt::LeftToRight) {
- // assume default to not bloat the html too much
- // html += QLatin1String(" dir='ltr'");
- } else {
+ // assume default to not bloat the html too much
+ // html += QLatin1String(" dir='ltr'");
+ if (block.textDirection() == Qt::RightToLeft)
html += QLatin1String(" dir='rtl'");
- }
QLatin1String style(" style=\"");
html += style;
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index e2bca04..f3cd481 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -192,6 +192,7 @@ QTextDocumentPrivate::QTextDocumentPrivate()
initialBlockCharFormatIndex(-1) // set correctly later in init()
{
editBlock = 0;
+ editBlockCursorPosition = -1;
docChangeFrom = -1;
undoState = 0;
@@ -967,6 +968,10 @@ int QTextDocumentPrivate::undoRedo(bool undo)
editPos = -1;
break;
}
+ case QTextUndoCommand::CursorMoved:
+ editPos = c.pos;
+ editLength = 0;
+ break;
case QTextUndoCommand::Custom:
resetBlockRevision = -1; // ## TODO
if (undo)
@@ -1046,6 +1051,18 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c)
if (undoState < undoStack.size())
clearUndoRedoStacks(QTextDocument::RedoStack);
+ if (editBlock != 0 && editBlockCursorPosition >= 0) { // we had a beginEditBlock() with a cursor position
+ if (c.pos != (quint32) editBlockCursorPosition) { // and that cursor position is different from the command
+ // generate a CursorMoved undo item
+ QT_INIT_TEXTUNDOCOMMAND(cc, QTextUndoCommand::CursorMoved, true, QTextUndoCommand::MoveCursor,
+ 0, 0, editBlockCursorPosition, 0, 0);
+ undoStack.append(cc);
+ undoState++;
+ editBlockCursorPosition = -1;
+ }
+ }
+
+
if (!undoStack.isEmpty() && modified) {
QTextUndoCommand &last = undoStack[undoState - 1];
@@ -1167,6 +1184,8 @@ void QTextDocumentPrivate::endEditBlock()
}
}
+ editBlockCursorPosition = -1;
+
finishEdit();
}
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index ac5ed3c..d1bd698 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -132,6 +132,7 @@ public:
BlockAdded = 6,
BlockDeleted = 7,
GroupFormatChange = 8,
+ CursorMoved = 9,
Custom = 256
};
enum Operation {
@@ -315,6 +316,7 @@ private:
bool modified;
int editBlock;
+ int editBlockCursorPosition;
int docChangeFrom;
int docChangeOldLength;
int docChangeLength;
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index eeb66ce..ff14490 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -1369,9 +1369,7 @@ void QTextDocumentLayoutPrivate::drawListItem(const QPointF &offset, QPainter *p
QTextLine firstLine = layout->lineAt(0);
Q_ASSERT(firstLine.isValid());
QPointF pos = (offset + layout->position()).toPoint();
- Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
- if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
- dir = blockFormat.layoutDirection();
+ Qt::LayoutDirection dir = bl.textDirection();
{
QRectF textRect = firstLine.naturalTextRect();
pos += textRect.topLeft().toPoint();
@@ -2530,9 +2528,7 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi
//QTextFrameData *fd = data(layoutStruct->frame);
- Qt::LayoutDirection dir = docPrivate->defaultTextOption.textDirection();
- if (blockFormat.hasProperty(QTextFormat::LayoutDirection))
- dir = blockFormat.layoutDirection();
+ Qt::LayoutDirection dir = bl.textDirection();
QFixed extraMargin;
if (docPrivate->defaultTextOption.flags() & QTextOption::AddSpaceForLineAndParagraphSeparators) {
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 054067c..f892adc 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1404,7 +1404,10 @@ void QTextEngine::itemize() const
#else
bool ignore = ignoreBidi;
#endif
- if (!ignore && option.textDirection() == Qt::LeftToRight) {
+
+ bool rtl = isRightToLeft();
+
+ if (!ignore && !rtl) {
ignore = true;
const QChar *start = layoutData->string.unicode();
const QChar * const end = start + length;
@@ -1420,7 +1423,7 @@ void QTextEngine::itemize() const
QVarLengthArray<QScriptAnalysis, 4096> scriptAnalysis(length);
QScriptAnalysis *analysis = scriptAnalysis.data();
- QBidiControl control(option.textDirection() == Qt::RightToLeft);
+ QBidiControl control(rtl);
if (ignore) {
memset(analysis, 0, length*sizeof(QScriptAnalysis));
@@ -1515,6 +1518,23 @@ void QTextEngine::itemize() const
resolveAdditionalFormats();
}
+bool QTextEngine::isRightToLeft() const
+{
+ switch (option.textDirection()) {
+ case Qt::LeftToRight:
+ return false;
+ case Qt::RightToLeft:
+ return true;
+ default:
+ break;
+ }
+ // this places the cursor in the right position depending on the keyboard layout
+ if (layoutData->string.isEmpty())
+ return QApplication::keyboardInputDirection() == Qt::RightToLeft;
+ return layoutData->string.isRightToLeft();
+}
+
+
int QTextEngine::findItem(int strPos) const
{
itemize();
@@ -2516,7 +2536,7 @@ QFixed QTextEngine::calculateTabWidth(int item, QFixed x) const
QList<QTextOption::Tab> tabArray = option.tabs();
if (!tabArray.isEmpty()) {
- if (option.textDirection() == Qt::RightToLeft) { // rebase the tabArray positions.
+ if (isRightToLeft()) { // rebase the tabArray positions.
QList<QTextOption::Tab> newTabs;
QList<QTextOption::Tab>::Iterator iter = tabArray.begin();
while(iter != tabArray.end()) {
@@ -2655,7 +2675,7 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo
QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe)
: flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline),
- num_chars(0), chars(0), logClusters(0), f(font), fontEngine(fe), glyphs(g)
+ num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe)
{
}
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index 00b1392..908a0ec 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -458,6 +458,7 @@ public:
void validate() const;
void itemize() const;
+ bool isRightToLeft() const;
static void bidiReorder(int numRuns, const quint8 *levels, int *visualOrder);
const HB_CharAttributes *attributes() const;
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 140cf43..46db253 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -900,11 +900,14 @@ bool QTextFormat::boolProperty(int propertyId) const
*/
int QTextFormat::intProperty(int propertyId) const
{
+ // required, since the default layout direction has to be LayoutDirectionAuto, which is not integer 0
+ int def = (propertyId == QTextFormat::LayoutDirection) ? int(Qt::LayoutDirectionAuto) : 0;
+
if (!d)
- return 0;
+ return def;
const QVariant prop = d->property(propertyId);
if (prop.userType() != QVariant::Int)
- return 0;
+ return def;
return prop.toInt();
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index c1a33e7..0df3c2e 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -71,7 +71,7 @@ static inline QFixed leadingSpaceWidth(QTextEngine *eng, const QScriptLine &line
if (!line.hasTrailingSpaces
|| (eng->option.flags() & QTextOption::IncludeTrailingSpaces)
|| !(eng->option.alignment() & Qt::AlignRight)
- || (eng->option.textDirection() != Qt::RightToLeft))
+ || !eng->isRightToLeft())
return QFixed();
int pos = line.length;
@@ -88,7 +88,7 @@ static QFixed alignLine(QTextEngine *eng, const QScriptLine &line)
// if width is QFIXED_MAX that means we used setNumColumns() and that implicitly makes this line left aligned.
if (!line.justified && line.width != QFIXED_MAX) {
int align = eng->option.alignment();
- if (align & Qt::AlignJustify && eng->option.textDirection() == Qt::RightToLeft)
+ if (align & Qt::AlignJustify && eng->isRightToLeft())
align = Qt::AlignRight;
if (align & Qt::AlignRight)
x = line.width - (line.textAdvance + leadingSpaceWidth(eng, line));
@@ -283,12 +283,11 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
\class QTextLayout
\reentrant
- \brief The QTextLayout class is used to lay out and paint a single
- paragraph of text.
+ \brief The QTextLayout class is used to lay out and render text.
\ingroup richtext-processing
- It offers most features expected from a modern text layout
+ It offers many features expected from a modern text layout
engine, including Unicode compliant rendering, line breaking and
handling of cursor positioning. It can also produce and render
device independent layout, something that is important for WYSIWYG
@@ -298,29 +297,33 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const
implement your own text rendering for some specialized widget, you
probably won't need to use it directly.
- QTextLayout can currently deal with plain text and rich text
- paragraphs that are part of a QTextDocument.
+ QTextLayout can be used with both plain and rich text.
- QTextLayout can be used to create a sequence of QTextLine's with
- given widths and can position them independently on the screen.
- Once the layout is done, these lines can be drawn on a paint
- device.
+ QTextLayout can be used to create a sequence of QTextLine
+ instances with given widths and can position them independently
+ on the screen. Once the layout is done, these lines can be drawn
+ on a paint device.
- Here's some code snippet that presents the layout phase:
+ The text to be laid out can be provided in the constructor or set with
+ setText().
+
+ The layout can be seen as a sequence of QTextLine objects; use createLine()
+ to create a QTextLine instance, and lineAt() or lineForTextPosition() to retrieve
+ created lines.
+
+ Here is a code snippet that demonstrates the layout phase:
\snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0
- The text can be drawn by calling the layout's draw() function:
+ The text can then be rendered by calling the layout's draw() function:
\snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1
- The text layout's text is set in the constructor or with
- setText(). The layout can be seen as a sequence of QTextLine
- objects; use lineAt() or lineForTextPosition() to get a QTextLine,
- createLine() to create one. For a given position in the text you
- can find a valid cursor position with isValidCursorPosition(),
- nextCursorPosition(), and previousCursorPosition(). The layout
- itself can be positioned with setPosition(); it has a
- boundingRect(), and a minimumWidth() and a maximumWidth(). A text
- layout can be drawn on a painter device using draw().
+ For a given position in the text you can find a valid cursor position with
+ isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition().
+
+ The QTextLayout itself can be positioned with setPosition(); it has a
+ boundingRect(), and a minimumWidth() and a maximumWidth().
+
+ \sa QStaticText
*/
/*!
@@ -1364,7 +1367,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
int itm = d->findItem(cursorPosition - 1);
QFixed base = sl.base();
QFixed descent = sl.descent;
- bool rightToLeft = (d->option.textDirection() == Qt::RightToLeft);
+ bool rightToLeft = d->isRightToLeft();
if (itm >= 0) {
const QScriptItem &si = d->layoutData->items.at(itm);
if (si.ascent > 0)
@@ -1691,7 +1694,7 @@ namespace {
{
LineBreakHelper()
: glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0),
- manualWrap(false)
+ manualWrap(false), whiteSpaceOrObject(true)
{
}
@@ -1714,6 +1717,7 @@ namespace {
const unsigned short *logClusters;
bool manualWrap;
+ bool whiteSpaceOrObject;
bool checkFullOtherwiseExtend(QScriptLine &line);
@@ -1723,8 +1727,10 @@ namespace {
}
inline glyph_t currentGlyph() const
- {
+ {
Q_ASSERT(currentPosition > 0);
+ Q_ASSERT(logClusters[currentPosition - 1] < glyphs.numGlyphs);
+
return glyphs.glyphs[logClusters[currentPosition - 1]];
}
@@ -1870,6 +1876,7 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.tmpData.descent = qMax(lbh.tmpData.descent, current.descent);
if (current.analysis.flags == QScriptAnalysis::Tab && (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))) {
+ lbh.whiteSpaceOrObject = true;
if (lbh.checkFullOtherwiseExtend(line))
goto found;
@@ -1886,6 +1893,7 @@ void QTextLine::layout_helper(int maxGlyphs)
if (lbh.checkFullOtherwiseExtend(line))
goto found;
} else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) {
+ lbh.whiteSpaceOrObject = true;
// if the line consists only of the line separator make sure
// we have a sane height
if (!line.length && !lbh.tmpData.length)
@@ -1899,6 +1907,7 @@ void QTextLine::layout_helper(int maxGlyphs)
line += lbh.tmpData;
goto found;
} else if (current.analysis.flags == QScriptAnalysis::Object) {
+ lbh.whiteSpaceOrObject = true;
lbh.tmpData.length++;
QTextFormat format = eng->formats()->format(eng->formatIndex(&eng->layoutData->items[item]));
@@ -1912,6 +1921,7 @@ void QTextLine::layout_helper(int maxGlyphs)
if (lbh.checkFullOtherwiseExtend(line))
goto found;
} else if (attributes[lbh.currentPosition].whiteSpace) {
+ lbh.whiteSpaceOrObject = true;
while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace)
addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount,
current, lbh.logClusters, lbh.glyphs);
@@ -1921,6 +1931,7 @@ void QTextLine::layout_helper(int maxGlyphs)
goto found;
}
} else {
+ lbh.whiteSpaceOrObject = false;
bool sb_or_ws = false;
do {
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
@@ -1982,7 +1993,7 @@ void QTextLine::layout_helper(int maxGlyphs)
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
found:
- if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted
+ if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted
lbh.adjustRightBearing();
line.textAdvance = line.textWidth;
line.textWidth -= qMin(QFixed(), lbh.rightBearing);
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 2986ee7..a0ff520 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -262,7 +262,7 @@ QString QTextList::itemText(const QTextBlock &blockIt) const
default:
Q_ASSERT(false);
}
- if (blockFormat.layoutDirection() == Qt::RightToLeft)
+ if (blockIt.textDirection() == Qt::RightToLeft)
return result.prepend(QLatin1Char('.'));
return result + QLatin1Char('.');
}
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 088eb98..f386871 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -1140,6 +1140,49 @@ int QTextBlock::charFormatIndex() const
}
/*!
+ \since 4.7
+
+ Returns the resolved text direction.
+
+ If the block has no explicit direction set, it will resolve the
+ direction from the blocks content. Returns either Qt::LeftToRight
+ or Qt::RightToLeft.
+
+ \sa QTextBlock::layoutDirection(), QString::isRightToLeft(), Qt::LayoutDirection
+*/
+Qt::LayoutDirection QTextBlock::textDirection() const
+{
+ Qt::LayoutDirection dir = blockFormat().layoutDirection();
+ if (dir != Qt::LayoutDirectionAuto)
+ return dir;
+
+ const QString buffer = p->buffer();
+
+ const int pos = position();
+ QTextDocumentPrivate::FragmentIterator it = p->find(pos);
+ QTextDocumentPrivate::FragmentIterator end = p->find(pos + length() - 1); // -1 to omit the block separator char
+ for (; it != end; ++it) {
+ const QTextFragmentData * const frag = it.value();
+ const QChar *p = buffer.constData() + frag->stringPosition;
+ const QChar * const end = p + frag->size_array[0];
+ while (p < end) {
+ switch(QChar::direction(p->unicode()))
+ {
+ case QChar::DirL:
+ return Qt::LeftToRight;
+ case QChar::DirR:
+ case QChar::DirAL:
+ return Qt::RightToLeft;
+ default:
+ break;
+ }
+ ++p;
+ }
+ }
+ return Qt::LeftToRight;
+}
+
+/*!
Returns the block's contents as plain text.
\sa length() charFormat() blockFormat()
diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h
index 67f67d8..a573a26 100644
--- a/src/gui/text/qtextobject.h
+++ b/src/gui/text/qtextobject.h
@@ -221,6 +221,8 @@ public:
QTextCharFormat charFormat() const;
int charFormatIndex() const;
+ Qt::LayoutDirection textDirection() const;
+
QString text() const;
const QTextDocument *document() const;
diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp
index c1e254c..8f31e46 100644
--- a/src/gui/text/qtextoption.cpp
+++ b/src/gui/text/qtextoption.cpp
@@ -65,7 +65,7 @@ QTextOption::QTextOption()
tab(-1),
d(0)
{
- direction = QApplication::layoutDirection();
+ direction = Qt::LayoutDirectionAuto;
}
/*!
@@ -145,7 +145,7 @@ QTextOption &QTextOption::operator=(const QTextOption &o)
\sa tabArray(), setTabStop(), setTabs()
*/
-void QTextOption::setTabArray(QList<qreal> tabStops)
+void QTextOption::setTabArray(QList<qreal> tabStops) // Qt5: const ref
{
if (!d)
d = new QTextOptionPrivate;
@@ -165,7 +165,7 @@ void QTextOption::setTabArray(QList<qreal> tabStops)
\sa tabStops()
*/
-void QTextOption::setTabs(QList<QTextOption::Tab> tabStops)
+void QTextOption::setTabs(QList<QTextOption::Tab> tabStops) // Qt5: const ref
{
if (!d)
d = new QTextOptionPrivate;
@@ -391,6 +391,12 @@ QList<QTextOption::Tab> QTextOption::tabs() const
*/
/*!
+ \fn Tab::Tab(qreal pos, TabType tabType, QChar delim = QChar())
+ Creates a tab with the given position, tab type, and (for DelimiterTab) delimiter
+ \since 4.7
+*/
+
+/*!
\fn bool Tab::operator==(const Tab &other) const
Returns true if tab \a other is equal to this tab;
diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h
index 1381ed1..a48efc1 100644
--- a/src/gui/text/qtextoption.h
+++ b/src/gui/text/qtextoption.h
@@ -68,6 +68,8 @@ public:
struct Q_GUI_EXPORT Tab {
inline Tab() : position(80), type(QTextOption::LeftTab) { }
+ inline Tab(qreal pos, TabType tabType, QChar delim = QChar())
+ : position(pos), type(tabType), delimiter(delim) {}
inline bool operator==(const Tab &other) const {
return type == other.type
@@ -134,8 +136,8 @@ private:
uint align : 8;
uint wordWrap : 4;
uint design : 1;
- uint direction : 1;
- uint unused : 19;
+ uint direction : 2;
+ uint unused : 18;
uint f;
qreal tab;
QTextOptionPrivate *d;
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index 4e1e9fa..889fb2c 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -141,7 +141,8 @@ contains(QT_CONFIG, freetype) {
../3rdparty/freetype/src/base/ftinit.c \
../3rdparty/freetype/src/base/ftmm.c \
../3rdparty/freetype/src/base/fttype1.c \
- ../3rdparty/freetype/src/base/ftbitmap.c\
+ ../3rdparty/freetype/src/base/ftsynth.c \
+ ../3rdparty/freetype/src/base/ftbitmap.c \
../3rdparty/freetype/src/bdf/bdf.c \
../3rdparty/freetype/src/cache/ftcache.c \
../3rdparty/freetype/src/cff/cff.c \
diff --git a/src/gui/util/qsystemtrayicon.cpp b/src/gui/util/qsystemtrayicon.cpp
index d7dde87..941961b 100644
--- a/src/gui/util/qsystemtrayicon.cpp
+++ b/src/gui/util/qsystemtrayicon.cpp
@@ -356,10 +356,7 @@ bool QSystemTrayIcon::isSystemTrayAvailable()
*/
bool QSystemTrayIcon::supportsMessages()
{
-#if defined(Q_WS_QWS)
- return false;
-#endif
- return true;
+ return QSystemTrayIconPrivate::supportsMessages_sys();
}
/*!
diff --git a/src/gui/util/qsystemtrayicon_mac.mm b/src/gui/util/qsystemtrayicon_mac.mm
index 8aaaa0f..22134cb 100644
--- a/src/gui/util/qsystemtrayicon_mac.mm
+++ b/src/gui/util/qsystemtrayicon_mac.mm
@@ -226,6 +226,11 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
return true;
}
+bool QSystemTrayIconPrivate::supportsMessages_sys()
+{
+ return true;
+}
+
void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon icon, int)
{
diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h
index e8bf197..4592e43 100644
--- a/src/gui/util/qsystemtrayicon_p.h
+++ b/src/gui/util/qsystemtrayicon_p.h
@@ -83,7 +83,9 @@ public:
void updateMenu_sys();
QRect geometry_sys() const;
void showMessage_sys(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs);
+
static bool isSystemTrayAvailable_sys();
+ static bool supportsMessages_sys();
QPointer<QMenu> menu;
QIcon icon;
diff --git a/src/gui/util/qsystemtrayicon_qws.cpp b/src/gui/util/qsystemtrayicon_qws.cpp
index b1b895b..cda47aa 100644
--- a/src/gui/util/qsystemtrayicon_qws.cpp
+++ b/src/gui/util/qsystemtrayicon_qws.cpp
@@ -75,6 +75,11 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
return false;
}
+bool QSystemTrayIconPrivate::supportsMessages_sys()
+{
+ return false;
+}
+
void QSystemTrayIconPrivate::showMessage_sys(const QString &message,
const QString &title,
QSystemTrayIcon::MessageIcon icon,
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index c89fbae..a9585b9 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -41,23 +41,21 @@
#include "qsystemtrayicon_p.h"
#ifndef QT_NO_SYSTEMTRAYICON
-#define _WIN32_IE 0x0600 //required for NOTIFYICONDATA_V2_SIZE
-//missing defines for MINGW :
-#ifndef NIN_BALLOONTIMEOUT
-#define NIN_BALLOONTIMEOUT (WM_USER + 4)
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0600
#endif
-#ifndef NIN_BALLOONUSERCLICK
-#define NIN_BALLOONUSERCLICK (WM_USER + 5)
+
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x600
#endif
#include <qt_windows.h>
+#include <windowsx.h>
#include <commctrl.h>
-#include <QBitmap>
+
#include <QLibrary>
#include <QApplication>
-#include <QToolTip>
-#include <QDesktopWidget>
#include <QSettings>
QT_BEGIN_NAMESPACE
@@ -74,6 +72,30 @@ struct Q_NOTIFYICONIDENTIFIER {
GUID guidItem;
};
+#ifndef NOTIFYICON_VERSION_4
+#define NOTIFYICON_VERSION_4 4
+#endif
+
+#ifndef NIN_SELECT
+#define NIN_SELECT (WM_USER + 0)
+#endif
+
+#ifndef NIN_KEYSELECT
+#define NIN_KEYSELECT (WM_USER + 1)
+#endif
+
+#ifndef NIN_BALLOONTIMEOUT
+#define NIN_BALLOONTIMEOUT (WM_USER + 4)
+#endif
+
+#ifndef NIN_BALLOONUSERCLICK
+#define NIN_BALLOONUSERCLICK (WM_USER + 5)
+#endif
+
+#ifndef NIF_SHOWTIP
+#define NIF_SHOWTIP 0x00000080
+#endif
+
#define Q_MSGFLT_ALLOW 1
typedef HRESULT (WINAPI *PtrShell_NotifyIconGetRect)(const Q_NOTIFYICONIDENTIFIER* identifier, RECT* iconLocation);
@@ -87,11 +109,8 @@ public:
~QSystemTrayIconSys();
bool winEvent( MSG *m, long *result );
bool trayMessage(DWORD msg);
- bool iconDrawItem(LPDRAWITEMSTRUCT lpdi);
void setIconContents(NOTIFYICONDATA &data);
bool showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs);
- bool allowsMessages();
- bool supportsMessages();
QRect findIconGeometry(const int a_iButtonID);
void createIcon();
HICON hIcon;
@@ -100,10 +119,11 @@ public:
private:
uint notifyIconSize;
int maxTipLength;
+ int version;
bool ignoreNextMouseRelease;
};
-bool QSystemTrayIconSys::allowsMessages()
+static bool allowsMessages()
{
#ifndef QT_NO_SETTINGS
QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Software\\Microsoft"
@@ -114,16 +134,18 @@ bool QSystemTrayIconSys::allowsMessages()
#endif
}
-bool QSystemTrayIconSys::supportsMessages()
-{
- return allowsMessages();
-}
-
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
: hIcon(0), q(object), ignoreNextMouseRelease(false)
{
- notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE;
+ if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) {
+ notifyIconSize = sizeof(NOTIFYICONDATA);
+ version = NOTIFYICON_VERSION_4;
+ } else {
+ notifyIconSize = NOTIFYICONDATA_V2_SIZE;
+ version = NOTIFYICON_VERSION;
+ }
+
maxTipLength = 128;
// For restoring the tray icon after explorer crashes
@@ -157,7 +179,7 @@ QSystemTrayIconSys::~QSystemTrayIconSys()
void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
{
- tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
+ tnd.uFlags |= NIF_MESSAGE | NIF_ICON | NIF_TIP;
tnd.uCallbackMessage = MYWM_NOTIFYICON;
tnd.hIcon = hIcon;
QString tip = q->toolTip();
@@ -170,7 +192,6 @@ void QSystemTrayIconSys::setIconContents(NOTIFYICONDATA &tnd)
static int iconFlag( QSystemTrayIcon::MessageIcon icon )
{
-#if NOTIFYICON_VERSION >= 3
switch (icon) {
case QSystemTrayIcon::Information:
return NIIF_INFO;
@@ -184,20 +205,13 @@ static int iconFlag( QSystemTrayIcon::MessageIcon icon )
Q_ASSERT_X(false, "QSystemTrayIconSys::showMessage", "Invalid QSystemTrayIcon::MessageIcon value");
return NIIF_NONE;
}
-#else
- Q_UNUSED(icon);
- return 0;
-#endif
}
bool QSystemTrayIconSys::showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs)
{
-#if NOTIFYICON_VERSION >= 3
NOTIFYICONDATA tnd;
memset(&tnd, 0, notifyIconSize);
- Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- setIconContents(tnd);
memcpy(tnd.szInfo, message.utf16(), qMin(message.length() + 1, 256) * sizeof(wchar_t));
memcpy(tnd.szInfoTitle, title.utf16(), qMin(title.length() + 1, 64) * sizeof(wchar_t));
@@ -206,42 +220,36 @@ bool QSystemTrayIconSys::showMessage(const QString &title, const QString &messag
tnd.cbSize = notifyIconSize;
tnd.hWnd = winId();
tnd.uTimeout = uSecs;
- tnd.uFlags = NIF_INFO;
+ tnd.uFlags = NIF_INFO | NIF_SHOWTIP;
+
+ Q_ASSERT(testAttribute(Qt::WA_WState_Created));
return Shell_NotifyIcon(NIM_MODIFY, &tnd);
-#else
- Q_UNUSED(title);
- Q_UNUSED(message);
- Q_UNUSED(type);
- Q_UNUSED(uSecs);
- return false;
-#endif
}
bool QSystemTrayIconSys::trayMessage(DWORD msg)
{
NOTIFYICONDATA tnd;
memset(&tnd, 0, notifyIconSize);
+
tnd.uID = q_uNOTIFYICONID;
tnd.cbSize = notifyIconSize;
tnd.hWnd = winId();
+ tnd.uFlags = NIF_SHOWTIP;
+ tnd.uVersion = version;
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
- if (msg != NIM_DELETE) {
+ if (msg == NIM_ADD || msg == NIM_MODIFY) {
setIconContents(tnd);
}
- return Shell_NotifyIcon(msg, &tnd);
-}
+ bool success = Shell_NotifyIcon(msg, &tnd);
-bool QSystemTrayIconSys::iconDrawItem(LPDRAWITEMSTRUCT lpdi)
-{
- if (!hIcon)
- return false;
-
- DrawIconEx(lpdi->hDC, lpdi->rcItem.left, lpdi->rcItem.top, hIcon, 0, 0, 0, 0, DI_NORMAL);
- return true;
+ if (msg == NIM_ADD)
+ return success && Shell_NotifyIcon(NIM_SETVERSION, &tnd);
+ else
+ return success;
}
void QSystemTrayIconSys::createIcon()
@@ -264,27 +272,24 @@ void QSystemTrayIconSys::createIcon()
bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
{
switch(m->message) {
- case WM_CREATE:
-#ifdef GWLP_USERDATA
- SetWindowLongPtr(winId(), GWLP_USERDATA, (LONG_PTR)((CREATESTRUCTW*)m->lParam)->lpCreateParams);
-#else
- SetWindowLong(winId(), GWL_USERDATA, (LONG)((CREATESTRUCTW*)m->lParam)->lpCreateParams);
-#endif
- break;
-
- case WM_DRAWITEM:
- return iconDrawItem((LPDRAWITEMSTRUCT)m->lParam);
-
case MYWM_NOTIFYICON:
{
- RECT r;
- GetWindowRect(winId(), &r);
- QEvent *e = 0;
- Qt::KeyboardModifiers keys = QApplication::keyboardModifiers();
- QPoint gpos = QCursor::pos();
-
- switch (m->lParam) {
- case WM_LBUTTONUP:
+ int message = 0;
+ QPoint gpos;
+
+ if (version == NOTIFYICON_VERSION_4) {
+ Q_ASSERT(q_uNOTIFYICONID == HIWORD(m->lParam));
+ message = LOWORD(m->lParam);
+ gpos = QPoint(GET_X_LPARAM(m->wParam), GET_Y_LPARAM(m->wParam));
+ } else {
+ Q_ASSERT(q_uNOTIFYICONID == m->wParam);
+ message = m->lParam;
+ gpos = QCursor::pos();
+ }
+
+ switch (message) {
+ case NIN_SELECT:
+ case NIN_KEYSELECT:
if (ignoreNextMouseRelease)
ignoreNextMouseRelease = false;
else
@@ -297,7 +302,7 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
- case WM_RBUTTONUP:
+ case WM_CONTEXTMENU:
if (q->contextMenu()) {
q->contextMenu()->popup(gpos);
}
@@ -311,13 +316,9 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case WM_MBUTTONUP:
emit q->activated(QSystemTrayIcon::MiddleClick);
break;
+
default:
- break;
- }
- if (e) {
- bool res = QApplication::sendEvent(q, e);
- delete e;
- return res;
+ break;
}
break;
}
@@ -441,7 +442,7 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, int timeOut)
{
- if (!sys || !sys->allowsMessages())
+ if (!sys || !allowsMessages())
return;
uint uSecs = 0;
@@ -459,21 +460,14 @@ void QSystemTrayIconPrivate::showMessage_sys(const QString &title, const QString
//title is limited to 63 chars + NULL
QString titleString = title.left(63) + QChar();
- if (sys->supportsMessages()) {
- sys->showMessage(titleString, messageString, type, (unsigned int)uSecs);
- } else {
- //use fallback
- QRect iconPos = sys->findIconGeometry(q_uNOTIFYICONID);
- if (iconPos.isValid()) {
- QBalloonTip::showBalloon(type, title, message, sys->q, iconPos.center(), uSecs, true);
- }
- }
+ sys->showMessage(titleString, messageString, type, uSecs);
}
QRect QSystemTrayIconPrivate::geometry_sys() const
{
if (!sys)
return QRect();
+
return sys->findIconGeometry(q_uNOTIFYICONID);
}
@@ -519,6 +513,11 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
return true;
}
+bool QSystemTrayIconPrivate::supportsMessages_sys()
+{
+ return allowsMessages();
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/util/qsystemtrayicon_wince.cpp b/src/gui/util/qsystemtrayicon_wince.cpp
index 0a0d340..e5cf0fd 100644
--- a/src/gui/util/qsystemtrayicon_wince.cpp
+++ b/src/gui/util/qsystemtrayicon_wince.cpp
@@ -155,10 +155,6 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case MYWM_NOTIFYICON:
{
- RECT r;
- GetWindowRect(winId(), &r);
- QEvent *e = 0;
- Qt::KeyboardModifiers keys = QApplication::keyboardModifiers();
QPoint gpos = QCursor::pos();
switch (m->lParam) {
@@ -193,14 +189,10 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case WM_MBUTTONUP:
emit q->activated(QSystemTrayIcon::MiddleClick);
break;
+
default:
break;
}
- if (e) {
- bool res = QApplication::sendEvent(q, e);
- delete e;
- return res;
- }
break;
}
default:
@@ -291,6 +283,11 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
return true;
}
+bool QSystemTrayIconPrivate::supportsMessages_sys()
+{
+ return true;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/gui/util/qsystemtrayicon_x11.cpp
index 82b4325..59fdc07 100644
--- a/src/gui/util/qsystemtrayicon_x11.cpp
+++ b/src/gui/util/qsystemtrayicon_x11.cpp
@@ -381,6 +381,11 @@ bool QSystemTrayIconPrivate::isSystemTrayAvailable_sys()
return QSystemTrayIconSys::locateSystemTray() != XNone;
}
+bool QSystemTrayIconPrivate::supportsMessages_sys()
+{
+ return true;
+}
+
void QSystemTrayIconPrivate::showMessage_sys(const QString &message, const QString &title,
QSystemTrayIcon::MessageIcon icon, int msecs)
{
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index fe00173..88b3467 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -705,6 +705,11 @@ void QComboBoxPrivateContainer::hideEvent(QHideEvent *)
{
emit resetButton();
combo->update();
+ // QGraphicsScenePrivate::removePopup closes the combo box popup, it hides it non-explicitly.
+ // Hiding/showing the QComboBox after this will unexpectedly show the popup as well.
+ // Re-hiding the popup container makes sure it is explicitly hidden.
+ if (QGraphicsProxyWidget *proxy = graphicsProxyWidget())
+ proxy->hide();
}
void QComboBoxPrivateContainer::mousePressEvent(QMouseEvent *e)
diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp
index e8fe299..d3b5869 100644
--- a/src/gui/widgets/qcommandlinkbutton.cpp
+++ b/src/gui/widgets/qcommandlinkbutton.cpp
@@ -118,7 +118,7 @@ public:
int topMargin() const { return 10; }
int leftMargin() const { return 7; }
int rightMargin() const { return 4; }
- int bottomMargin() const { return 4; }
+ int bottomMargin() const { return 10; }
QString description;
QColor currentColor;
@@ -174,8 +174,15 @@ QFont QCommandLinkButtonPrivate::descriptionFont() const
QRect QCommandLinkButtonPrivate::titleRect() const
{
Q_Q(const QCommandLinkButton);
- return q->rect().adjusted(textOffset(), topMargin(),
- -rightMargin(), 0);
+ QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0);
+ if (description.isEmpty())
+ {
+ QFontMetrics fm(titleFont());
+ r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height()
+ - fm.height()) / 2));
+ }
+
+ return r;
}
QRect QCommandLinkButtonPrivate::descriptionRect() const
@@ -254,7 +261,7 @@ QSize QCommandLinkButton::minimumSizeHint() const
Q_D(const QCommandLinkButton);
QSize size = sizeHint();
int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(),
- iconSize().height() + d->topMargin());
+ icon().actualSize(iconSize()).height() + d->topMargin());
size.setHeight(minimumHeight);
return size;
}
@@ -328,7 +335,8 @@ int QCommandLinkButton::heightForWidth(int width) const
int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin();
// find the width available for the description area
return qMax(heightWithoutDescription + d->descriptionHeight(width),
- iconSize().height() + d->topMargin() + d->bottomMargin());
+ icon().actualSize(iconSize()).height() + d->topMargin() +
+ d->bottomMargin());
}
/*! \reimp */
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 5da1831..7068f62 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -78,7 +78,7 @@ class Q_GUI_EXPORT QLineControl : public QObject
public:
QLineControl(const QString &txt = QString())
- : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LeftToRight),
+ : m_cursor(0), m_preeditCursor(0), m_cursorWidth(0), m_layoutDirection(Qt::LayoutDirectionAuto),
m_hideCursor(false), m_separator(0), m_readOnly(0),
m_dragEnabled(0), m_echoMode(0), m_textDirty(0), m_selDirty(0),
m_validInput(1), m_blinkStatus(0), m_blinkPeriod(0), m_blinkTimer(0), m_deleteAllTimer(0),
@@ -272,7 +272,14 @@ public:
QChar passwordCharacter() const { return m_passwordCharacter; }
void setPasswordCharacter(const QChar &character) { m_passwordCharacter = character; updateDisplayText(); }
- Qt::LayoutDirection layoutDirection() const { return m_layoutDirection; }
+ Qt::LayoutDirection layoutDirection() const {
+ if (m_layoutDirection == Qt::LayoutDirectionAuto) {
+ if (m_text.isEmpty())
+ return QApplication::keyboardInputDirection();
+ return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
+ }
+ return m_layoutDirection;
+ }
void setLayoutDirection(Qt::LayoutDirection direction)
{
if (direction != m_layoutDirection) {
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index c1c4abf..1bffde1 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1860,7 +1860,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
p.setClipRect(r);
QFontMetrics fm = fontMetrics();
- Qt::Alignment va = QStyle::visualAlignment(layoutDirection(), QFlag(d->alignment));
+ Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment));
switch (va & Qt::AlignVertical_Mask) {
case Qt::AlignBottom:
d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin;
@@ -2161,9 +2161,6 @@ void QLineEdit::changeEvent(QEvent *ev)
}
update();
break;
- case QEvent::LayoutDirectionChange:
- d->control->setLayoutDirection(layoutDirection());
- break;
default:
break;
}
diff --git a/src/gui/widgets/qslider.cpp b/src/gui/widgets/qslider.cpp
index a5e62cf..5755202 100644
--- a/src/gui/widgets/qslider.cpp
+++ b/src/gui/widgets/qslider.cpp
@@ -621,7 +621,7 @@ QSlider::TickPosition QSlider::tickPosition() const
\brief the interval between tickmarks
This is a value interval, not a pixel interval. If it is 0, the
- slider will choose between lineStep() and pageStep().
+ slider will choose between singleStep() and pageStep().
The default value is 0.