summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp36
-rw-r--r--src/gui/accessible/qaccessible.h2
-rw-r--r--src/gui/accessible/qaccessible2.cpp16
-rw-r--r--src/gui/image/image.pri7
-rw-r--r--src/gui/image/qimage.cpp95
-rw-r--r--src/gui/image/qimage.h4
-rw-r--r--src/gui/image/qimagereader.cpp34
-rw-r--r--src/gui/image/qimagewriter.cpp16
-rw-r--r--src/gui/image/qpixmap.cpp51
-rw-r--r--src/gui/image/qpixmap.h2
-rw-r--r--src/gui/image/qpixmap_raster.cpp4
-rw-r--r--src/gui/image/qpixmapcache_p.h2
-rw-r--r--src/gui/image/qvolatileimage.cpp285
-rw-r--r--src/gui/image/qvolatileimage_p.h100
-rw-r--r--src/gui/kernel/kernel.pri7
-rw-r--r--src/gui/kernel/qclipboard.cpp12
-rw-r--r--src/gui/kernel/qcursor.cpp144
-rw-r--r--src/gui/kernel/qcursor.h4
-rw-r--r--src/gui/kernel/qcursor_qpa.cpp40
-rw-r--r--src/gui/kernel/qdnd.cpp402
-rw-r--r--src/gui/kernel/qdnd_p.h87
-rw-r--r--src/gui/kernel/qdrag.cpp99
-rw-r--r--src/gui/kernel/qdrag.h5
-rw-r--r--src/gui/kernel/qevent.cpp79
-rw-r--r--src/gui/kernel/qevent.h58
-rw-r--r--src/gui/kernel/qguiapplication.cpp168
-rw-r--r--src/gui/kernel/qguiapplication_p.h6
-rw-r--r--src/gui/kernel/qkeysequence.cpp150
-rw-r--r--src/gui/kernel/qkeysequence.h3
-rw-r--r--src/gui/kernel/qopenglcontext_p.h2
-rw-r--r--src/gui/kernel/qpalette.cpp13
-rw-r--r--src/gui/kernel/qpalette.h4
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.cpp15
-rw-r--r--src/gui/kernel/qplatformcursor_qpa.h10
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.cpp187
-rw-r--r--src/gui/kernel/qplatformdrag_qpa.h49
-rw-r--r--src/gui/kernel/qplatformnativeinterface_qpa.cpp2
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformscreen_qpa.h13
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.cpp (renamed from src/gui/image/qvolatileimagedata.cpp)59
-rw-r--r--src/gui/kernel/qplatformscreenpageflipper_qpa.h (renamed from src/gui/image/qvolatileimagedata_p.h)63
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.cpp11
-rw-r--r--src/gui/kernel/qplatformtheme_qpa.h43
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp9
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h6
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp6
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp6
-rw-r--r--src/gui/math3d/qvector2d.cpp2
-rw-r--r--src/gui/math3d/qvector3d.cpp2
-rw-r--r--src/gui/math3d/qvector4d.cpp2
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp20
-rw-r--r--src/gui/painting/qbrush.cpp74
-rw-r--r--src/gui/painting/qcolor.cpp26
-rw-r--r--src/gui/painting/qmatrix.cpp12
-rw-r--r--src/gui/painting/qpaintengine_p.h2
-rw-r--r--src/gui/painting/qpainter.cpp272
-rw-r--r--src/gui/painting/qpainterpath.cpp60
-rw-r--r--src/gui/painting/qpen.cpp60
-rw-r--r--src/gui/painting/qplatformbackingstore_qpa.cpp3
-rw-r--r--src/gui/painting/qregion.cpp8
-rw-r--r--src/gui/painting/qtransform.cpp12
-rw-r--r--src/gui/text/qabstracttextdocumentlayout.cpp20
-rw-r--r--src/gui/text/qfont.cpp103
-rw-r--r--src/gui/text/qfont_p.h5
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp34
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_p.h4
-rw-r--r--src/gui/text/qfontengine_qpa.cpp85
-rw-r--r--src/gui/text/qfontengine_qpa_p.h5
-rw-r--r--src/gui/text/qfontmetrics.cpp78
-rw-r--r--src/gui/text/qfontmetrics.h4
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.cpp12
-rw-r--r--src/gui/text/qplatformfontdatabase_qpa.h2
-rw-r--r--src/gui/text/qrawfont.cpp6
-rw-r--r--src/gui/text/qrawfont.h1
-rw-r--r--src/gui/text/qtextcursor.cpp12
-rw-r--r--src/gui/text/qtextdocument.cpp14
-rw-r--r--src/gui/text/qtextdocumentwriter.cpp8
-rw-r--r--src/gui/text/qtextengine.cpp177
-rw-r--r--src/gui/text/qtextengine_p.h8
-rw-r--r--src/gui/text/qtextlayout.cpp44
-rw-r--r--src/gui/text/qtextlayout.h7
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtexttable.cpp12
-rw-r--r--src/gui/util/qvalidator.cpp16
86 files changed, 1697 insertions, 1948 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 37e7a1dbb4..e5b290ae1f 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -77,10 +77,10 @@ QT_BEGIN_NAMESPACE
braille displays. Clients and servers communicate in the following way:
\list
- \o \e{AT Servers} notify the clients about events through calls to the
+ \li \e{AT Servers} notify the clients about events through calls to the
updateAccessibility() function.
- \o \e{AT Clients} request information about the objects in the server.
+ \li \e{AT Clients} request information about the objects in the server.
The QAccessibleInterface class is the core interface, and encapsulates
this information in a pure virtual API. Implementations of the interface
are provided by Qt through the queryAccessibleInterface() API.
@@ -571,10 +571,6 @@ QAccessibleInterface *QAccessible::queryAccessibleInterface(QObject *object)
if (!object)
return 0;
- QEvent e(QEvent::AccessibilityPrepare);
-
- QCoreApplication::sendEvent(object, &e);
-
const QMetaObject *mo = object->metaObject();
while (mo) {
const QLatin1String cn(mo->className());
@@ -650,8 +646,6 @@ void QAccessible::updateAccessibility(QObject *object, int child, Event reason)
{
Q_ASSERT(object);
- qWarning("QAccessible::updateAccessibility is deprecated.");
-
QAccessibleEvent event = QAccessibleEvent(reason, object, child);
updateAccessibility(event);
}
@@ -750,12 +744,12 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const
The AT client uses three basic concepts to acquire information
about any accessible object in an application:
\list
- \i \e Properties The client can read information about
+ \li \e Properties The client can read information about
accessible objects. In some cases the client can also modify these
properties; such as text in a line edit.
- \i \e Actions The client can invoke actions like pressing a button
+ \li \e Actions The client can invoke actions like pressing a button
or .
- \i \e{Relationships and Navigation} The client can traverse from one
+ \li \e{Relationships and Navigation} The client can traverse from one
accessible object to another, using the relationships between objects.
\endlist
@@ -1198,11 +1192,23 @@ Q_GUI_EXPORT QDebug operator<<(QDebug d, const QAccessibleInterface *iface)
if (iface->object()) {
d << "obj=" << iface->object();
}
- if (iface->state().invisible) {
- d << "invisible";
- } else {
+ QStringList stateStrings;
+ QAccessible::State st = iface->state();
+ if (st.focusable)
+ stateStrings << QLatin1String("focusable");
+ if (st.focused)
+ stateStrings << QLatin1String("focused");
+ if (st.selected)
+ stateStrings << QLatin1String("selected");
+ if (st.invisible)
+ stateStrings << QLatin1String("invisible");
+
+ if (!stateStrings.isEmpty())
+ d << stateStrings.join(QLatin1String("|"));
+
+ if (!st.invisible)
d << "rect=" << iface->rect();
- }
+
} else {
d << " invalid";
}
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index a72b91a90f..6ad1bb9da9 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -336,7 +336,7 @@ public:
static QAccessibleInterface *queryAccessibleInterface(QObject *);
- static void updateAccessibility(QObject *object, int child, Event reason);
+ QT_DEPRECATED static void updateAccessibility(QObject *object, int child, Event reason);
static void updateAccessibility(const QAccessibleEvent &event);
static bool isActive();
diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp
index db3028b371..d3dafb8820 100644
--- a/src/gui/accessible/qaccessible2.cpp
+++ b/src/gui/accessible/qaccessible2.cpp
@@ -371,14 +371,14 @@ QT_BEGIN_NAMESPACE
In general you should use one of the predefined action names, unless describing an action that does not fit these:
\table
- \header \o Action name \o Description
- \row \o \l checkAction() \o checks the item (checkbox, radio button, ...)
- \row \o \l decreaseAction() \o decrease the value of the accessible (e.g. spinbox)
- \row \o \l increaseAction() \o increase the value of the accessible (e.g. spinbox)
- \row \o \l pressAction() \o press or click or activate the accessible (should correspont to clicking the object with the mouse)
- \row \o \l setFocusAction() \o set the focus to this accessible
- \row \o \l showMenuAction() \o show a context menu, corresponds to right-clicks
- \row \o \l uncheckAction() \o uncheck the item (checkbox, radio button, ...)
+ \header \li Action name \li Description
+ \row \li \l checkAction() \li checks the item (checkbox, radio button, ...)
+ \row \li \l decreaseAction() \li decrease the value of the accessible (e.g. spinbox)
+ \row \li \l increaseAction() \li increase the value of the accessible (e.g. spinbox)
+ \row \li \l pressAction() \li press or click or activate the accessible (should correspont to clicking the object with the mouse)
+ \row \li \l setFocusAction() \li set the focus to this accessible
+ \row \li \l showMenuAction() \li show a context menu, corresponds to right-clicks
+ \row \li \l uncheckAction() \li uncheck the item (checkbox, radio button, ...)
\endtable
In order to invoke the action, \l doAction() is called with an action name.
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index f83e7e60c9..34a33aa0f0 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -23,8 +23,6 @@ HEADERS += \
image/qpixmapcache_p.h \
image/qplatformpixmap_qpa.h \
image/qimagepixmapcleanuphooks_p.h \
- image/qvolatileimage_p.h \
- image/qvolatileimagedata_p.h
SOURCES += \
image/qbitmap.cpp \
@@ -42,13 +40,10 @@ SOURCES += \
image/qpixmap_raster.cpp \
image/qpixmap_blitter.cpp \
image/qnativeimage.cpp \
- image/qimagepixmapcleanuphooks.cpp \
- image/qvolatileimage.cpp
+ image/qimagepixmapcleanuphooks.cpp
win32: SOURCES += image/qpixmap_win.cpp
-SOURCES += image/qvolatileimagedata.cpp
-
# Built-in image format support
HEADERS += \
image/qbmphandler_p.h \
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 5b23dbf4dc..3e53b04728 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -327,17 +327,17 @@ bool QImageData::checkForAlphaPixels() const
formats:
\table
- \header \o Format \o Description \o Qt's support
- \row \o BMP \o Windows Bitmap \o Read/write
- \row \o GIF \o Graphic Interchange Format (optional) \o Read
- \row \o JPG \o Joint Photographic Experts Group \o Read/write
- \row \o JPEG \o Joint Photographic Experts Group \o Read/write
- \row \o PNG \o Portable Network Graphics \o Read/write
- \row \o PBM \o Portable Bitmap \o Read
- \row \o PGM \o Portable Graymap \o Read
- \row \o PPM \o Portable Pixmap \o Read/write
- \row \o XBM \o X11 Bitmap \o Read/write
- \row \o XPM \o X11 Pixmap \o Read/write
+ \header \li Format \li Description \li Qt's support
+ \row \li BMP \li Windows Bitmap \li Read/write
+ \row \li GIF \li Graphic Interchange Format (optional) \li Read
+ \row \li JPG \li Joint Photographic Experts Group \li Read/write
+ \row \li JPEG \li Joint Photographic Experts Group \li Read/write
+ \row \li PNG \li Portable Network Graphics \li Read/write
+ \row \li PBM \li Portable Bitmap \li Read
+ \row \li PGM \li Portable Graymap \li Read
+ \row \li PPM \li Portable Pixmap \li Read/write
+ \row \li XBM \li X11 Bitmap \li Read/write
+ \row \li XPM \li X11 Pixmap \li Read/write
\endtable
\section1 Image Information
@@ -347,11 +347,11 @@ bool QImageData::checkForAlphaPixels() const
\table
\header
- \o \o Available Functions
+ \li \li Available Functions
\row
- \o Geometry
- \o
+ \li Geometry
+ \li
The size(), width(), height(), dotsPerMeterX(), and
dotsPerMeterY() functions provide information about the image size
@@ -365,8 +365,8 @@ bool QImageData::checkForAlphaPixels() const
setOffset() function.
\row
- \o Colors
- \o
+ \li Colors
+ \li
The color of a pixel can be retrieved by passing its coordinates
to the pixel() function. The pixel() function returns the color
@@ -392,8 +392,8 @@ bool QImageData::checkForAlphaPixels() const
sections.
\row
- \o Text
- \o
+ \li Text
+ \li
The text() function returns the image text associated with the
given text key. An image's text keys can be retrieved using the
@@ -401,8 +401,8 @@ bool QImageData::checkForAlphaPixels() const
image's text.
\row
- \o Low-level information
- \o
+ \li Low-level information
+ \li
The depth() function returns the depth of the image. The supported
depths are 1 (monochrome), 8, 16, 24 and 32 bits. The
@@ -434,10 +434,10 @@ bool QImageData::checkForAlphaPixels() const
\table
\header
- \o {2,1}32-bit
+ \li {2,1}32-bit
\row
- \o \inlineimage qimage-32bit_scaled.png
- \o
+ \li \inlineimage qimage-32bit_scaled.png
+ \li
\snippet doc/src/snippets/code/src_gui_image_qimage.cpp 0
\endtable
@@ -455,10 +455,10 @@ bool QImageData::checkForAlphaPixels() const
\table
\header
- \o {2,1} 8-bit
+ \li {2,1} 8-bit
\row
- \o \inlineimage qimage-8bit_scaled.png
- \o
+ \li \inlineimage qimage-8bit_scaled.png
+ \li
\snippet doc/src/snippets/code/src_gui_image_qimage.cpp 1
\endtable
@@ -529,28 +529,28 @@ bool QImageData::checkForAlphaPixels() const
in-place:
\table
- \header \o Function \o Description
+ \header \li Function \li Description
\row
- \o setDotsPerMeterX()
- \o Defines the aspect ratio by setting the number of pixels that fit
+ \li setDotsPerMeterX()
+ \li Defines the aspect ratio by setting the number of pixels that fit
horizontally in a physical meter.
\row
- \o setDotsPerMeterY()
- \o Defines the aspect ratio by setting the number of pixels that fit
+ \li setDotsPerMeterY()
+ \li Defines the aspect ratio by setting the number of pixels that fit
vertically in a physical meter.
\row
- \o fill()
- \o Fills the entire image with the given pixel value.
+ \li fill()
+ \li Fills the entire image with the given pixel value.
\row
- \o invertPixels()
- \o Inverts all pixel values in the image using the given InvertMode value.
+ \li invertPixels()
+ \li Inverts all pixel values in the image using the given InvertMode value.
\row
- \o setColorTable()
- \o Sets the color table used to translate color indexes. Only
+ \li setColorTable()
+ \li Sets the color table used to translate color indexes. Only
monochrome and 8-bit formats.
\row
- \o setColorCount()
- \o Resizes the color table. Only monochrome and 8-bit formats.
+ \li setColorCount()
+ \li Resizes the color table. Only monochrome and 8-bit formats.
\endtable
@@ -3794,11 +3794,11 @@ bool QImage::isGrayscale() const
\image qimage-scaling.png
\list
- \i If \a aspectRatioMode is Qt::IgnoreAspectRatio, the image
+ \li If \a aspectRatioMode is Qt::IgnoreAspectRatio, the image
is scaled to \a size.
- \i If \a aspectRatioMode is Qt::KeepAspectRatio, the image is
+ \li If \a aspectRatioMode is Qt::KeepAspectRatio, the image is
scaled to a rectangle as large as possible inside \a size, preserving the aspect ratio.
- \i If \a aspectRatioMode is Qt::KeepAspectRatioByExpanding,
+ \li If \a aspectRatioMode is Qt::KeepAspectRatioByExpanding,
the image is scaled to a rectangle as small as possible
outside \a size, preserving the aspect ratio.
\endlist
@@ -5132,7 +5132,8 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
#undef IWX_LSB
#undef IWX_PIX
-/*! \obsolete
+/*! \fn int QImage::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this
QImage object. Distinct QImage objects can only have the same
serial number if they refer to the same contents (but they don't
@@ -5147,14 +5148,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth
\sa operator==()
*/
-int QImage::serialNumber() const
-{
- if (!d)
- return 0;
- else
- return d->ser_no;
-}
-
/*!
Returns a number that identifies the contents of this QImage
object. Distinct QImage objects can only have the same key if they
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 5a3ae8f886..e9192f1031 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -253,7 +253,9 @@ public:
inline static QImage fromData(const QByteArray &data, const char *format = 0)
{ return fromData(reinterpret_cast<const uchar *>(data.constData()), data.size(), format); }
- int serialNumber() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
+#endif
qint64 cacheKey() const;
QPaintEngine *paintEngine() const;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 4a9a9b00f4..870784f638 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -703,22 +703,22 @@ QByteArray QImageReader::format() const
\list
- \o Image plugins are queried first, based on either the optional format
+ \li Image plugins are queried first, based on either the optional format
string, or the file name suffix (if the source device is a file). No
content detection is done at this stage. QImageReader will choose the
first plugin that supports reading for this format.
- \o If no plugin supports the image format, Qt's built-in handlers are
+ \li If no plugin supports the image format, Qt's built-in handlers are
checked based on either the optional format string, or the file name
suffix.
- \o If no capable plugins or built-in handlers are found, each plugin is
+ \li If no capable plugins or built-in handlers are found, each plugin is
tested by inspecting the content of the data stream.
- \o If no plugins could detect the image format based on data contents,
+ \li If no plugins could detect the image format based on data contents,
each built-in image handler is tested by inspecting the contents.
- \o Finally, if all above approaches fail, QImageReader will report failure
+ \li Finally, if all above approaches fail, QImageReader will report failure
when trying to read the image.
\endlist
@@ -1423,18 +1423,18 @@ QByteArray QImageReader::imageFormat(QIODevice *device)
By default, Qt can read the following formats:
\table
- \header \o Format \o Description
- \row \o BMP \o Windows Bitmap
- \row \o GIF \o Graphic Interchange Format (optional)
- \row \o JPG \o Joint Photographic Experts Group
- \row \o JPEG \o Joint Photographic Experts Group
- \row \o PNG \o Portable Network Graphics
- \row \o PBM \o Portable Bitmap
- \row \o PGM \o Portable Graymap
- \row \o PPM \o Portable Pixmap
- \row \o XBM \o X11 Bitmap
- \row \o XPM \o X11 Pixmap
- \row \o SVG \o Scalable Vector Graphics
+ \header \li Format \li Description
+ \row \li BMP \li Windows Bitmap
+ \row \li GIF \li Graphic Interchange Format (optional)
+ \row \li JPG \li Joint Photographic Experts Group
+ \row \li JPEG \li Joint Photographic Experts Group
+ \row \li PNG \li Portable Network Graphics
+ \row \li PBM \li Portable Bitmap
+ \row \li PGM \li Portable Graymap
+ \row \li PPM \li Portable Pixmap
+ \row \li XBM \li X11 Bitmap
+ \row \li XPM \li X11 Pixmap
+ \row \li SVG \li Scalable Vector Graphics
\endtable
Reading and writing SVG files is supported through Qt's
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index 966017452c..8395f9d216 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -653,14 +653,14 @@ bool QImageWriter::supportsOption(QImageIOHandler::ImageOption option) const
By default, Qt can write the following formats:
\table
- \header \o Format \o Description
- \row \o BMP \o Windows Bitmap
- \row \o JPG \o Joint Photographic Experts Group
- \row \o JPEG \o Joint Photographic Experts Group
- \row \o PNG \o Portable Network Graphics
- \row \o PPM \o Portable Pixmap
- \row \o XBM \o X11 Bitmap
- \row \o XPM \o X11 Pixmap
+ \header \li Format \li Description
+ \row \li BMP \li Windows Bitmap
+ \row \li JPG \li Joint Photographic Experts Group
+ \row \li JPEG \li Joint Photographic Experts Group
+ \row \li PNG \li Portable Network Graphics
+ \row \li PPM \li Portable Pixmap
+ \row \li XBM \li X11 Bitmap
+ \row \li XPM \li X11 Pixmap
\endtable
Reading and writing SVG files is supported through Qt's
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index e8c1304b74..65b9d62dfa 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -885,7 +885,8 @@ void QPixmap::fill(const QColor &color)
data->fill(color);
}
-/*! \obsolete
+/*! \fn int QPixmap::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this QPixmap
object. Distinct QPixmap objects can only have the same serial
number if they refer to the same contents (but they don't have
@@ -898,12 +899,6 @@ void QPixmap::fill(const QColor &color)
it as a cache key. For caching pixmaps, we recommend using the
QPixmapCache class whenever possible.
*/
-int QPixmap::serialNumber() const
-{
- if (isNull())
- return 0;
- return data->serialNumber();
-}
/*!
Returns a number that identifies this QPixmap. Distinct QPixmap
@@ -1052,11 +1047,11 @@ bool QPixmap::convertFromImage(const QImage &image, Qt::ImageConversionFlags fla
\image qimage-scaling.png
\list
- \i If \a aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap
+ \li If \a aspectRatioMode is Qt::IgnoreAspectRatio, the pixmap
is scaled to \a size.
- \i If \a aspectRatioMode is Qt::KeepAspectRatio, the pixmap is
+ \li If \a aspectRatioMode is Qt::KeepAspectRatio, the pixmap is
scaled to a rectangle as large as possible inside \a size, preserving the aspect ratio.
- \i If \a aspectRatioMode is Qt::KeepAspectRatioByExpanding,
+ \li If \a aspectRatioMode is Qt::KeepAspectRatioByExpanding,
the pixmap is scaled to a rectangle as small as possible
outside \a size, preserving the aspect ratio.
\endlist
@@ -1273,17 +1268,17 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
formats:
\table
- \header \o Format \o Description \o Qt's support
- \row \o BMP \o Windows Bitmap \o Read/write
- \row \o GIF \o Graphic Interchange Format (optional) \o Read
- \row \o JPG \o Joint Photographic Experts Group \o Read/write
- \row \o JPEG \o Joint Photographic Experts Group \o Read/write
- \row \o PNG \o Portable Network Graphics \o Read/write
- \row \o PBM \o Portable Bitmap \o Read
- \row \o PGM \o Portable Graymap \o Read
- \row \o PPM \o Portable Pixmap \o Read/write
- \row \o XBM \o X11 Bitmap \o Read/write
- \row \o XPM \o X11 Pixmap \o Read/write
+ \header \li Format \li Description \li Qt's support
+ \row \li BMP \li Windows Bitmap \li Read/write
+ \row \li GIF \li Graphic Interchange Format (optional) \li Read
+ \row \li JPG \li Joint Photographic Experts Group \li Read/write
+ \row \li JPEG \li Joint Photographic Experts Group \li Read/write
+ \row \li PNG \li Portable Network Graphics \li Read/write
+ \row \li PBM \li Portable Bitmap \li Read
+ \row \li PGM \li Portable Graymap \li Read
+ \row \li PPM \li Portable Pixmap \li Read/write
+ \row \li XBM \li X11 Bitmap \li Read/write
+ \row \li XPM \li X11 Pixmap \li Read/write
\endtable
\section1 Pixmap Information
@@ -1293,17 +1288,17 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
\table
\header
- \o \o Available Functions
+ \li \li Available Functions
\row
- \o Geometry
- \o
+ \li Geometry
+ \li
The size(), width() and height() functions provide information
about the pixmap's size. The rect() function returns the image's
enclosing rectangle.
\row
- \o Alpha component
- \o
+ \li Alpha component
+ \li
The hasAlphaChannel() returns true if the pixmap has a format that
respects the alpha channel, otherwise returns false. The hasAlpha(),
@@ -1318,8 +1313,8 @@ QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode)
QBitmap) for the pixmap based on a given color.
\row
- \o Low-level information
- \o
+ \li Low-level information
+ \li
The depth() function returns the depth of the pixmap. The
defaultDepth() function returns the default depth, i.e. the depth
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 27bfe15688..3d78a43917 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -146,7 +146,7 @@ public:
void scroll(int dx, int dy, const QRect &rect, QRegion *exposed = 0);
#if QT_DEPRECATED_SINCE(5, 0)
- QT_DEPRECATED int serialNumber() const;
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
#endif
qint64 cacheKey() const;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 8125b1360d..7c7c4652e3 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -115,7 +115,7 @@ void QRasterPlatformPixmap::resize(int width, int height)
image.setColor(1, QColor(Qt::color1).rgba());
}
- setSerialNumber(image.serialNumber());
+ setSerialNumber(image.cacheKey() >> 32);
}
bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *format,
@@ -349,7 +349,7 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
}
is_null = (w <= 0 || h <= 0);
- setSerialNumber(image.serialNumber());
+ setSerialNumber(image.cacheKey() >> 32);
}
QImage* QRasterPlatformPixmap::buffer()
diff --git a/src/gui/image/qpixmapcache_p.h b/src/gui/image/qpixmapcache_p.h
index 6ca109b03f..426a6d9954 100644
--- a/src/gui/image/qpixmapcache_p.h
+++ b/src/gui/image/qpixmapcache_p.h
@@ -96,8 +96,6 @@ public:
QPixmapCache::Key key;
};
-inline bool qIsDetached(QPixmapCacheEntry &t) { return t.isDetached(); }
-
QT_END_NAMESPACE
#endif // QPIXMAPCACHE_P_H
diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp
deleted file mode 100644
index 8122c9cfe8..0000000000
--- a/src/gui/image/qvolatileimage.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvolatileimage_p.h"
-#include "qvolatileimagedata_p.h"
-#include <QtGui/private/qpaintengine_raster_p.h>
-#include <QtGui/qplatformpixmap_qpa.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVolatileImagePaintEnginePrivate : public QRasterPaintEnginePrivate
-{
-public:
- QVolatileImagePaintEnginePrivate() { }
- QVolatileImage *img;
-};
-
-class QVolatileImagePaintEngine : public QRasterPaintEngine
-{
- Q_DECLARE_PRIVATE(QVolatileImagePaintEngine)
-
-public:
- QVolatileImagePaintEngine(QPaintDevice *device, QVolatileImage *img);
- bool begin(QPaintDevice *device);
- bool end();
- void drawPixmap(const QPointF &p, const QPixmap &pm);
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
-};
-
-QVolatileImage::QVolatileImage()
- : d(new QVolatileImageData)
-{
-}
-
-QVolatileImage::QVolatileImage(int w, int h, QImage::Format format)
- : d(new QVolatileImageData(w, h, format))
-{
-}
-
-QVolatileImage::QVolatileImage(const QImage &sourceImage)
- : d(new QVolatileImageData(sourceImage))
-{
-}
-
-QVolatileImage::QVolatileImage(void *nativeImage, void *nativeMask)
- : d(new QVolatileImageData(nativeImage, nativeMask))
-{
-}
-
-// Need non-inline, non-autogenerated copy ctor, dtor, op= to keep the
-// fwd declared QSharedData working.
-
-QVolatileImage::QVolatileImage(const QVolatileImage &other)
- : d(other.d)
-{
-}
-
-QVolatileImage::~QVolatileImage()
-{
-}
-
-QVolatileImage &QVolatileImage::operator=(const QVolatileImage &rhs)
-{
- d = rhs.d;
- return *this;
-}
-
-bool QVolatileImage::isNull() const
-{
- return d->image.isNull();
-}
-
-QImage::Format QVolatileImage::format() const
-{
- return d->image.format();
-}
-
-int QVolatileImage::width() const
-{
- return d->image.width();
-}
-
-int QVolatileImage::height() const
-{
- return d->image.height();
-}
-
-int QVolatileImage::bytesPerLine() const
-{
- return d->image.bytesPerLine();
-}
-
-int QVolatileImage::byteCount() const
-{
- return d->image.byteCount();
-}
-
-int QVolatileImage::depth() const
-{
- return d->image.depth();
-}
-
-bool QVolatileImage::hasAlphaChannel() const
-{
- return d->image.hasAlphaChannel();
-}
-
-void QVolatileImage::beginDataAccess() const
-{
- d->beginDataAccess();
-}
-
-void QVolatileImage::endDataAccess(bool readOnly) const
-{
- d->endDataAccess(readOnly);
-}
-
-/*!
- Access to pixel data via bits() or constBits() should be guarded by
- begin/endDataAccess().
- */
-uchar *QVolatileImage::bits()
-{
- return d->image.bits();
-}
-
-const uchar *QVolatileImage::constBits() const
-{
- return d->image.constBits();
-}
-
-bool QVolatileImage::ensureFormat(QImage::Format format)
-{
- return d->ensureFormat(format);
-}
-
-/*!
- This will always perform a copy of the pixel data.
- */
-QImage QVolatileImage::toImage() const
-{
- d->beginDataAccess();
- QImage newImage = d->image.copy(); // no sharing allowed
- d->endDataAccess(true);
- return newImage;
-}
-
-/*!
- Returns a reference to the image that is potentially using some native
- buffer internally. Access to the image's pixel data should be guarded by
- begin/endDataAccess(). Use it when there is a need for QImage APIs not provided
- by this class. The returned QImage must never be shared or assigned to.
- */
-QImage &QVolatileImage::imageRef() // non-const, in order to cause a detach
-{
- d->ensureImage();
- return d->image;
-}
-
-void *QVolatileImage::duplicateNativeImage() const
-{
- return d->duplicateNativeImage();
-}
-
-void QVolatileImage::fill(uint pixelValue)
-{
- beginDataAccess();
- imageRef().fill(pixelValue);
- endDataAccess();
- d->ensureImage();
-}
-
-void QVolatileImage::copyFrom(QVolatileImage *source, const QRect &rect)
-{
- if (source->isNull()) {
- return;
- }
- QRect r = rect;
- if (rect.isNull()) {
- r = QRect(0, 0, source->width(), source->height());
- }
- source->beginDataAccess();
- QImage &srcImgRef(source->imageRef());
- int srcbpl = srcImgRef.bytesPerLine();
- int srcbpp = srcImgRef.depth() / 8;
- const uchar *sptr = srcImgRef.constBits() + r.y() * srcbpl;
- beginDataAccess();
- QImage &dstImgRef(imageRef());
- int dstbpl = dstImgRef.bytesPerLine();
- uchar *dptr = dstImgRef.bits();
- for (int y = 0; y < r.height(); ++y) {
- qMemCopy(dptr, sptr + r.x() * srcbpp, r.width() * srcbpp);
- sptr += srcbpl;
- dptr += dstbpl;
- }
- endDataAccess();
- source->endDataAccess(true);
-}
-
-/*!
- To be called from the PlatformPixmap's paintEngine().
- */
-QPaintEngine *QVolatileImage::paintEngine()
-{
- if (!d->pengine) {
- d->pengine = new QVolatileImagePaintEngine(&imageRef(), this);
- }
- return d->pengine;
-}
-
-QVolatileImagePaintEngine::QVolatileImagePaintEngine(QPaintDevice *device,
- QVolatileImage *img)
- : QRasterPaintEngine(*(new QVolatileImagePaintEnginePrivate), device)
-{
- Q_D(QVolatileImagePaintEngine);
- d->img = img;
-}
-
-bool QVolatileImagePaintEngine::begin(QPaintDevice *device)
-{
- Q_D(QVolatileImagePaintEngine);
- d->img->beginDataAccess();
- return QRasterPaintEngine::begin(device);
-}
-
-bool QVolatileImagePaintEngine::end()
-{
- Q_D(QVolatileImagePaintEngine);
- bool ret = QRasterPaintEngine::end();
- d->img->endDataAccess();
- return ret;
-}
-
-// For non-RasterClass pixmaps drawPixmap() would call toImage() which is slow in
-// our case. Therefore drawPixmap() is rerouted to drawImage().
-
-void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
-{
- QRasterPaintEngine::drawPixmap(p, pm);
-}
-
-void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- QRasterPaintEngine::drawPixmap(r, pm, sr);
-}
-
-QT_END_NAMESPACE
diff --git a/src/gui/image/qvolatileimage_p.h b/src/gui/image/qvolatileimage_p.h
deleted file mode 100644
index 808def7c32..0000000000
--- a/src/gui/image/qvolatileimage_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** 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 General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVOLATILEIMAGE_P_H
-#define QVOLATILEIMAGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/qimage.h>
-#include <QtCore/qshareddata.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVolatileImageData;
-
-class Q_GUI_EXPORT QVolatileImage
-{
-public:
- QVolatileImage();
- QVolatileImage(int w, int h, QImage::Format format);
- explicit QVolatileImage(const QImage &sourceImage);
- explicit QVolatileImage(void *nativeImage, void *nativeMask = 0);
- QVolatileImage(const QVolatileImage &other);
- ~QVolatileImage();
- QVolatileImage &operator=(const QVolatileImage &rhs);
-
- bool isNull() const;
- QImage::Format format() const;
- int width() const;
- int height() const;
- int bytesPerLine() const;
- int byteCount() const;
- int depth() const;
- bool hasAlphaChannel() const;
- void beginDataAccess() const;
- void endDataAccess(bool readOnly = false) const;
- uchar *bits();
- const uchar *constBits() const;
- bool ensureFormat(QImage::Format format);
- QImage toImage() const;
- QImage &imageRef();
- QPaintEngine *paintEngine();
- void fill(uint pixelValue);
- void *duplicateNativeImage() const;
- void copyFrom(QVolatileImage *source, const QRect &rect);
-
-private:
- QSharedDataPointer<QVolatileImageData> d;
-};
-
-QT_END_NAMESPACE
-
-#endif // QVOLATILEIMAGE_P_H
diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri
index 9c5f3b10da..06773f58b5 100644
--- a/src/gui/kernel/kernel.pri
+++ b/src/gui/kernel/kernel.pri
@@ -56,7 +56,8 @@ HEADERS += \
kernel/qtouchdevice_p.h \
kernel/qplatformsharedgraphicscache_qpa.h \
kernel/qplatformdialoghelper_qpa.h \
- kernel/qplatformservices_qpa.h
+ kernel/qplatformservices_qpa.h \
+ kernel/qplatformscreenpageflipper_qpa.h
SOURCES += \
kernel/qclipboard_qpa.cpp \
@@ -66,6 +67,7 @@ SOURCES += \
kernel/qwindowsysteminterface_qpa.cpp \
kernel/qplatforminputcontext_qpa.cpp \
kernel/qplatformintegration_qpa.cpp \
+ kernel/qplatformdrag_qpa.cpp \
kernel/qplatformscreen_qpa.cpp \
kernel/qplatformintegrationfactory_qpa.cpp \
kernel/qplatformintegrationplugin_qpa.cpp \
@@ -99,7 +101,8 @@ SOURCES += \
kernel/qtouchdevice.cpp \
kernel/qplatformsharedgraphicscache_qpa.cpp \
kernel/qplatformdialoghelper_qpa.cpp \
- kernel/qplatformservices_qpa.cpp
+ kernel/qplatformservices_qpa.cpp \
+ kernel/qplatformscreenpageflipper_qpa.cpp
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, egl) {
HEADERS += \
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 8e881aabc7..27179cf141 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -86,18 +86,18 @@ QT_BEGIN_NAMESPACE
\list
- \i The X11 Window System has the concept of a separate selection
+ \li The X11 Window System has the concept of a separate selection
and clipboard. When text is selected, it is immediately available
as the global mouse selection. The global mouse selection may
later be copied to the clipboard. By convention, the middle mouse
button is used to paste the global mouse selection.
- \i X11 also has the concept of ownership; if you change the
+ \li X11 also has the concept of ownership; if you change the
selection within a window, X11 will only notify the owner and the
previous owner of the change, i.e. it will not notify all
applications that the selection or clipboard data changed.
- \i Lastly, the X11 clipboard is event driven, i.e. the clipboard
+ \li Lastly, the X11 clipboard is event driven, i.e. the clipboard
will not function properly if the event loop is not running.
Similarly, it is recommended that the contents of the clipboard
are stored or retrieved in direct response to user-input events,
@@ -105,7 +105,7 @@ QT_BEGIN_NAMESPACE
store or retrieve the clipboard contents in response to timer or
non-user-input events.
- \i Since there is no standard way to copy and paste files between
+ \li Since there is no standard way to copy and paste files between
applications on X11, various MIME types and conventions are currently
in use. For instance, Nautilus expects files to be supplied with a
\c{x-special/gnome-copied-files} MIME type with data beginning with
@@ -123,12 +123,12 @@ QT_BEGIN_NAMESPACE
\list
- \i Windows and Mac OS X do not support the global mouse
+ \li Windows and Mac OS X do not support the global mouse
selection; they only supports the global clipboard, i.e. they
only add text to the clipboard when an explicit copy or cut is
made.
- \i Windows and Mac OS X does not have the concept of ownership;
+ \li Windows and Mac OS X does not have the concept of ownership;
the clipboard is a fully global resource so all applications are
notified of changes.
diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp
index 77eb1e1e9c..95b2b4a28e 100644
--- a/src/gui/kernel/qcursor.cpp
+++ b/src/gui/kernel/qcursor.cpp
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
To set or get the position of the mouse cursor use the static
methods QCursor::pos() and QCursor::setPos().
- \bold{Note:} It is possible to create a QCursor before
+ \b{Note:} It is possible to create a QCursor before
QGuiApplication, but it is not useful except as a place-holder for a
real QCursor created after QGuiApplication. Attempting to use a
QCursor that was created before QGuiApplication will result in a
@@ -104,50 +104,50 @@ QT_BEGIN_NAMESPACE
theme, while others will use an internal bitmap cursor.
\table
- \header \o Shape \o Qt::CursorShape Value \o Cursor Name
- \o Shape \o Qt::CursorShape Value \o Cursor Name
- \row \o \inlineimage cursor-arrow.png
- \o Qt::ArrowCursor \o \c left_ptr
- \o \inlineimage cursor-sizev.png
- \o Qt::SizeVerCursor \o \c size_ver
- \row \o \inlineimage cursor-uparrow.png
- \o Qt::UpArrowCursor \o \c up_arrow
- \o \inlineimage cursor-sizeh.png
- \o Qt::SizeHorCursor \o \c size_hor
- \row \o \inlineimage cursor-cross.png
- \o Qt::CrossCursor \o \c cross
- \o \inlineimage cursor-sizeb.png
- \o Qt::SizeBDiagCursor \o \c size_bdiag
- \row \o \inlineimage cursor-ibeam.png
- \o Qt::IBeamCursor \o \c ibeam
- \o \inlineimage cursor-sizef.png
- \o Qt::SizeFDiagCursor \o \c size_fdiag
- \row \o \inlineimage cursor-wait.png
- \o Qt::WaitCursor \o \c wait
- \o \inlineimage cursor-sizeall.png
- \o Qt::SizeAllCursor \o \c size_all
- \row \o \inlineimage cursor-busy.png
- \o Qt::BusyCursor \o \c left_ptr_watch
- \o \inlineimage cursor-vsplit.png
- \o Qt::SplitVCursor \o \c split_v
- \row \o \inlineimage cursor-forbidden.png
- \o Qt::ForbiddenCursor \o \c forbidden
- \o \inlineimage cursor-hsplit.png
- \o Qt::SplitHCursor \o \c split_h
- \row \o \inlineimage cursor-hand.png
- \o Qt::PointingHandCursor \o \c pointing_hand
- \o \inlineimage cursor-openhand.png
- \o Qt::OpenHandCursor \o \c openhand
- \row \o \inlineimage cursor-whatsthis.png
- \o Qt::WhatsThisCursor \o \c whats_this
- \o \inlineimage cursor-closedhand.png
- \o Qt::ClosedHandCursor \o \c closedhand
- \row \o
- \o Qt::DragMoveCursor \o \c dnd-move or \c move
- \o
- \o Qt::DragCopyCursor \o \c dnd-copy or \c copy
- \row \o
- \o Qt::DragLinkCursor \o \c dnd-link or \c link
+ \header \li Shape \li Qt::CursorShape Value \li Cursor Name
+ \li Shape \li Qt::CursorShape Value \li Cursor Name
+ \row \li \inlineimage cursor-arrow.png
+ \li Qt::ArrowCursor \li \c left_ptr
+ \li \inlineimage cursor-sizev.png
+ \li Qt::SizeVerCursor \li \c size_ver
+ \row \li \inlineimage cursor-uparrow.png
+ \li Qt::UpArrowCursor \li \c up_arrow
+ \li \inlineimage cursor-sizeh.png
+ \li Qt::SizeHorCursor \li \c size_hor
+ \row \li \inlineimage cursor-cross.png
+ \li Qt::CrossCursor \li \c cross
+ \li \inlineimage cursor-sizeb.png
+ \li Qt::SizeBDiagCursor \li \c size_bdiag
+ \row \li \inlineimage cursor-ibeam.png
+ \li Qt::IBeamCursor \li \c ibeam
+ \li \inlineimage cursor-sizef.png
+ \li Qt::SizeFDiagCursor \li \c size_fdiag
+ \row \li \inlineimage cursor-wait.png
+ \li Qt::WaitCursor \li \c wait
+ \li \inlineimage cursor-sizeall.png
+ \li Qt::SizeAllCursor \li \c size_all
+ \row \li \inlineimage cursor-busy.png
+ \li Qt::BusyCursor \li \c left_ptr_watch
+ \li \inlineimage cursor-vsplit.png
+ \li Qt::SplitVCursor \li \c split_v
+ \row \li \inlineimage cursor-forbidden.png
+ \li Qt::ForbiddenCursor \li \c forbidden
+ \li \inlineimage cursor-hsplit.png
+ \li Qt::SplitHCursor \li \c split_h
+ \row \li \inlineimage cursor-hand.png
+ \li Qt::PointingHandCursor \li \c pointing_hand
+ \li \inlineimage cursor-openhand.png
+ \li Qt::OpenHandCursor \li \c openhand
+ \row \li \inlineimage cursor-whatsthis.png
+ \li Qt::WhatsThisCursor \li \c whats_this
+ \li \inlineimage cursor-closedhand.png
+ \li Qt::ClosedHandCursor \li \c closedhand
+ \row \li
+ \li Qt::DragMoveCursor \li \c dnd-move or \c move
+ \li
+ \li Qt::DragCopyCursor \li \c dnd-copy or \c copy
+ \row \li
+ \li Qt::DragLinkCursor \li \c dnd-link or \c link
\endtable
\sa QWidget, {fowler}{GUI Design Handbook: Cursors}
@@ -185,10 +185,10 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QPoint QCursor::pos()
+ \fn QPoint QCursor::pos(const QScreen *screen)
- Returns the position of the cursor (hot spot) in global screen
- coordinates.
+ Returns the position of the cursor (hot spot) of the \a screen
+ in global screen coordinates.
You can call QWidget::mapFromGlobal() to translate it to widget
coordinates.
@@ -197,10 +197,23 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn void QCursor::setPos(int x, int y)
+ \fn QPoint QCursor::pos()
+
+ Returns the position of the cursor (hot spot) of
+ the primary screen in global screen coordinates.
+
+ You can call QWidget::mapFromGlobal() to translate it to widget
+ coordinates.
+
+ \sa setPos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
+*/
- Moves the cursor (hot spot) to the global screen position (\a x,
- \a y).
+
+/*!
+ \fn void QCursor::setPos(QScreen *screen, int x, int y)
+
+ Moves the cursor (hot spot) of the \a screen to the global
+ screen position (\a x, \a y).
You can call QWidget::mapToGlobal() to translate widget
coordinates to global screen coordinates.
@@ -209,6 +222,18 @@ QT_BEGIN_NAMESPACE
*/
/*!
+ \fn void QCursor::setPos(int x, int y)
+
+ Moves the cursor (hot spot) of the primary screen
+ to the global screen position (\a x, \a y).
+
+ You can call QWidget::mapToGlobal() to translate widget
+ coordinates to global screen coordinates.
+
+ \sa pos(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QGuiApplication::primaryScreen()
+*/
+
+/*!
\fn void QCursor::setPos (const QPoint &p)
\overload
@@ -217,6 +242,15 @@ QT_BEGIN_NAMESPACE
\a p.
*/
+/*!
+ \fn void QCursor::setPos (QScreen *screen,const QPoint &p)
+
+ \overload
+
+ Moves the cursor (hot spot) to the global screen position of the
+ \a screen at point \a p.
+*/
+
/*****************************************************************************
QCursor stream functions
*****************************************************************************/
@@ -346,10 +380,10 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY)
The cursor \a bitmap (B) and \a mask (M) bits are combined like this:
\list
- \o B=1 and M=1 gives black.
- \o B=0 and M=1 gives white.
- \o B=0 and M=0 gives transparent.
- \o B=1 and M=0 gives an XOR'd result under Windows, undefined
+ \li B=1 and M=1 gives black.
+ \li B=0 and M=1 gives white.
+ \li B=0 and M=0 gives transparent.
+ \li B=1 and M=0 gives an XOR'd result under Windows, undefined
results on all other platforms.
\endlist
diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h
index 00b709b308..4820bcee9b 100644
--- a/src/gui/kernel/qcursor.h
+++ b/src/gui/kernel/qcursor.h
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
class QVariant;
+class QScreen;
/*
### The fake cursor has to go first with old qdoc.
@@ -101,8 +102,11 @@ public:
QPoint hotSpot() const;
static QPoint pos();
+ static QPoint pos(const QScreen *screen);
static void setPos(int x, int y);
+ static void setPos(QScreen *screen, int x, int y);
inline static void setPos(const QPoint &p) { setPos(p.x(), p.y()); }
+ inline static void setPos(QScreen *screen, const QPoint &p) { setPos(screen, p.x(), p.y()); }
#ifdef qdoc
HCURSOR_or_HANDLE handle() const;
diff --git a/src/gui/kernel/qcursor_qpa.cpp b/src/gui/kernel/qcursor_qpa.cpp
index 7ba2e1c580..1c719c839e 100644
--- a/src/gui/kernel/qcursor_qpa.cpp
+++ b/src/gui/kernel/qcursor_qpa.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qcursor.h>
+#include <qscreen.h>
#include <private/qcursor_p.h>
#include <qplatformcursor_qpa.h>
#include <private/qguiapplication_p.h>
@@ -110,27 +111,34 @@ void QCursorData::update()
QPoint QCursor::pos()
{
+ return QCursor::pos(QGuiApplication::primaryScreen());
+}
+
+QPoint QCursor::pos(const QScreen *screen)
+{
+ if (screen)
+ if (const QPlatformCursor *cursor = screen->handle()->cursor())
+ return cursor->pos();
return QGuiApplicationPrivate::lastCursorPosition.toPoint();
}
-void QCursor::setPos(int x, int y)
+void QCursor::setPos(QScreen *screen, int x, int y)
{
- QPoint target(x, y);
-
- // Need to check, since some X servers generate null mouse move
- // events, causing looping in applications which call setPos() on
- // every mouse move event.
- //
- if (pos() == target)
- return;
-
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- int cursorCount = cursors.count();
- for (int i = 0; i < cursorCount; ++i) {
- const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
- if (cursor)
- cursor.data()->setPos(target);
+ if (screen) {
+ if (QPlatformCursor *cursor = screen->handle()->cursor()) {
+ const QPoint pos = QPoint(x, y);
+ // Need to check, since some X servers generate null mouse move
+ // events, causing looping in applications which call setPos() on
+ // every mouse move event.
+ if (pos != cursor->pos())
+ cursor->setPos(pos);
+ }
}
}
+void QCursor::setPos(int x, int y)
+{
+ QCursor::setPos(QGuiApplication::primaryScreen(), x, y);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 2fb250cf18..1ed4a96192 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -125,417 +125,79 @@ QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies)
#endif
// the universe's only drag manager
-QDragManager *QDragManager::instance = 0;
+QDragManager *QDragManager::m_instance = 0;
QDragManager::QDragManager()
- : QObject(qApp)
+ : QObject(qApp), m_platformDropData(0), m_currentDropTarget(0),
+ m_platformDrag(QGuiApplicationPrivate::platformIntegration()->drag()),
+ m_object(0)
{
- Q_ASSERT(!instance);
+ Q_ASSERT(!m_instance);
- object = 0;
- beingCancelled = false;
- restoreCursor = false;
- willDrop = false;
- eventLoop = 0;
- currentDropTarget = 0;
- shapedPixmapWindow = 0;
-
- possible_actions = Qt::IgnoreAction;
-
- QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
- platformDrag = pi->drag();
-
- platformDropData = 0;
- if (platformDrag)
- platformDropData = platformDrag->platformDropData();
+ if (m_platformDrag)
+ m_platformDropData = m_platformDrag->platformDropData();
}
QDragManager::~QDragManager()
{
-#ifndef QT_NO_CURSOR
- if (restoreCursor)
- QGuiApplication::restoreOverrideCursor();
-#endif
- instance = 0;
+ m_instance = 0;
}
QDragManager *QDragManager::self()
{
- if (!instance && !QGuiApplication::closingDown())
- instance = new QDragManager;
- return instance;
+ if (!m_instance && !QGuiApplication::closingDown())
+ m_instance = new QDragManager;
+ return m_instance;
}
-QPixmap QDragManager::dragCursor(Qt::DropAction action) const
+QObject *QDragManager::source() const
{
- typedef QMap<Qt::DropAction, QPixmap>::const_iterator Iterator;
-
- if (const QDragPrivate *d = dragPrivate()) {
- const Iterator it = d->customCursors.constFind(action);
- if (it != d->customCursors.constEnd())
- return it.value();
- }
-
- Qt::CursorShape shape = Qt::ForbiddenCursor;
- switch (action) {
- case Qt::MoveAction:
- shape = Qt::DragMoveCursor;
- break;
- case Qt::CopyAction:
- shape = Qt::DragCopyCursor;
- break;
- case Qt::LinkAction:
- shape = Qt::DragLinkCursor;
- break;
- default:
- shape = Qt::ForbiddenCursor;
- }
- return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
-}
-
-Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions,
- Qt::KeyboardModifiers modifiers) const
-{
-#ifdef QDND_DEBUG
- qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
- qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
-#endif
-
- QDragPrivate *d = dragPrivate();
- Qt::DropAction defaultAction = d ? d->defaultDropAction : Qt::IgnoreAction;
-
- if (defaultAction == Qt::IgnoreAction) {
- //This means that the drag was initiated by QDrag::start and we need to
- //preserve the old behavior
- defaultAction = Qt::CopyAction;
- }
-
- if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
- defaultAction = Qt::LinkAction;
- else if (modifiers & Qt::ControlModifier)
- defaultAction = Qt::CopyAction;
- else if (modifiers & Qt::ShiftModifier)
- defaultAction = Qt::MoveAction;
- else if (modifiers & Qt::AltModifier)
- defaultAction = Qt::LinkAction;
-
-#ifdef QDND_DEBUG
- qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
-#endif
-
- // Check if the action determined is allowed
- if (!(possibleActions & defaultAction)) {
- if (possibleActions & Qt::CopyAction)
- defaultAction = Qt::CopyAction;
- else if (possibleActions & Qt::MoveAction)
- defaultAction = Qt::MoveAction;
- else if (possibleActions & Qt::LinkAction)
- defaultAction = Qt::LinkAction;
- else
- defaultAction = Qt::IgnoreAction;
- }
-
-#ifdef QDND_DEBUG
- qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
-#endif
-
- return defaultAction;
+ if (m_object)
+ return m_object->source();
+ return 0;
}
void QDragManager::setCurrentTarget(QObject *target, bool dropped)
{
- if (currentDropTarget == target)
+ if (m_currentDropTarget == target)
return;
- currentDropTarget = target;
- if (!dropped && object) {
- object->d_func()->target = target;
- emit object->targetChanged(target);
+ m_currentDropTarget = target;
+ if (!dropped && m_object) {
+ m_object->d_func()->target = target;
+ emit m_object->targetChanged(target);
}
-
}
-QObject *QDragManager::currentTarget()
+QObject *QDragManager::currentTarget() const
{
- return currentDropTarget;
-}
-
-
-static const int default_pm_hotx = -2;
-static const int default_pm_hoty = -16;
-static const char *const default_pm[] = {
-"13 9 3 1",
-". c None",
-" c #000000",
-"X c #FFFFFF",
-"X X X X X X X",
-" X X X X X X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X.........X ",
-"X ......... X",
-" X X X X X X ",
-"X X X X X X X",
-};
-
-
-QShapedPixmapWindow::QShapedPixmapWindow()
- : QWindow()
-{
- setSurfaceType(RasterSurface);
- setWindowFlags(Qt::Tool | Qt::FramelessWindowHint |
- Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
- create();
- backingStore = new QBackingStore(this);
-}
-
-void QShapedPixmapWindow::render()
-{
- QRect rect(QPoint(), geometry().size());
- backingStore->resize(rect.size());
-
- backingStore->beginPaint(rect);
-
- QPaintDevice *device = backingStore->paintDevice();
-
- {
- QPainter p(device);
- p.drawPixmap(0, 0, pixmap);
- }
-
- backingStore->endPaint();
- backingStore->flush(rect);
-}
-
-
-
-
-static Qt::KeyboardModifiers oldstate;
-
-void QDragManager::updatePixmap()
-{
- if (shapedPixmapWindow) {
- shapedPixmapWindow->pixmap = QPixmap();
- shapedPixmapWindow->hotSpot = QPoint(default_pm_hotx,default_pm_hoty);
- if (object) {
- shapedPixmapWindow->pixmap = object->pixmap();
- if (!shapedPixmapWindow->pixmap.isNull())
- shapedPixmapWindow->hotSpot = object->hotSpot();
- }
- if (shapedPixmapWindow->pixmap.isNull())
- shapedPixmapWindow->pixmap = QPixmap(default_pm);
- shapedPixmapWindow->setGeometry(QRect(QCursor::pos() - shapedPixmapWindow->hotSpot, shapedPixmapWindow->pixmap.size()));
- shapedPixmapWindow->show();
- shapedPixmapWindow->render();
- }
-}
-
-void QDragManager::updateCursor()
-{
- if (shapedPixmapWindow) {
- shapedPixmapWindow->render(); // ### Hack
- shapedPixmapWindow->move(QCursor::pos() - shapedPixmapWindow->hotSpot);
- }
-
- Qt::CursorShape cursorShape = Qt::ForbiddenCursor;
- if (willDrop) {
- if (global_accepted_action == Qt::CopyAction) {
- cursorShape = Qt::DragCopyCursor;
- } else if (global_accepted_action == Qt::LinkAction) {
- cursorShape = Qt::DragLinkCursor;
- } else {
- cursorShape = Qt::DragMoveCursor;
- }
- }
- QCursor *cursor = qApp->overrideCursor();
- if (cursor && cursorShape != cursor->shape())
- qApp->changeOverrideCursor(QCursor(cursorShape));
-}
-
-
-bool QDragManager::eventFilter(QObject *o, QEvent *e)
-{
- if (beingCancelled) {
- if (e->type() == QEvent::KeyRelease && static_cast<QKeyEvent*>(e)->key() == Qt::Key_Escape) {
- qApp->removeEventFilter(this);
- Q_ASSERT(object == 0);
- beingCancelled = false;
- eventLoop->exit();
- return true; // block the key release
- }
- return false;
- }
-
- Q_ASSERT(object != 0);
-
- if (!qobject_cast<QWindow *>(o))
- return false;
-
- switch(e->type()) {
- case QEvent::ShortcutOverride:
- // prevent accelerators from firing while dragging
- e->accept();
- return true;
-
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- {
- QKeyEvent *ke = static_cast<QKeyEvent *>(e);
- if (ke->key() == Qt::Key_Escape && e->type() == QEvent::KeyPress) {
- cancel();
- qApp->removeEventFilter(this);
- beingCancelled = false;
- eventLoop->exit();
- } else {
- // ### x11 forces move!
- updateCursor();
- }
- return true; // Eat all key events
- }
-
- case QEvent::MouseMove:
- move(static_cast<QMouseEvent *>(e));
- return true; // Eat all mouse events
-
- case QEvent::MouseButtonRelease:
- qApp->removeEventFilter(this);
- if (willDrop)
- drop(static_cast<QMouseEvent *>(e));
- else
- cancel();
- beingCancelled = false;
- eventLoop->exit();
- return true; // Eat all mouse events
-
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonDblClick:
- case QEvent::Wheel:
- return true;
- default:
- break;
- }
- return false;
+ return m_currentDropTarget;
}
Qt::DropAction QDragManager::drag(QDrag *o)
{
- if (!o || object == o)
+ if (!o || m_object == o)
return Qt::IgnoreAction;
- if (!platformDrag || !o->source()) {
+ if (!m_platformDrag || !o->source()) {
o->deleteLater();
return Qt::IgnoreAction;
}
- if (object) {
- cancel();
- qApp->removeEventFilter(this);
- beingCancelled = false;
- }
-
- object = o;
- if (!shapedPixmapWindow)
- shapedPixmapWindow = new QShapedPixmapWindow();
- oldstate = Qt::NoModifier; // #### Should use state that caused the drag
-// drag_mode = mode;
-
- possible_actions = dragPrivate()->possible_actions;
-
- willDrop = false;
- object->d_func()->target = 0;
- qApp->installEventFilter(this);
-
- global_accepted_action = Qt::CopyAction;
-#ifndef QT_NO_CURSOR
- qApp->setOverrideCursor(Qt::DragCopyCursor);
- restoreCursor = true;
- updateCursor();
-#endif
- updatePixmap();
-
- platformDrag->startDrag();
-
- eventLoop = new QEventLoop;
- (void) eventLoop->exec();
- delete eventLoop;
- eventLoop = 0;
-
- delete shapedPixmapWindow;
- shapedPixmapWindow = 0;
-
- return global_accepted_action;
-}
-
-void QDragManager::move(const QMouseEvent *me)
-{
- if (!platformDrag)
- return;
-
- platformDrag->move(me);
-}
-
-void QDragManager::drop(const QMouseEvent *me)
-{
- if (!platformDrag)
- return;
-
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QGuiApplication::restoreOverrideCursor();
- restoreCursor = false;
- }
-#endif
- willDrop = false;
-
- platformDrag->drop(me);
-
- if (object)
- object->deleteLater();
- object = 0;
-}
-
-void QDragManager::cancel(bool deleteSource)
-{
- if (!platformDrag)
- return;
-
-#ifndef QT_NO_CURSOR
- if (restoreCursor) {
- QGuiApplication::restoreOverrideCursor();
- restoreCursor = false;
+ if (m_object) {
+ qWarning("QDragManager::drag in possibly invalid state");
+ return Qt::IgnoreAction;
}
-#endif
-
- beingCancelled = true;
- platformDrag->cancel();
+ m_object = o;
- if (object && deleteSource)
- object->deleteLater();
- object = 0;
+ m_object->d_func()->target = 0;
- global_accepted_action = Qt::IgnoreAction;
-}
-
-/*!
- Called from startDrag() in QPlatformDrag implementations that do not need
- the desktop-oriented stuff provided by the event filter (e.g. because their
- drag is not based on mouse events). Instead, they will manage everything on
- their own, will not rely on move/drop/cancel, and will call stopDrag() to stop
- the event loop when the drag is over.
- */
-void QDragManager::unmanageEvents()
-{
- qApp->removeEventFilter(this);
-}
-
-void QDragManager::stopDrag()
-{
- if (eventLoop)
- eventLoop->exit();
+ const Qt::DropAction result = m_platformDrag->drag(m_object);
+ m_object = 0;
+ return result;
}
#endif // QT_NO_DRAGANDDROP
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index 857be34d10..764b73c06f 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -98,100 +98,45 @@ protected:
class QDragPrivate : public QObjectPrivate
{
public:
+ QDragPrivate()
+ : source(0)
+ , target(0)
+ , data(0)
+ { }
QObject *source;
QObject *target;
QMimeData *data;
QPixmap pixmap;
QPoint hotspot;
- Qt::DropActions possible_actions;
Qt::DropAction executed_action;
+ Qt::DropActions supported_actions;
+ Qt::DropAction default_action;
QMap<Qt::DropAction, QPixmap> customCursors;
- Qt::DropAction defaultDropAction;
};
-class QShapedPixmapWindow : public QWindow
-{
-public:
- QShapedPixmapWindow();
-
- void exposeEvent(QExposeEvent *)
- {
- render();
- }
-
- void render();
-
- QBackingStore *backingStore;
- QPixmap pixmap;
- QPoint hotSpot;
-};
-
-
class Q_GUI_EXPORT QDragManager : public QObject {
Q_OBJECT
- // only friend classes can use QDragManager.
- friend class QDrag;
- friend class QDragMoveEvent;
- friend class QDropEvent;
- friend class QApplication;
-
- bool eventFilter(QObject *, QEvent *);
-
public:
QDragManager();
~QDragManager();
static QDragManager *self();
- virtual Qt::DropAction drag(QDrag *);
-
- virtual void cancel(bool deleteSource = true);
- virtual void move(const QMouseEvent *me);
- virtual void drop(const QMouseEvent *me);
-
- void updatePixmap();
- void updateCursor();
-
- Qt::DropAction defaultAction(Qt::DropActions possibleActions,
- Qt::KeyboardModifiers modifiers) const;
-
- QPixmap dragCursor(Qt::DropAction action) const;
-
- QDragPrivate *dragPrivate() const { return object ? object->d_func() : 0; }
-
- inline QMimeData *dropData()
- { return object ? dragPrivate()->data : platformDropData; }
-
- void emitActionChanged(Qt::DropAction newAction) { if (object) emit object->actionChanged(newAction); }
+ Qt::DropAction drag(QDrag *);
void setCurrentTarget(QObject *target, bool dropped = false);
- QObject *currentTarget();
+ QObject *currentTarget() const;
- QDrag *object;
-
- bool beingCancelled;
- bool restoreCursor;
- bool willDrop;
- QEventLoop *eventLoop;
-
- Qt::DropActions possible_actions;
- // Shift/Ctrl handling, and final drop status
- Qt::DropAction global_accepted_action;
-
- QShapedPixmapWindow *shapedPixmapWindow;
-
- void unmanageEvents();
- void stopDrag();
+ QDrag *object() const { return m_object; }
+ QObject *source() const;
private:
- QMimeData *platformDropData;
-
- Qt::DropAction currentActionForOverrideCursor;
- QObject *currentDropTarget;
-
- QPlatformDrag *platformDrag;
+ QMimeData *m_platformDropData;
+ QObject *m_currentDropTarget;
+ QPlatformDrag *m_platformDrag;
+ QDrag *m_object;
- static QDragManager *instance;
+ static QDragManager *m_instance;
Q_DISABLE_COPY(QDragManager)
};
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 694b12a180..40015c8706 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include <qdrag.h>
+#include "private/qguiapplication_p.h"
#include <qpixmap.h>
#include <qpoint.h>
#include "qdnd_p.h"
@@ -114,9 +115,9 @@ QDrag::QDrag(QObject *dragSource)
d->target = 0;
d->data = 0;
d->hotspot = QPoint(-10, -10);
- d->possible_actions = Qt::CopyAction;
d->executed_action = Qt::IgnoreAction;
- d->defaultDropAction = Qt::IgnoreAction;
+ d->supported_actions = Qt::IgnoreAction;
+ d->default_action = Qt::IgnoreAction;
}
/*!
@@ -126,9 +127,6 @@ QDrag::~QDrag()
{
Q_D(QDrag);
delete d->data;
- QDragManager *manager = QDragManager::self();
- if (manager && manager->object == this)
- manager->cancel(false);
}
/*!
@@ -178,7 +176,7 @@ QPixmap QDrag::pixmap() const
Sets the position of the hot spot relative to the top-left corner of the
pixmap used to the point specified by \a hotspot.
- \bold{Note:} on X11, the pixmap may not be able to keep up with the mouse
+ \b{Note:} on X11, the pixmap may not be able to keep up with the mouse
movements if the hot spot causes the pixmap to be displayed
directly under the cursor.
*/
@@ -226,7 +224,7 @@ QObject *QDrag::target() const
from are specified in \a supportedActions. The default proposed action will be selected
among the allowed actions in the following order: Move, Copy and Link.
- \bold{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and Mac OS X, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
@@ -248,7 +246,7 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)
The \a defaultDropAction determines which action will be proposed when the user performs a
drag without using modifier keys.
- \bold{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and Mac OS X, the drag and drop operation
can take some time, but this function does not block the event
loop. Other events are still delivered to the application while
the operation is performed. On Windows, the Qt event loop is
@@ -264,24 +262,22 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
qWarning("QDrag: No mimedata set before starting the drag");
return d->executed_action;
}
- QDragManager *manager = QDragManager::self();
- d->defaultDropAction = Qt::IgnoreAction;
- d->possible_actions = supportedActions;
-
- if (manager) {
- if (defaultDropAction == Qt::IgnoreAction) {
- if (supportedActions & Qt::MoveAction) {
- d->defaultDropAction = Qt::MoveAction;
- } else if (supportedActions & Qt::CopyAction) {
- d->defaultDropAction = Qt::CopyAction;
- } else if (supportedActions & Qt::LinkAction) {
- d->defaultDropAction = Qt::LinkAction;
- }
- } else {
- d->defaultDropAction = defaultDropAction;
+ Qt::DropAction transformedDefaultDropAction = Qt::IgnoreAction;
+
+ if (defaultDropAction == Qt::IgnoreAction) {
+ if (supportedActions & Qt::MoveAction) {
+ transformedDefaultDropAction = Qt::MoveAction;
+ } else if (supportedActions & Qt::CopyAction) {
+ transformedDefaultDropAction = Qt::CopyAction;
+ } else if (supportedActions & Qt::LinkAction) {
+ transformedDefaultDropAction = Qt::LinkAction;
}
- d->executed_action = manager->drag(this);
+ } else {
+ transformedDefaultDropAction = defaultDropAction;
}
+ d->supported_actions = supportedActions;
+ d->default_action = transformedDefaultDropAction;
+ d->executed_action = QDragManager::self()->drag(this);
return d->executed_action;
}
@@ -289,13 +285,13 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
/*!
\obsolete
- \bold{Note:} It is recommended to use exec() instead of this function.
+ \b{Note:} It is recommended to use exec() instead of this function.
Starts the drag and drop operation and returns a value indicating the requested
drop action when it is completed. The drop actions that the user can choose
from are specified in \a request. Qt::CopyAction is always allowed.
- \bold{Note:} Although the drag and drop operation can take some time, this function
+ \b{Note:} Although the drag and drop operation can take some time, this function
does not block the event loop. Other events are still delivered to the application
while the operation is performed.
@@ -308,11 +304,9 @@ Qt::DropAction QDrag::start(Qt::DropActions request)
qWarning("QDrag: No mimedata set before starting the drag");
return d->executed_action;
}
- QDragManager *manager = QDragManager::self();
- d->defaultDropAction = Qt::IgnoreAction;
- d->possible_actions = request | Qt::CopyAction;
- if (manager)
- d->executed_action = manager->drag(this);
+ d->supported_actions = request | Qt::CopyAction;
+ d->default_action = Qt::IgnoreAction;
+ d->executed_action = QDragManager::self()->drag(this);
return d->executed_action;
}
@@ -336,6 +330,49 @@ void QDrag::setDragCursor(const QPixmap &cursor, Qt::DropAction action)
}
/*!
+ Returns the drag cursor for the \a action.
+
+ \since 5.0
+*/
+
+QPixmap QDrag::dragCursor(Qt::DropAction action) const
+{
+ typedef QMap<Qt::DropAction, QPixmap>::const_iterator Iterator;
+
+ Q_D(const QDrag);
+ const Iterator it = d->customCursors.constFind(action);
+ if (it != d->customCursors.constEnd())
+ return it.value();
+
+ Qt::CursorShape shape = Qt::ForbiddenCursor;
+ switch (action) {
+ case Qt::MoveAction:
+ shape = Qt::DragMoveCursor;
+ break;
+ case Qt::CopyAction:
+ shape = Qt::DragCopyCursor;
+ break;
+ case Qt::LinkAction:
+ shape = Qt::DragLinkCursor;
+ break;
+ default:
+ shape = Qt::ForbiddenCursor;
+ }
+ return QGuiApplicationPrivate::instance()->getPixmapCursor(shape);
+}
+
+Qt::DropActions QDrag::supportedActions() const
+{
+ Q_D(const QDrag);
+ return d->supported_actions;
+}
+
+Qt::DropAction QDrag::defaultAction() const
+{
+ Q_D(const QDrag);
+ return d->default_action;
+}
+/*!
\fn void QDrag::actionChanged(Qt::DropAction action)
This signal is emitted when the \a action associated with the
diff --git a/src/gui/kernel/qdrag.h b/src/gui/kernel/qdrag.h
index 0a1ddff2d9..de84b6588b 100644
--- a/src/gui/kernel/qdrag.h
+++ b/src/gui/kernel/qdrag.h
@@ -56,6 +56,7 @@ class QPixmap;
class QPoint;
class QDragManager;
+
class Q_GUI_EXPORT QDrag : public QObject
{
Q_OBJECT
@@ -81,6 +82,10 @@ public:
Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
void setDragCursor(const QPixmap &cursor, Qt::DropAction action);
+ QPixmap dragCursor(Qt::DropAction action) const;
+
+ Qt::DropActions supportedActions() const;
+ Qt::DropAction defaultAction() const;
Q_SIGNALS:
void actionChanged(Qt::DropAction action);
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 281d4f61bc..7b84f4a982 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -377,9 +377,9 @@ QMouseEvent::~QMouseEvent()
you will get the following QEvent::MouseMove events:
\list 1
- \o A::MouseMove
- \o B::MouseMove
- \o C::MouseMove
+ \li A::MouseMove
+ \li B::MouseMove
+ \li C::MouseMove
\endlist
You will get the same events for QEvent::HoverMove, except that the event
@@ -390,9 +390,9 @@ QMouseEvent::~QMouseEvent()
In this case the events will occur in the following way:
\list 1
- \o A::HoverMove
- \o A::HoverMove, B::HoverMove
- \o A::HoverMove, B::HoverMove, C::HoverMove
+ \li A::HoverMove
+ \li A::HoverMove, B::HoverMove
+ \li A::HoverMove, B::HoverMove, C::HoverMove
\endlist
*/
@@ -1483,20 +1483,20 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
step process:
\list 1
- \o \bold{Starting to Compose}
+ \li \b{Starting to Compose}
When the user presses the first key on a keyboard, an input
context is created. This input context will contain a string
of the typed characters.
- \o \bold{Composing}
+ \li \b{Composing}
With every new key pressed, the input method will try to create a
matching string for the text typed so far called preedit
string. While the input context is active, the user can only move
the cursor inside the string belonging to this input context.
- \o \bold{Completing}
+ \li \b{Completing}
At some point, the user will activate a user interface component
(perhaps using a particular key) where they can choose from a
@@ -1539,10 +1539,10 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
following steps:
\list 1
- \o If the widget has selected text, the selected text should get
+ \li If the widget has selected text, the selected text should get
removed.
- \o Remove the text starting at replacementStart() with length
+ \li Remove the text starting at replacementStart() with length
replacementLength() and replace it by the commitString(). If
replacementLength() is 0, replacementStart() gives the insertion
position for the commitString().
@@ -1556,7 +1556,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos)
If the widget implements undo/redo, this operation gets added to
the undo stack.
- \o If there is no current preedit string, insert the
+ \li If there is no current preedit string, insert the
preeditString() at the current cursor position; otherwise replace
the previous preeditString with the one received from this event.
@@ -2060,7 +2060,7 @@ QTabletEvent::~QTabletEvent()
Returns the z position of the device. Typically this is represented by a
wheel on a 4D Mouse. If the device does not support a Z-axis, this value is
- always zero. This is \bold not the same as pressure.
+ always zero. This is \b not the same as pressure.
\sa pressure()
*/
@@ -2295,8 +2295,9 @@ QDropEvent::~QDropEvent()
*/
QObject* QDropEvent::source() const
{
- QDragManager *manager = QDragManager::self();
- return (manager && manager->object) ? manager->object->source() : 0;
+ if (const QDragManager *manager = QDragManager::self())
+ return manager->source();
+ return 0;
}
@@ -2575,11 +2576,11 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/qstatustipevent/main.cpp 1
\dots
\snippet doc/src/snippets/qstatustipevent/main.cpp 3
- \o
+ \li
\image qstatustipevent-widget.png Widget with status tip.
\endtable
@@ -2588,12 +2589,12 @@ QHelpEvent::~QHelpEvent()
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/qstatustipevent/main.cpp 0
\snippet doc/src/snippets/qstatustipevent/main.cpp 2
\dots
\snippet doc/src/snippets/qstatustipevent/main.cpp 3
- \o
+ \li
\image qstatustipevent-action.png Action with status tip.
\endtable
@@ -2998,7 +2999,9 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
break;
#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel:
- dbg.nospace() << "QWheelEvent(" << static_cast<const QWheelEvent *>(e)->delta()
+ dbg.nospace() << "QWheelEvent("
+ << static_cast<const QWheelEvent *>(e)->pixelDelta()
+ << static_cast<const QWheelEvent *>(e)->angleDelta()
<< ')';
return dbg.space();
#endif
@@ -3402,10 +3405,10 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\list
- \i When the first touch point is detected, the destination widget is determined firstly by the
+ \li When the first touch point is detected, the destination widget is determined firstly by the
location on screen and secondly by the propagation rules.
- \i When additional touch points are detected, Qt first looks to see if there are any active
+ \li When additional touch points are detected, Qt first looks to see if there are any active
touch points on any ancestor or descendent of the widget under the new touch point. If there
are, the new touch point is grouped with the first, and the new touch point will be sent in a
single QTouchEvent to the widget that handled the first touch point. (The widget under the new
@@ -3427,19 +3430,19 @@ QWindowStateChangeEvent::~QWindowStateChangeEvent()
\list
- \i As mentioned above, enabling touch events means multiple widgets can be receiving touch
+ \li As mentioned above, enabling touch events means multiple widgets can be receiving touch
events simultaneously. Combined with the default QWidget::event() handling for QTouchEvents,
this gives you great flexibility in designing touch user interfaces. Be aware of the
implications. For example, it is possible that the user is moving a QSlider with one finger and
pressing a QPushButton with another. The signals emitted by these widgets will be
interleaved.
- \i Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or
+ \li Recursion into the event loop using one of the exec() methods (e.g., QDialog::exec() or
QMenu::exec()) in a QTouchEvent event handler is not supported. Since there are multiple event
recipients, recursion may cause problems, including but not limited to lost events
and unexpected infinite recursion.
- \i QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
+ \li QTouchEvents are not affected by a \l{QWidget::grabMouse()}{mouse grab} or an
\l{QApplication::activePopupWidget()}{active pop-up widget}. The behavior of QTouchEvents is
undefined when opening a pop-up or grabbing the mouse while there are more than one active touch
points.
@@ -3618,7 +3621,7 @@ QTouchEvent::TouchPoint::TouchPoint(const QTouchEvent::TouchPoint &other)
*/
QTouchEvent::TouchPoint::~TouchPoint()
{
- if (!d->ref.deref())
+ if (d && !d->ref.deref())
delete d;
}
@@ -3860,11 +3863,16 @@ QTouchEvent::TouchPoint::InfoFlags QTouchEvent::TouchPoint::flags() const
}
/*!
- Returns the raw, unfiltered positions for the touch point. The positions are in screen coordinates.
+ Returns the raw, unfiltered positions for the touch point. The positions are in native screen coordinates.
To get local coordinates you can use mapFromGlobal() of the QWindow returned by QTouchEvent::window().
\note Returns an empty list if the touch device's capabilities do not include QTouchDevice::RawPositions.
+ \note Native screen coordinates refer to the native orientation of the screen which, in case of
+ mobile devices, is typically portrait. This means that on systems capable of screen orientation
+ changes the positions in this list will not reflect the current orientation (unlike pos(),
+ screenPos(), etc.) and will always be reported in the native orientation.
+
\sa QTouchDevice::capabilities(), device(), window()
*/
QList<QPointF> QTouchEvent::TouchPoint::rawScreenPositions() const
@@ -4040,16 +4048,15 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
d->flags = flags;
}
-/*! \internal */
-QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
-{
- other.d->ref.ref();
- if (!d->ref.deref())
- delete d;
- d = other.d;
- return *this;
-}
+/*!
+ \fn QTouchEvent::TouchPoint &QTouchEvent::TouchPoint::operator=(const QTouchEvent::TouchPoint &other)
+ \internal
+ */
+/*!
+ \fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
+ \internal
+*/
/*!
\class QScrollPrepareEvent
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index ca93095a94..7c871b0dda 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -71,7 +71,7 @@ class QScreen;
class Q_GUI_EXPORT QInputEvent : public QEvent
{
public:
- QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
+ explicit QInputEvent(Type type, Qt::KeyboardModifiers modifiers = Qt::NoModifier);
~QInputEvent();
inline Qt::KeyboardModifiers modifiers() const { return modState; }
inline void setModifiers(Qt::KeyboardModifiers amodifiers) { modState = amodifiers; }
@@ -276,7 +276,7 @@ protected:
class Q_GUI_EXPORT QFocusEvent : public QEvent
{
public:
- QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
+ explicit QFocusEvent(Type type, Qt::FocusReason reason=Qt::OtherFocusReason);
~QFocusEvent();
inline bool gotFocus() const { return type() == FocusIn; }
@@ -292,8 +292,8 @@ private:
class Q_GUI_EXPORT QPaintEvent : public QEvent
{
public:
- QPaintEvent(const QRegion& paintRegion);
- QPaintEvent(const QRect &paintRect);
+ explicit QPaintEvent(const QRegion& paintRegion);
+ explicit QPaintEvent(const QRect &paintRect);
~QPaintEvent();
inline const QRect &rect() const { return m_rect; }
@@ -311,7 +311,7 @@ protected:
class Q_GUI_EXPORT QUpdateLaterEvent : public QEvent
{
public:
- QUpdateLaterEvent(const QRegion& paintRegion);
+ explicit QUpdateLaterEvent(const QRegion& paintRegion);
~QUpdateLaterEvent();
inline const QRegion &region() const { return m_region; }
@@ -337,7 +337,7 @@ protected:
class Q_GUI_EXPORT QExposeEvent : public QEvent
{
public:
- QExposeEvent(const QRegion &rgn);
+ explicit QExposeEvent(const QRegion &rgn);
~QExposeEvent();
inline const QRegion &region() const { return rgn; }
@@ -464,11 +464,12 @@ private:
int replace_length;
QString tentativeCommit;
};
+Q_DECLARE_TYPEINFO(QInputMethodEvent::Attribute, Q_MOVABLE_TYPE);
class Q_GUI_EXPORT QInputMethodQueryEvent : public QEvent
{
public:
- QInputMethodQueryEvent(Qt::InputMethodQueries queries);
+ explicit QInputMethodQueryEvent(Qt::InputMethodQueries queries);
~QInputMethodQueryEvent();
Qt::InputMethodQueries queries() const { return m_queries; }
@@ -586,7 +587,7 @@ private:
class Q_GUI_EXPORT QStatusTipEvent : public QEvent
{
public:
- QStatusTipEvent(const QString &tip);
+ explicit QStatusTipEvent(const QString &tip);
~QStatusTipEvent();
inline QString tip() const { return s; }
@@ -599,7 +600,7 @@ private:
class Q_GUI_EXPORT QWhatsThisClickedEvent : public QEvent
{
public:
- QWhatsThisClickedEvent(const QString &href);
+ explicit QWhatsThisClickedEvent(const QString &href);
~QWhatsThisClickedEvent();
inline QString href() const { return s; }
@@ -624,8 +625,8 @@ public:
class Q_GUI_EXPORT QFileOpenEvent : public QEvent
{
public:
- QFileOpenEvent(const QString &file);
- QFileOpenEvent(const QUrl &url);
+ explicit QFileOpenEvent(const QString &file);
+ explicit QFileOpenEvent(const QUrl &url);
~QFileOpenEvent();
inline QString file() const { return f; }
@@ -639,7 +640,7 @@ private:
class Q_GUI_EXPORT QToolBarChangeEvent : public QEvent
{
public:
- QToolBarChangeEvent(bool t);
+ explicit QToolBarChangeEvent(bool t);
~QToolBarChangeEvent();
inline bool toggle() const { return tog; }
@@ -669,7 +670,7 @@ protected:
class Q_GUI_EXPORT QClipboardEvent : public QEvent
{
public:
- QClipboardEvent(QEventPrivate *data);
+ explicit QClipboardEvent(QEventPrivate *data);
~QClipboardEvent();
QEventPrivate *data() { return d; }
@@ -679,7 +680,7 @@ public:
class Q_GUI_EXPORT QWindowStateChangeEvent: public QEvent
{
public:
- QWindowStateChangeEvent(Qt::WindowStates aOldState);
+ explicit QWindowStateChangeEvent(Qt::WindowStates aOldState);
QWindowStateChangeEvent(Qt::WindowStates aOldState, bool isOverride);
~QWindowStateChangeEvent();
@@ -711,10 +712,20 @@ public:
};
Q_DECLARE_FLAGS(InfoFlags, InfoFlag)
- TouchPoint(int id = -1);
- TouchPoint(const QTouchEvent::TouchPoint &other);
+ explicit TouchPoint(int id = -1);
+ TouchPoint(const TouchPoint &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
+ TouchPoint &operator=(TouchPoint &&other)
+ { qSwap(d, other.d); return *this; }
+#endif
~TouchPoint();
+ TouchPoint &operator=(const TouchPoint &other)
+ { if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
+
+ void swap(TouchPoint &other) { qSwap(d, other.d); }
+
int id() const;
Qt::TouchPointState state() const;
@@ -766,7 +777,6 @@ public:
void setVelocity(const QVector2D &v);
void setFlags(InfoFlags flags);
void setRawScreenPositions(const QList<QPointF> &positions);
- QTouchEvent::TouchPoint &operator=(const QTouchEvent::TouchPoint &other);
private:
QTouchEventTouchPointPrivate *d;
@@ -783,11 +793,11 @@ public:
};
#endif
- QTouchEvent(QEvent::Type eventType,
- QTouchDevice *device = 0,
- Qt::KeyboardModifiers modifiers = Qt::NoModifier,
- Qt::TouchPointStates touchPointStates = 0,
- const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
+ explicit QTouchEvent(QEvent::Type eventType,
+ QTouchDevice *device = 0,
+ Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ Qt::TouchPointStates touchPointStates = 0,
+ const QList<QTouchEvent::TouchPoint> &touchPoints = QList<QTouchEvent::TouchPoint>());
~QTouchEvent();
inline QWindow *window() const { return _window; }
@@ -818,14 +828,14 @@ protected:
friend class QApplication;
friend class QApplicationPrivate;
};
-
+Q_DECLARE_TYPEINFO(QTouchEvent::TouchPoint, Q_MOVABLE_TYPE);
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchEvent::TouchPoint::InfoFlags)
class QScrollPrepareEventPrivate;
class Q_GUI_EXPORT QScrollPrepareEvent : public QEvent
{
public:
- QScrollPrepareEvent(const QPointF &startPos);
+ explicit QScrollPrepareEvent(const QPointF &startPos);
~QScrollPrepareEvent();
QPointF startPos() const;
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1cd448a6bb..42ce3745de 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -73,8 +73,11 @@
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qwindow_p.h"
#include "private/qcursor_p.h"
+
#include "private/qdnd_p.h"
#include <private/qplatformthemefactory_qpa_p.h>
+#include "qplatformdrag_qpa.h"
+
#ifndef QT_NO_CURSOR
#include "qplatformcursor_qpa.h"
#endif
@@ -169,6 +172,11 @@ static inline void clearPalette()
static void initFontUnlocked()
{
+ if (!QGuiApplicationPrivate::app_font) {
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ if (const QFont *font = theme->font(QPlatformTheme::SystemFont))
+ QGuiApplicationPrivate::app_font = new QFont(*font);
+ }
if (!QGuiApplicationPrivate::app_font)
QGuiApplicationPrivate::app_font =
new QFont(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFont());
@@ -192,7 +200,7 @@ static inline void clearFontUnlocked()
application's initialization and finalization. In addition, QGuiApplication handles
most of the system-wide and application-wide settings.
- For any GUI application using Qt, there is precisely \bold one QGuiApplication
+ For any GUI application using Qt, there is precisely \b one QGuiApplication
object no matter whether the application has 0, 1, 2 or more windows at
any given time. For non-GUI Qt applications, use QCoreApplication instead,
as it does not depend on the \l QtGui library.
@@ -202,30 +210,30 @@ static inline void clearFontUnlocked()
QGuiApplication's main areas of responsibility are:
\list
- \o It initializes the application with the user's desktop settings,
+ \li It initializes the application with the user's desktop settings,
such as palette(), font() and styleHints(). It keeps
track of these properties in case the user changes the desktop
globally, for example, through some kind of control panel.
- \o It performs event handling, meaning that it receives events
+ \li It performs event handling, meaning that it receives events
from the underlying window system and dispatches them to the
relevant widgets. You can send your own events to windows by
using sendEvent() and postEvent().
- \o It parses common command line arguments and sets its internal
+ \li It parses common command line arguments and sets its internal
state accordingly. See the \l{QGuiApplication::QGuiApplication()}
{constructor documentation} below for more details.
- \o It provides localization of strings that are visible to the
+ \li It provides localization of strings that are visible to the
user via translate().
- \o It provides some magical objects like the clipboard().
+ \li It provides some magical objects like the clipboard().
- \o It knows about the application's windows. You can ask which
+ \li It knows about the application's windows. You can ask which
window is at a certain position using topLevelAt(), get a list of
topLevelWindows(), etc.
- \o It manages the application's mouse cursor handling, see
+ \li It manages the application's mouse cursor handling, see
setOverrideCursor()
\endlist
@@ -237,11 +245,11 @@ static inline void clearFontUnlocked()
\table
\header
- \o{2,1} Groups of functions
+ \li{2,1} Groups of functions
\row
- \o System settings
- \o desktopSettingsAware(),
+ \li System settings
+ \li desktopSettingsAware(),
setDesktopSettingsAware(),
styleHints(),
palette(),
@@ -250,8 +258,8 @@ static inline void clearFontUnlocked()
setFont().
\row
- \o Event handling
- \o exec(),
+ \li Event handling
+ \li exec(),
processEvents(),
exit(),
quit().
@@ -263,22 +271,22 @@ static inline void clearFontUnlocked()
notify().
\row
- \o Windows
- \o allWindows(),
+ \li Windows
+ \li allWindows(),
topLevelWindows(),
focusWindow(),
clipboard(),
topLevelAt().
\row
- \o Advanced cursor handling
- \o overrideCursor(),
+ \li Advanced cursor handling
+ \li overrideCursor(),
setOverrideCursor(),
restoreOverrideCursor().
\row
- \o Miscellaneous
- \o startingUp(),
+ \li Miscellaneous
+ \li startingUp(),
closingDown(),
type().
\endtable
@@ -306,9 +314,9 @@ static inline void clearFontUnlocked()
All Qt programs automatically support the following command line options:
\list
- \o -reverse, sets the application's layout direction to
+ \li -reverse, sets the application's layout direction to
Qt::RightToLeft
- \o -qmljsdebugger=, activates the QML/JS debugger with a specified port.
+ \li -qmljsdebugger=, activates the QML/JS debugger with a specified port.
The value must be of format port:1234[,block], where block is optional
and will make the application wait until a debugger connects to it.
\endlist
@@ -326,8 +334,7 @@ QGuiApplication::QGuiApplication(int &argc, char **argv, int flags)
QGuiApplication::QGuiApplication(QGuiApplicationPrivate &p)
: QCoreApplication(p)
{
- d_func()->init();
-}
+ d_func()->init(); }
/*!
Destructs the application.
@@ -931,6 +938,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
QPointF globalPoint = e->globalPos;
Qt::MouseButton button = Qt::NoButton;
+ bool doubleClick = false;
if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) {
type = QEvent::MouseMove;
@@ -938,8 +946,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (qAbs(globalPoint.x() - mousePressX) > mouse_double_click_distance||
qAbs(globalPoint.y() - mousePressY) > mouse_double_click_distance)
mousePressButton = Qt::NoButton;
- }
- else { // Check to see if a new button has been pressed/released.
+ } else { // Check to see if a new button has been pressed/released.
for (int check = Qt::LeftButton;
check <= int(Qt::MaxMouseButton);
check = check << 1) {
@@ -954,33 +961,26 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
}
buttons = e->buttons;
if (button & e->buttons) {
- if ((e->timestamp - mousePressTime) < static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval()) &&
- button == mousePressButton) {
- type = QEvent::MouseButtonDblClick;
- mousePressButton = Qt::NoButton;
- }
- else {
- type = QEvent::MouseButtonPress;
- mousePressTime = e->timestamp;
- mousePressButton = button;
- const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
- mousePressX = point.x();
- mousePressY = point.y();
- }
- }
- else
+ ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
+ doubleClick = e->timestamp - mousePressTime < doubleClickInterval && button == mousePressButton;
+ type = QEvent::MouseButtonPress;
+ mousePressTime = e->timestamp;
+ mousePressButton = button;
+ const QPoint point = QGuiApplicationPrivate::lastCursorPosition.toPoint();
+ mousePressX = point.x();
+ mousePressY = point.y();
+ } else {
type = QEvent::MouseButtonRelease;
+ }
}
-
if (window) {
QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, buttons, e->modifiers);
ev.setTimestamp(e->timestamp);
#ifndef QT_NO_CURSOR
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- for (int i = 0; i < cursors.count(); ++i)
- if (cursors.at(i))
- cursors.at(i).data()->pointerEvent(ev);
+ if (const QScreen *screen = window->screen())
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ cursor->pointerEvent(ev);
#endif
QGuiApplication::sendSpontaneousEvent(window, &ev);
if (!e->synthetic && !ev.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeTouchForUnhandledMouseEvents)) {
@@ -1015,12 +1015,16 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
fake.synthetic = true;
processTouchEvent(&fake);
}
+ if (doubleClick) {
+ mousePressButton = Qt::NoButton;
+ QMouseEvent dblClickEvent(QEvent::MouseButtonDblClick, localPoint, localPoint, globalPoint,
+ button, buttons, e->modifiers);
+ dblClickEvent.setTimestamp(e->timestamp);
+ QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
+ }
}
}
-
-//### there's a lot of duplicated logic here -- refactoring required!
-
void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::WheelEvent *e)
{
if (!e->window)
@@ -1039,8 +1043,6 @@ void QGuiApplicationPrivate::processWheelEvent(QWindowSystemInterfacePrivate::Wh
}
}
-
-
// Remember, Qt convention is: keyboard state is state *before*
void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEvent *e)
@@ -1547,49 +1549,62 @@ void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::E
QCoreApplication::sendSpontaneousEvent(window, &exposeEvent);
}
-Qt::DropAction QGuiApplicationPrivate::processDrag(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
static QPointer<QWindow> currentDragWindow;
- QDragManager *manager = QDragManager::self();
+ static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction;
+ QPlatformDrag *platformDrag = platformIntegration()->drag();
+ if (!platformDrag) {
+ lastAcceptedDropAction = Qt::IgnoreAction;
+ return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
+ }
+
if (!dropData) {
if (currentDragWindow.data() == w)
currentDragWindow = 0;
QDragLeaveEvent e;
QGuiApplication::sendEvent(w, &e);
- manager->global_accepted_action = Qt::IgnoreAction;
- return Qt::IgnoreAction;
+ lastAcceptedDropAction = Qt::IgnoreAction;
+ return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
}
- QDragMoveEvent me(p, manager->possible_actions, dropData,
+ QDragMoveEvent me(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
+
if (w != currentDragWindow) {
+ lastAcceptedDropAction = Qt::IgnoreAction;
if (currentDragWindow) {
QDragLeaveEvent e;
QGuiApplication::sendEvent(currentDragWindow, &e);
- manager->global_accepted_action = Qt::IgnoreAction;
}
currentDragWindow = w;
- QDragEnterEvent e(p, manager->possible_actions, dropData,
+ QDragEnterEvent e(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
QGuiApplication::sendEvent(w, &e);
- manager->global_accepted_action = e.isAccepted() ? e.dropAction() : Qt::IgnoreAction;
- if (manager->global_accepted_action != Qt::IgnoreAction) {
- me.setDropAction(manager->global_accepted_action);
- me.accept();
- }
+ if (e.isAccepted() && e.dropAction() != Qt::IgnoreAction)
+ lastAcceptedDropAction = e.dropAction();
+ }
+
+ // Handling 'DragEnter' should suffice for the application.
+ if (lastAcceptedDropAction != Qt::IgnoreAction
+ && (supportedActions & lastAcceptedDropAction)) {
+ me.setDropAction(lastAcceptedDropAction);
+ me.accept();
}
QGuiApplication::sendEvent(w, &me);
- manager->global_accepted_action = me.isAccepted() ? me.dropAction() : Qt::IgnoreAction;
- return manager->global_accepted_action;
+ lastAcceptedDropAction = me.isAccepted() ?
+ me.dropAction() : Qt::IgnoreAction;
+ return QPlatformDragQtResponse(me.isAccepted(), lastAcceptedDropAction, me.answerRect());
}
-Qt::DropAction QGuiApplicationPrivate::processDrop(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDropQtResponse QGuiApplicationPrivate::processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- QDragManager *manager = QDragManager::self();
- QDropEvent de(p, manager->possible_actions, dropData,
+ QDropEvent de(p, supportedActions, dropData,
QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers());
QGuiApplication::sendEvent(w, &de);
- manager->global_accepted_action = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction;
- return manager->global_accepted_action;
+
+ Qt::DropAction acceptedAction = de.isAccepted() ? de.dropAction() : Qt::IgnoreAction;
+ QPlatformDropQtResponse response(de.isAccepted(),acceptedAction);
+ return response;
}
#ifndef QT_NO_CLIPBOARD
@@ -1798,16 +1813,11 @@ void QGuiApplication::changeOverrideCursor(const QCursor &cursor)
#ifndef QT_NO_CURSOR
-static void applyCursor(QWindow *w, const QCursor &c)
-{
- QCursor cc = c;
- QList<QWeakPointer<QPlatformCursor> > cursors = QPlatformCursorPrivate::getInstances();
- int cursorCount = cursors.count();
- for (int i = 0; i < cursorCount; ++i) {
- const QWeakPointer<QPlatformCursor> &cursor(cursors.at(i));
- if (cursor)
- cursor.data()->changeCursor(&cc, w);
- }
+static inline void applyCursor(QWindow *w, QCursor c)
+{
+ if (const QScreen *screen = w->screen())
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ cursor->changeCursor(&c, w);
}
static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 68546ce0cf..d9477a3e9e 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -53,6 +53,8 @@
#include "private/qwindowsysteminterface_qpa_p.h"
#include "private/qshortcutmap_p.h"
+#include "qplatformdrag_qpa.h"
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
@@ -121,8 +123,8 @@ public:
static void processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e);
- static Qt::DropAction processDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
- static Qt::DropAction processDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static QPlatformDragQtResponse processDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
+ static QPlatformDropQtResponse processDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static bool processNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 7053f01196..b0200335d7 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -164,14 +164,14 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
three different ways:
\list
- \o For standard shortcuts, a \l{QKeySequence::StandardKey}{standard key}
+ \li For standard shortcuts, a \l{QKeySequence::StandardKey}{standard key}
can be used to request the platform-specific key sequence associated
with each shortcut.
- \o For custom shortcuts, human-readable strings such as "Ctrl+X" can
+ \li For custom shortcuts, human-readable strings such as "Ctrl+X" can
be used, and these can be translated into the appropriate shortcuts
for users of different languages. Translations are made in the
"QShortcut" context.
- \o For hard-coded shortcuts, integer key codes can be specified with
+ \li For hard-coded shortcuts, integer key codes can be specified with
a combination of values defined by the Qt::Key and Qt::Modifier enum
values. Each key code consists of a single Qt::Key value and zero or
more modifiers, such as Qt::SHIFT, Qt::CTRL, Qt::ALT and Qt::META.
@@ -206,7 +206,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
code point of the character; for example, 'A' gives the same key sequence
as Qt::Key_A.
- \bold{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
+ \b{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
and Qt::ControlModifier correspond to the \key Command keys on the
Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
Qt::MetaModifier correspond to the \key Control keys. Developers on
@@ -225,72 +225,72 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
corresponds to the \key Control keys.
\table
- \header \i StandardKey \i Windows \i Mac OS X \i KDE \i GNOME
- \row \i HelpContents \i F1 \i Ctrl+? \i F1 \i F1
- \row \i WhatsThis \i Shift+F1 \i Shift+F1 \i Shift+F1 \i Shift+F1
- \row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O
- \row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W
- \row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S
- \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q
- \row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S
- \row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N
- \row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D
- \row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del
- \row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins
- \row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins
- \row \i Preferences \i \i Ctrl+, \i \i
- \row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14
- \row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z \i Ctrl+Shift+Z \i Ctrl+Shift+Z
- \row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left
- \row \i Forward \i Alt+Right, Shift+Backspace \i Ctrl+] \i Alt+Right \i Alt+Right
- \row \i Refresh \i F5 \i F5 \i F5 \i Ctrl+R, F5
- \row \i ZoomIn \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus \i Ctrl+Plus
- \row \i ZoomOut \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus \i Ctrl+Minus
- \row \i Print \i Ctrl+P \i Ctrl+P \i Ctrl+P \i Ctrl+P
- \row \i AddTab \i Ctrl+T \i Ctrl+T \i Ctrl+Shift+N, Ctrl+T \i Ctrl+T
- \row \i NextChild \i Ctrl+Tab, Forward, Ctrl+F6 \i Ctrl+}, Forward, Ctrl+Tab \i Ctrl+Tab, Forward, Ctrl+Comma \i Ctrl+Tab, Forward
- \row \i PreviousChild \i Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \i Ctrl+{, Back, Ctrl+Shift+Tab \i Ctrl+Shift+Tab, Back, Ctrl+Period \i Ctrl+Shift+Tab, Back
- \row \i Find \i Ctrl+F \i Ctrl+F \i Ctrl+F \i Ctrl+F
- \row \i FindNext \i F3, Ctrl+G \i Ctrl+G \i F3 \i Ctrl+G, F3
- \row \i FindPrevious \i Shift+F3, Ctrl+Shift+G \i Ctrl+Shift+G \i Shift+F3 \i Ctrl+Shift+G, Shift+F3
- \row \i Replace \i Ctrl+H \i (none) \i Ctrl+R \i Ctrl+H
- \row \i SelectAll \i Ctrl+A \i Ctrl+A \i Ctrl+A \i Ctrl+A
- \row \i Bold \i Ctrl+B \i Ctrl+B \i Ctrl+B \i Ctrl+B
- \row \i Italic \i Ctrl+I \i Ctrl+I \i Ctrl+I \i Ctrl+I
- \row \i Underline \i Ctrl+U \i Ctrl+U \i Ctrl+U \i Ctrl+U
- \row \i MoveToNextChar \i Right \i Right \i Right \i Right
- \row \i MoveToPreviousChar \i Left \i Left \i Left \i Left
- \row \i MoveToNextWord \i Ctrl+Right \i Alt+Right \i Ctrl+Right \i Ctrl+Right
- \row \i MoveToPreviousWord \i Ctrl+Left \i Alt+Left \i Ctrl+Left \i Ctrl+Left
- \row \i MoveToNextLine \i Down \i Down \i Down \i Down
- \row \i MoveToPreviousLine \i Up \i Up \i Up \i Up
- \row \i MoveToNextPage \i PgDown \i PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\i PgDown \i PgDown
- \row \i MoveToPreviousPage \i PgUp \i PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \i PgUp \i PgUp
- \row \i MoveToStartOfLine \i Home \i Ctrl+Left, Meta+Left \i Home \i Home
- \row \i MoveToEndOfLine \i End \i Ctrl+Right, Meta+Right \i End \i End
- \row \i MoveToStartOfBlock \i (none) \i Alt+Up, Meta+A \i (none) \i (none)
- \row \i MoveToEndOfBlock \i (none) \i Alt+Down, Meta+E \i (none) \i (none)
- \row \i MoveToStartOfDocument\i Ctrl+Home \i Ctrl+Up, Home \i Ctrl+Home \i Ctrl+Home
- \row \i MoveToEndOfDocument \i Ctrl+End \i Ctrl+Down, End \i Ctrl+End \i Ctrl+End
- \row \i SelectNextChar \i Shift+Right \i Shift+Right \i Shift+Right \i Shift+Right
- \row \i SelectPreviousChar \i Shift+Left \i Shift+Left \i Shift+Left \i Shift+Left
- \row \i SelectNextWord \i Ctrl+Shift+Right \i Alt+Shift+Right \i Ctrl+Shift+Right \i Ctrl+Shift+Right
- \row \i SelectPreviousWord \i Ctrl+Shift+Left \i Alt+Shift+Left \i Ctrl+Shift+Left \i Ctrl+Shift+Left
- \row \i SelectNextLine \i Shift+Down \i Shift+Down \i Shift+Down \i Shift+Down
- \row \i SelectPreviousLine \i Shift+Up \i Shift+Up \i Shift+Up \i Shift+Up
- \row \i SelectNextPage \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown \i Shift+PgDown
- \row \i SelectPreviousPage \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp \i Shift+PgUp
- \row \i SelectStartOfLine \i Shift+Home \i Ctrl+Shift+Left \i Shift+Home \i Shift+Home
- \row \i SelectEndOfLine \i Shift+End \i Ctrl+Shift+Right \i Shift+End \i Shift+End
- \row \i SelectStartOfBlock \i (none) \i Alt+Shift+Up, Meta+Shift+A \i (none) \i (none)
- \row \i SelectEndOfBlock \i (none) \i Alt+Shift+Down, Meta+Shift+E \i (none) \i (none)
- \row \i SelectStartOfDocument\i Ctrl+Shift+Home \i Ctrl+Shift+Up, Shift+Home \i Ctrl+Shift+Home\i Ctrl+Shift+Home
- \row \i SelectEndOfDocument \i Ctrl+Shift+End \i Ctrl+Shift+Down, Shift+End \i Ctrl+Shift+End \i Ctrl+Shift+End
- \row \i DeleteStartOfWord \i Ctrl+Backspace \i Alt+Backspace \i Ctrl+Backspace \i Ctrl+Backspace
- \row \i DeleteEndOfWord \i Ctrl+Del \i (none) \i Ctrl+Del \i Ctrl+Del
- \row \i DeleteEndOfLine \i (none) \i (none) \i Ctrl+K \i Ctrl+K
- \row \i InsertParagraphSeparator \i Enter \i Enter \i Enter \i Enter
- \row \i InsertLineSeparator \i Shift+Enter \i Meta+Enter \i Shift+Enter \i Shift+Enter
+ \header \li StandardKey \li Windows \li Mac OS X \li KDE \li GNOME
+ \row \li HelpContents \li F1 \li Ctrl+? \li F1 \li F1
+ \row \li WhatsThis \li Shift+F1 \li Shift+F1 \li Shift+F1 \li Shift+F1
+ \row \li Open \li Ctrl+O \li Ctrl+O \li Ctrl+O \li Ctrl+O
+ \row \li Close \li Ctrl+F4, Ctrl+W \li Ctrl+W, Ctrl+F4 \li Ctrl+W \li Ctrl+W
+ \row \li Save \li Ctrl+S \li Ctrl+S \li Ctrl+S \li Ctrl+S
+ \row \li Quit \li \li Ctrl+Q \li Qtrl+Q \li Qtrl+Q
+ \row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S
+ \row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N
+ \row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D
+ \row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del
+ \row \li Copy \li Ctrl+C, Ctrl+Ins \li Ctrl+C \li Ctrl+C, F16, Ctrl+Ins \li Ctrl+C, F16, Ctrl+Ins
+ \row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins
+ \row \li Preferences \li \li Ctrl+, \li \li
+ \row \li Undo \li Ctrl+Z, Alt+Backspace \li Ctrl+Z \li Ctrl+Z, F14 \li Ctrl+Z, F14
+ \row \li Redo \li Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \li Ctrl+Shift+Z \li Ctrl+Shift+Z \li Ctrl+Shift+Z
+ \row \li Back \li Alt+Left, Backspace \li Ctrl+[ \li Alt+Left \li Alt+Left
+ \row \li Forward \li Alt+Right, Shift+Backspace \li Ctrl+] \li Alt+Right \li Alt+Right
+ \row \li Refresh \li F5 \li F5 \li F5 \li Ctrl+R, F5
+ \row \li ZoomIn \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus \li Ctrl+Plus
+ \row \li ZoomOut \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus \li Ctrl+Minus
+ \row \li Print \li Ctrl+P \li Ctrl+P \li Ctrl+P \li Ctrl+P
+ \row \li AddTab \li Ctrl+T \li Ctrl+T \li Ctrl+Shift+N, Ctrl+T \li Ctrl+T
+ \row \li NextChild \li Ctrl+Tab, Forward, Ctrl+F6 \li Ctrl+}, Forward, Ctrl+Tab \li Ctrl+Tab, Forward, Ctrl+Comma \li Ctrl+Tab, Forward
+ \row \li PreviousChild \li Ctrl+Shift+Tab, Back, Ctrl+Shift+F6 \li Ctrl+{, Back, Ctrl+Shift+Tab \li Ctrl+Shift+Tab, Back, Ctrl+Period \li Ctrl+Shift+Tab, Back
+ \row \li Find \li Ctrl+F \li Ctrl+F \li Ctrl+F \li Ctrl+F
+ \row \li FindNext \li F3, Ctrl+G \li Ctrl+G \li F3 \li Ctrl+G, F3
+ \row \li FindPrevious \li Shift+F3, Ctrl+Shift+G \li Ctrl+Shift+G \li Shift+F3 \li Ctrl+Shift+G, Shift+F3
+ \row \li Replace \li Ctrl+H \li (none) \li Ctrl+R \li Ctrl+H
+ \row \li SelectAll \li Ctrl+A \li Ctrl+A \li Ctrl+A \li Ctrl+A
+ \row \li Bold \li Ctrl+B \li Ctrl+B \li Ctrl+B \li Ctrl+B
+ \row \li Italic \li Ctrl+I \li Ctrl+I \li Ctrl+I \li Ctrl+I
+ \row \li Underline \li Ctrl+U \li Ctrl+U \li Ctrl+U \li Ctrl+U
+ \row \li MoveToNextChar \li Right \li Right \li Right \li Right
+ \row \li MoveToPreviousChar \li Left \li Left \li Left \li Left
+ \row \li MoveToNextWord \li Ctrl+Right \li Alt+Right \li Ctrl+Right \li Ctrl+Right
+ \row \li MoveToPreviousWord \li Ctrl+Left \li Alt+Left \li Ctrl+Left \li Ctrl+Left
+ \row \li MoveToNextLine \li Down \li Down \li Down \li Down
+ \row \li MoveToPreviousLine \li Up \li Up \li Up \li Up
+ \row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\li PgDown \li PgDown
+ \row \li MoveToPreviousPage \li PgUp \li PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \li PgUp \li PgUp
+ \row \li MoveToStartOfLine \li Home \li Ctrl+Left, Meta+Left \li Home \li Home
+ \row \li MoveToEndOfLine \li End \li Ctrl+Right, Meta+Right \li End \li End
+ \row \li MoveToStartOfBlock \li (none) \li Alt+Up, Meta+A \li (none) \li (none)
+ \row \li MoveToEndOfBlock \li (none) \li Alt+Down, Meta+E \li (none) \li (none)
+ \row \li MoveToStartOfDocument\li Ctrl+Home \li Ctrl+Up, Home \li Ctrl+Home \li Ctrl+Home
+ \row \li MoveToEndOfDocument \li Ctrl+End \li Ctrl+Down, End \li Ctrl+End \li Ctrl+End
+ \row \li SelectNextChar \li Shift+Right \li Shift+Right \li Shift+Right \li Shift+Right
+ \row \li SelectPreviousChar \li Shift+Left \li Shift+Left \li Shift+Left \li Shift+Left
+ \row \li SelectNextWord \li Ctrl+Shift+Right \li Alt+Shift+Right \li Ctrl+Shift+Right \li Ctrl+Shift+Right
+ \row \li SelectPreviousWord \li Ctrl+Shift+Left \li Alt+Shift+Left \li Ctrl+Shift+Left \li Ctrl+Shift+Left
+ \row \li SelectNextLine \li Shift+Down \li Shift+Down \li Shift+Down \li Shift+Down
+ \row \li SelectPreviousLine \li Shift+Up \li Shift+Up \li Shift+Up \li Shift+Up
+ \row \li SelectNextPage \li Shift+PgDown \li Shift+PgDown \li Shift+PgDown \li Shift+PgDown
+ \row \li SelectPreviousPage \li Shift+PgUp \li Shift+PgUp \li Shift+PgUp \li Shift+PgUp
+ \row \li SelectStartOfLine \li Shift+Home \li Ctrl+Shift+Left \li Shift+Home \li Shift+Home
+ \row \li SelectEndOfLine \li Shift+End \li Ctrl+Shift+Right \li Shift+End \li Shift+End
+ \row \li SelectStartOfBlock \li (none) \li Alt+Shift+Up, Meta+Shift+A \li (none) \li (none)
+ \row \li SelectEndOfBlock \li (none) \li Alt+Shift+Down, Meta+Shift+E \li (none) \li (none)
+ \row \li SelectStartOfDocument\li Ctrl+Shift+Home \li Ctrl+Shift+Up, Shift+Home \li Ctrl+Shift+Home\li Ctrl+Shift+Home
+ \row \li SelectEndOfDocument \li Ctrl+Shift+End \li Ctrl+Shift+Down, Shift+End \li Ctrl+Shift+End \li Ctrl+Shift+End
+ \row \li DeleteStartOfWord \li Ctrl+Backspace \li Alt+Backspace \li Ctrl+Backspace \li Ctrl+Backspace
+ \row \li DeleteEndOfWord \li Ctrl+Del \li (none) \li Ctrl+Del \li Ctrl+Del
+ \row \li DeleteEndOfLine \li (none) \li (none) \li Ctrl+K \li Ctrl+K
+ \row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter
+ \row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter \li Shift+Enter \li Shift+Enter
\endtable
Note that, since the key sequences used for the standard shortcuts differ
@@ -934,16 +934,6 @@ QKeySequence::QKeySequence()
Note the "File|Open" translator comment. It is by no means
necessary, but it provides some context for the human translator.
*/
-QKeySequence::QKeySequence(const QString &key)
-{
- d = new QKeySequencePrivate();
- assign(key);
-}
-
-/*!
- \since 4.7
- Creates a key sequence from the \a key string based on \a format.
-*/
QKeySequence::QKeySequence(const QString &key, QKeySequence::SequenceFormat format)
{
d = new QKeySequencePrivate();
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index d1e7d06653..e8dd134bc3 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -146,8 +146,7 @@ public:
};
QKeySequence();
- QKeySequence(const QString &key);
- QKeySequence(const QString &key, SequenceFormat format);
+ QKeySequence(const QString &key, SequenceFormat format = NativeText);
QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0);
QKeySequence(const QKeySequence &ks);
QKeySequence(StandardKey key);
diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h
index 3e2c35f088..d5c4d6c762 100644
--- a/src/gui/kernel/qopenglcontext_p.h
+++ b/src/gui/kernel/qopenglcontext_p.h
@@ -49,9 +49,7 @@
#include <private/qobject_p.h>
#include <qmutex.h>
-#ifndef QT_NO_DEBUG
#include <QtCore/QHash>
-#endif
QT_BEGIN_HEADER
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 6d3d1c9580..9a2eb12e3f 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -342,9 +342,9 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
The color groups:
\list
- \i The Active group is used for the window that has keyboard focus.
- \i The Inactive group is used for other windows.
- \i The Disabled group is used for widgets (not windows) that are
+ \li The Active group is used for the window that has keyboard focus.
+ \li The Inactive group is used for other windows.
+ \li The Disabled group is used for widgets (not windows) that are
disabled for some reason.
\endlist
@@ -844,7 +844,8 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2)
return true;
}
-/*! \obsolete
+/*! \fn int QPalette::serialNumber() const
+ \obsolete
Returns a number that identifies the contents of this QPalette
object. Distinct QPalette objects can only have the same serial
@@ -860,10 +861,6 @@ bool QPalette::isEqual(QPalette::ColorGroup group1, QPalette::ColorGroup group2)
\sa operator==()
*/
-int QPalette::serialNumber() const
-{
- return d->ser_no;
-}
/*!
Returns a number that identifies the contents of this QPalette
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index cc710fa67a..ca619a89b4 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -139,7 +139,9 @@ public:
inline bool operator!=(const QPalette &p) const { return !(operator==(p)); }
bool isCopyOf(const QPalette &p) const;
- int serialNumber() const;
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED inline int serialNumber() const { return cacheKey() >> 32; }
+#endif
qint64 cacheKey() const;
QPalette resolve(const QPalette &) const;
diff --git a/src/gui/kernel/qplatformcursor_qpa.cpp b/src/gui/kernel/qplatformcursor_qpa.cpp
index fd7bcdcf18..a4e998ddbc 100644
--- a/src/gui/kernel/qplatformcursor_qpa.cpp
+++ b/src/gui/kernel/qplatformcursor_qpa.cpp
@@ -43,13 +43,22 @@
#include <QPainter>
#include <QBitmap>
#include <QGuiApplication>
+#include <QScreen>
+#include <QPlatformScreen>
#include <private/qguiapplication_p.h>
#include <QDebug>
QT_BEGIN_NAMESPACE
-QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
+QList<QPlatformCursor *> QPlatformCursorPrivate::getInstances()
+{
+ QList<QPlatformCursor *> result;
+ foreach (const QScreen *screen, QGuiApplicationPrivate::screen_list)
+ if (QPlatformCursor *cursor = screen->handle()->cursor())
+ result.push_back(cursor);
+ return result;
+}
/*!
\class QPlatformCursor
@@ -93,10 +102,8 @@ QList <QWeakPointer<QPlatformCursor> > QPlatformCursorPrivate::instances;
Constructs a QPlatformCursor for the given \a screen.
*/
-QPlatformCursor::QPlatformCursor(QPlatformScreen *scr )
- : screen(scr)
+QPlatformCursor::QPlatformCursor()
{
- QPlatformCursorPrivate::instances.append(this);
}
QPoint QPlatformCursor::pos() const
diff --git a/src/gui/kernel/qplatformcursor_qpa.h b/src/gui/kernel/qplatformcursor_qpa.h
index a8cbb282fa..e29cf87d03 100644
--- a/src/gui/kernel/qplatformcursor_qpa.h
+++ b/src/gui/kernel/qplatformcursor_qpa.h
@@ -74,13 +74,12 @@ class QPlatformCursor;
class Q_GUI_EXPORT QPlatformCursorPrivate {
public:
- static QList<QWeakPointer<QPlatformCursor> > getInstances() { return instances; }
- static QList<QWeakPointer<QPlatformCursor> > instances;
+ static QList<QPlatformCursor *> getInstances();
};
class Q_GUI_EXPORT QPlatformCursor : public QObject {
public:
- QPlatformCursor(QPlatformScreen *);
+ QPlatformCursor();
// input methods
virtual void pointerEvent(const QMouseEvent & event) { Q_UNUSED(event); }
@@ -88,11 +87,8 @@ public:
virtual QPoint pos() const;
virtual void setPos(const QPoint &pos);
-protected:
- QPlatformScreen* screen; // Where to request an update
-
private:
- Q_DECLARE_PRIVATE(QPlatformCursor);
+ Q_DECLARE_PRIVATE(QPlatformCursor)
friend void qt_qpa_set_cursor(QWidget * w, bool force);
friend class QApplicationPrivate;
};
diff --git a/src/gui/kernel/qplatformdrag_qpa.cpp b/src/gui/kernel/qplatformdrag_qpa.cpp
new file mode 100644
index 0000000000..832b91db7e
--- /dev/null
+++ b/src/gui/kernel/qplatformdrag_qpa.cpp
@@ -0,0 +1,187 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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 General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qplatformdrag_qpa.h"
+
+#include <QtGui/private/qdnd_p.h>
+#include <QtGui/QKeyEvent>
+#include <QtGui/QGuiApplication>
+#include <QtCore/QEventLoop>
+
+QT_BEGIN_NAMESPACE
+
+QPlatformDropQtResponse::QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction)
+ : m_accepted(accepted)
+ , m_accepted_action(acceptedAction)
+{
+}
+
+bool QPlatformDropQtResponse::isAccepted() const
+{
+ return m_accepted;
+}
+
+Qt::DropAction QPlatformDropQtResponse::acceptedAction() const
+{
+ return m_accepted_action;
+}
+
+QPlatformDragQtResponse::QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect)
+ : QPlatformDropQtResponse(accepted,acceptedAction)
+ , m_answer_rect(answerRect)
+{
+}
+
+QRect QPlatformDragQtResponse::answerRect() const
+{
+ return m_answer_rect;
+}
+
+class QPlatformDragPrivate {
+public:
+ QPlatformDragPrivate() : cursor_drop_action(Qt::IgnoreAction) {}
+
+ Qt::DropAction cursor_drop_action;
+};
+
+QPlatformDrag::QPlatformDrag() : d_ptr(new QPlatformDragPrivate)
+{
+}
+
+QPlatformDrag::~QPlatformDrag()
+{
+}
+
+QDrag *QPlatformDrag::currentDrag() const
+{
+ return QDragManager::self()->object();
+}
+
+Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions,
+ Qt::KeyboardModifiers modifiers) const
+{
+#ifdef QDND_DEBUG
+ qDebug("QDragManager::defaultAction(Qt::DropActions possibleActions)");
+ qDebug("keyboard modifiers : %s", KeyboardModifiersToString(modifiers).latin1());
+#endif
+
+ Qt::DropAction default_action = Qt::IgnoreAction;
+
+ if (currentDrag()) {
+ default_action = currentDrag()->defaultAction();
+ }
+
+
+ if (default_action == Qt::IgnoreAction) {
+ //This means that the drag was initiated by QDrag::start and we need to
+ //preserve the old behavior
+ default_action = Qt::CopyAction;
+ }
+
+ if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier)
+ default_action = Qt::LinkAction;
+ else if (modifiers & Qt::ControlModifier)
+ default_action = Qt::CopyAction;
+ else if (modifiers & Qt::ShiftModifier)
+ default_action = Qt::MoveAction;
+ else if (modifiers & Qt::AltModifier)
+ default_action = Qt::LinkAction;
+
+#ifdef QDND_DEBUG
+ qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1());
+#endif
+
+ // Check if the action determined is allowed
+ if (!(possibleActions & default_action)) {
+ if (possibleActions & Qt::CopyAction)
+ default_action = Qt::CopyAction;
+ else if (possibleActions & Qt::MoveAction)
+ default_action = Qt::MoveAction;
+ else if (possibleActions & Qt::LinkAction)
+ default_action = Qt::LinkAction;
+ else
+ default_action = Qt::IgnoreAction;
+ }
+
+#ifdef QDND_DEBUG
+ qDebug("default action : %s", dragActionsToString(defaultAction).latin1());
+#endif
+
+ return default_action;
+}
+
+/*!
+ \brief Called to notify QDrag about changes of the current action.
+ */
+
+void QPlatformDrag::updateAction(Qt::DropAction action)
+{
+ Q_D(QPlatformDrag);
+ if (d->cursor_drop_action != action) {
+ d->cursor_drop_action = action;
+ emit currentDrag()->actionChanged(action);
+ }
+}
+
+static const char *const default_pm[] = {
+"13 9 3 1",
+". c None",
+" c #000000",
+"X c #FFFFFF",
+"X X X X X X X",
+" X X X X X X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X.........X ",
+"X ......... X",
+" X X X X X X ",
+"X X X X X X X",
+};
+
+Q_GLOBAL_STATIC_WITH_ARGS(QPixmap,qt_drag_default_pixmap,(default_pm))
+
+QPixmap QPlatformDrag::defaultPixmap()
+{
+ return *qt_drag_default_pixmap();
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformdrag_qpa.h b/src/gui/kernel/qplatformdrag_qpa.h
index 0c215071d3..7d22c69947 100644
--- a/src/gui/kernel/qplatformdrag_qpa.h
+++ b/src/gui/kernel/qplatformdrag_qpa.h
@@ -43,6 +43,7 @@
#define QPLATFORMDRAG_H
#include <QtCore/qglobal.h>
+#include <QtGui/QPixmap>
QT_BEGIN_HEADER
@@ -51,18 +52,54 @@ QT_BEGIN_NAMESPACE
class QMimeData;
class QMouseEvent;
+class QDrag;
+class QObject;
+class QEvent;
+class QPlatformDragPrivate;
-class QPlatformDrag
+class Q_GUI_EXPORT QPlatformDropQtResponse
{
public:
- virtual ~QPlatformDrag() {}
+ QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction);
+ bool isAccepted() const;
+ Qt::DropAction acceptedAction() const;
+private:
+ bool m_accepted;
+ Qt::DropAction m_accepted_action;
+
+};
+
+class Q_GUI_EXPORT QPlatformDragQtResponse : public QPlatformDropQtResponse
+{
+public:
+ QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect);
+
+ QRect answerRect() const;
+
+private:
+ QRect m_answer_rect;
+};
+
+class Q_GUI_EXPORT QPlatformDrag
+{
+ Q_DECLARE_PRIVATE(QPlatformDrag)
+public:
+ QPlatformDrag();
+ virtual ~QPlatformDrag();
+
+ QDrag *currentDrag() const;
virtual QMimeData *platformDropData() = 0;
- virtual void startDrag() {}
- virtual void move(const QMouseEvent *me) = 0;
- virtual void drop(const QMouseEvent *me) = 0;
- virtual void cancel() = 0;
+ virtual Qt::DropAction drag(QDrag *m_drag) = 0;
+ void updateAction(Qt::DropAction action);
+
+ Qt::DropAction defaultAction(Qt::DropActions possibleActions, Qt::KeyboardModifiers modifiers) const;
+
+ static QPixmap defaultPixmap();
+
+private:
+ QPlatformDragPrivate *d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
index 7237849011..f87a2956a3 100644
--- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp
+++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp
@@ -132,7 +132,7 @@ void QPlatformNativeInterface::setWindowProperty(QPlatformWindow *window, const
The event filter function set here is called for all messages
received from the platform if they are given type \eventType.
- It is \i not called for messages that are not meant for Qt objects.
+ It is \e not called for messages that are not meant for Qt objects.
The type of event is specific to the platform plugin chosen at run-time.
diff --git a/src/gui/kernel/qplatformscreen_qpa.cpp b/src/gui/kernel/qplatformscreen_qpa.cpp
index c832d853f4..022f198073 100644
--- a/src/gui/kernel/qplatformscreen_qpa.cpp
+++ b/src/gui/kernel/qplatformscreen_qpa.cpp
@@ -41,6 +41,7 @@
#include "qplatformscreen_qpa.h"
#include <QtGui/qguiapplication.h>
+#include <QtGui/qplatformcursor_qpa.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qplatformscreen_qpa_p.h>
#include <QtGui/qplatformintegration_qpa.h>
@@ -250,4 +251,14 @@ QPlatformScreenPageFlipper *QPlatformScreen::pageFlipper() const
return 0;
}
+/*!
+ Reimplement this function in subclass to return the cursor of the screen.
+
+ The default implementation returns 0.
+*/
+QPlatformCursor *QPlatformScreen::cursor() const
+{
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen_qpa.h b/src/gui/kernel/qplatformscreen_qpa.h
index e4b9b762b1..b6eb91f9b2 100644
--- a/src/gui/kernel/qplatformscreen_qpa.h
+++ b/src/gui/kernel/qplatformscreen_qpa.h
@@ -63,21 +63,13 @@ class QPlatformBackingStore;
class QPlatformOpenGLContext;
class QPlatformScreenPrivate;
class QPlatformWindow;
+class QPlatformCursor;
+class QPlatformScreenPageFlipper;
class QScreen;
class QSurfaceFormat;
typedef QPair<qreal, qreal> QDpi;
-class Q_GUI_EXPORT QPlatformScreenPageFlipper : public QObject
-{
- Q_OBJECT
-public:
- virtual bool displayBuffer(void *bufferHandle) = 0;
-
- signals:
- void bufferDisplayed(void *bufferHandle);
- void bufferReleased(void *bufferHandle);
-};
class Q_GUI_EXPORT QPlatformScreen
{
@@ -112,6 +104,7 @@ public:
virtual QString name() const { return QString(); }
virtual QPlatformScreenPageFlipper *pageFlipper() const;
+ virtual QPlatformCursor *cursor() const;
protected:
QScopedPointer<QPlatformScreenPrivate> d_ptr;
diff --git a/src/gui/image/qvolatileimagedata.cpp b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
index 3fcf24e187..d652e34e5e 100644
--- a/src/gui/image/qvolatileimagedata.cpp
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.cpp
@@ -39,76 +39,45 @@
**
****************************************************************************/
-#include "qvolatileimagedata_p.h"
-#include <QtGui/qpaintengine.h>
+#include "qplatformscreenpageflipper_qpa.h"
QT_BEGIN_NAMESPACE
-QVolatileImageData::QVolatileImageData()
- : pengine(0)
+QPlatformScreenBuffer::QPlatformScreenBuffer()
+ : m_destroyed(false)
+ , m_ready(true)
{
-}
-QVolatileImageData::QVolatileImageData(int w, int h, QImage::Format format)
- : pengine(0)
-{
- image = QImage(w, h, format);
-}
-
-QVolatileImageData::QVolatileImageData(const QImage &sourceImage)
- : pengine(0)
-{
- image = sourceImage;
}
-QVolatileImageData::QVolatileImageData(void *, void *)
- : pengine(0)
+QPlatformScreenBuffer::~QPlatformScreenBuffer()
{
- // Not supported.
-}
-QVolatileImageData::QVolatileImageData(const QVolatileImageData &other)
- : QSharedData()
-{
- image = other.image;
- // The detach is not mandatory here but we do it nonetheless in order to
- // keep the behavior consistent with other platforms.
- image.detach();
- pengine = 0;
}
-QVolatileImageData::~QVolatileImageData()
+bool QPlatformScreenBuffer::isDestroyed() const
{
- delete pengine;
+ return m_destroyed;
}
-void QVolatileImageData::beginDataAccess() const
+bool QPlatformScreenBuffer::isReady() const
{
- // nothing to do here
+ return m_ready;
}
-void QVolatileImageData::endDataAccess(bool readOnly) const
+void QPlatformScreenBuffer::aboutToBeDisplayed()
{
- Q_UNUSED(readOnly);
- // nothing to do here
}
-bool QVolatileImageData::ensureFormat(QImage::Format format)
+void QPlatformScreenBuffer::displayed()
{
- if (image.format() != format) {
- image = image.convertToFormat(format);
- }
- return true;
}
-void *QVolatileImageData::duplicateNativeImage() const
+QPlatformScreenPageFlipper::QPlatformScreenPageFlipper(QObject *parent)
+ :QObject(parent)
{
- return 0;
-}
-void QVolatileImageData::ensureImage()
-{
- // nothing to do here
}
QT_END_NAMESPACE
+
diff --git a/src/gui/image/qvolatileimagedata_p.h b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
index 59e1be12e3..850f9d8d2f 100644
--- a/src/gui/image/qvolatileimagedata_p.h
+++ b/src/gui/kernel/qplatformscreenpageflipper_qpa.h
@@ -39,46 +39,49 @@
**
****************************************************************************/
-#ifndef QVOLATILEIMAGEDATA_P_H
-#define QVOLATILEIMAGEDATA_P_H
+#ifndef QPLATFORMSCREENPAGEFLIPPER_QPA_H
+#define QPLATFORMSCREENPAGEFLIPPER_QPA_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/qimage.h>
-#include <QtCore/qshareddata.h>
+#include <QtCore/QObject>
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-class QVolatileImageData : public QSharedData
+class Q_GUI_EXPORT QPlatformScreenBuffer {
+public:
+ QPlatformScreenBuffer();
+ virtual ~QPlatformScreenBuffer();
+
+ bool isDestroyed() const;
+ bool isReady() const;
+
+ virtual void aboutToBeDisplayed();
+ virtual void displayed();
+ virtual void release() = 0;
+
+ virtual void *handle() const = 0;
+
+protected:
+ bool m_destroyed;
+ bool m_ready;
+};
+
+class Q_GUI_EXPORT QPlatformScreenPageFlipper : public QObject
{
+ Q_OBJECT
public:
- QVolatileImageData();
- QVolatileImageData(int w, int h, QImage::Format format);
- QVolatileImageData(const QImage &sourceImage);
- QVolatileImageData(void *nativeImage, void *nativeMask);
- QVolatileImageData(const QVolatileImageData &other);
- ~QVolatileImageData();
+ explicit QPlatformScreenPageFlipper(QObject *parent = 0);
- void beginDataAccess() const;
- void endDataAccess(bool readOnly = false) const;
- bool ensureFormat(QImage::Format format);
- void *duplicateNativeImage() const;
- void ensureImage();
+ virtual bool displayBuffer(QPlatformScreenBuffer *) = 0;
- QImage image;
- QPaintEngine *pengine;
+signals:
+ void bufferDisplayed(QPlatformScreenBuffer *);
+ void bufferReleased(QPlatformScreenBuffer *);
};
QT_END_NAMESPACE
-#endif // QVOLATILEIMAGEDATA_P_H
+QT_END_HEADER
+
+#endif // QPLATFORMSCREENPAGEFLIPPER_QPA_H
diff --git a/src/gui/kernel/qplatformtheme_qpa.cpp b/src/gui/kernel/qplatformtheme_qpa.cpp
index 3f6b69b902..c6314825d7 100644
--- a/src/gui/kernel/qplatformtheme_qpa.cpp
+++ b/src/gui/kernel/qplatformtheme_qpa.cpp
@@ -102,6 +102,11 @@ QT_BEGIN_NAMESPACE
\sa themeHint(), QStyle::pixelMetric()
*/
+QPlatformTheme::~QPlatformTheme()
+{
+
+}
+
QPlatformMenu *QPlatformTheme::createPlatformMenu(QMenu *menu) const
{
Q_UNUSED(menu);
@@ -132,6 +137,12 @@ const QPalette *QPlatformTheme::palette(Palette type) const
return 0;
}
+const QFont *QPlatformTheme::font(Font type) const
+{
+ Q_UNUSED(type)
+ return 0;
+}
+
QVariant QPlatformTheme::themeHint(ThemeHint hint) const
{
switch (hint) {
diff --git a/src/gui/kernel/qplatformtheme_qpa.h b/src/gui/kernel/qplatformtheme_qpa.h
index 31a52a9391..6ac6a0f573 100644
--- a/src/gui/kernel/qplatformtheme_qpa.h
+++ b/src/gui/kernel/qplatformtheme_qpa.h
@@ -55,6 +55,7 @@ class QPlatformMenuBar;
class QPlatformDialogHelper;
class QVariant;
class QPalette;
+class QFont;
class Q_GUI_EXPORT QPlatformTheme
{
@@ -86,9 +87,47 @@ public:
enum Palette {
SystemPalette,
ToolTipPalette,
+ ToolButtonPalette,
+ ButtonPalette,
+ HeaderPalette,
+ ComboBoxPalette,
+ ItemViewPalette,
+ MessageBoxLabelPelette,
+ TabBarPalette,
+ LabelPalette,
+ GroupBoxPalette,
+ MenuPalette,
+ MenuBarPalette,
+ TextEditPalette,
+ TextLineEditPalette,
NPalettes
};
+ enum Font {
+ SystemFont,
+ MenuFont,
+ MenuBarFont,
+ MenuItemFont,
+ MessageBoxFont,
+ LabelFont,
+ TipLabelFont,
+ StatusBarFont,
+ TitleBarFont,
+ MdiSubWindowTitleFont,
+ DockWidgetTitleFont,
+ PushButtonFont,
+ ToolButtonFont,
+ ItemViewFont,
+ ListViewFont,
+ HeaderViewFont,
+ ListBoxFont,
+ ComboMenuItemFont,
+ ComboLineEditFont,
+ SmallFont,
+ MiniFont,
+ NFonts
+ };
+
enum KeyboardSchemes
{
WindowsKeyboardScheme,
@@ -99,6 +138,8 @@ public:
CdeKeyboardScheme
};
+ virtual ~QPlatformTheme();
+
virtual QPlatformMenu *createPlatformMenu(QMenu *menu = 0) const;
virtual QPlatformMenuBar *createPlatformMenuBar(QMenuBar *menuBar = 0) const;
@@ -107,6 +148,8 @@ public:
virtual const QPalette *palette(Palette type = SystemPalette) const;
+ virtual const QFont *font(Font type = SystemFont) const;
+
virtual QVariant themeHint(ThemeHint hint) const;
};
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 40a4ec07a6..5b77d97950 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -43,6 +43,7 @@
#include "private/qguiapplication_p.h"
#include "private/qtouchdevice_p.h"
#include <QAbstractEventDispatcher>
+#include <QPlatformDrag>
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -447,14 +448,14 @@ int QWindowSystemInterface::windowSystemEventsQueued()
return QWindowSystemInterfacePrivate::windowSystemEventsQueued();
}
-Qt::DropAction QWindowSystemInterface::handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDragQtResponse QWindowSystemInterface::handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- return QGuiApplicationPrivate::processDrag(w, dropData, p);
+ return QGuiApplicationPrivate::processDrag(w, dropData, p,supportedActions);
}
-Qt::DropAction QWindowSystemInterface::handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p)
+QPlatformDropQtResponse QWindowSystemInterface::handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions)
{
- return QGuiApplicationPrivate::processDrop(w, dropData, p);
+ return QGuiApplicationPrivate::processDrop(w, dropData, p,supportedActions);
}
/*!
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 836fb40bd7..6dae11ea81 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE
class QMimeData;
class QTouchDevice;
+class QPlatformDragQtResponse;
+class QPlatformDropQtResponse;
class Q_GUI_EXPORT QWindowSystemInterface
@@ -122,8 +124,8 @@ public:
static void handleSynchronousExposeEvent(QWindow *tlw, const QRegion &region);
// Drag and drop. These events are sent immediately.
- static Qt::DropAction handleDrag(QWindow *w, QMimeData *dropData, const QPoint &p);
- static Qt::DropAction handleDrop(QWindow *w, QMimeData *dropData, const QPoint &p);
+ static QPlatformDragQtResponse handleDrag(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
+ static QPlatformDropQtResponse handleDrop(QWindow *w, const QMimeData *dropData, const QPoint &p, Qt::DropActions supportedActions);
static bool handleNativeEvent(QWindow *window, const QByteArray &eventType, void *message, long *result);
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 113b767e9f..08ed0ae40f 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -53,9 +53,9 @@ QT_BEGIN_NAMESPACE
The QGenericMatrix template has three parameters:
\table
- \row \i N \i Number of columns.
- \row \i M \i Number of rows.
- \row \i T \i Element type that is visible to users of the class.
+ \row \li N \li Number of columns.
+ \row \li M \li Number of rows.
+ \row \li T \li Element type that is visible to users of the class.
\endtable
\sa QMatrix4x4
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 068b2e36f7..0eb3506779 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -62,11 +62,11 @@ QT_BEGIN_NAMESPACE
Internally the data is stored as column-major format, so as to be optimal for
passing to OpenGL functions, which expect column-major data.
- When using these functions be aware that they return data in \bold{column-major}
+ When using these functions be aware that they return data in \b{column-major}
format:
\list
- \o data()
- \o constData()
+ \li data()
+ \li constData()
\endlist
\sa QVector3D, QGenericMatrix
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index 897fa356d3..3c3581f3f4 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
The QVector2D class can also be used to represent vertices in 2D space.
We therefore do not need to provide a separate vertex class.
- \bold{Note:} By design values in the QVector2D instance are stored as \c float.
+ \b{Note:} By design values in the QVector2D instance are stored as \c float.
This means that on platforms where the \c qreal arguments to QVector2D
functions are represented by \c double values, it is possible to
lose precision.
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 5251f9c015..adf3da4010 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE
The QVector3D class can also be used to represent vertices in 3D space.
We therefore do not need to provide a separate vertex class.
- \bold{Note:} By design values in the QVector3D instance are stored as \c float.
+ \b{Note:} By design values in the QVector3D instance are stored as \c float.
This means that on platforms where the \c qreal arguments to QVector3D
functions are represented by \c double values, it is possible to
lose precision.
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index e7ee46b88b..6b29221d92 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
The QVector4D class can also be used to represent vertices in 4D space.
We therefore do not need to provide a separate vertex class.
- \bold{Note:} By design values in the QVector4D instance are stored as \c float.
+ \b{Note:} By design values in the QVector4D instance are stored as \c float.
This means that on platforms where the \c qreal arguments to QVector4D
functions are represented by \c double values, it is possible to
lose precision.
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index a523cd2cf1..cc5750490d 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -83,10 +83,10 @@ QT_BEGIN_NAMESPACE
A framebuffer object has several characteristics:
\list
- \i \link setSamples() Number of samples per pixels.\endlink
- \i \link setAttachment() Depth and/or stencil attachments.\endlink
- \i \link setTextureTarget() Texture target.\endlink
- \i \link setInternalTextureFormat() Internal texture format.\endlink
+ \li \link setSamples() Number of samples per pixels.\endlink
+ \li \link setAttachment() Depth and/or stencil attachments.\endlink
+ \li \link setTextureTarget() Texture target.\endlink
+ \li \link setInternalTextureFormat() Internal texture format.\endlink
\endlist
Note that the desired attachments or number of samples per pixels might not
@@ -407,6 +407,12 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
if (samples == 0) {
glGenTextures(1, &texture);
glBindTexture(target, texture);
+
+ glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+
glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0,
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
if (mipmap) {
@@ -421,10 +427,6 @@ void QOpenGLFramebufferObjectPrivate::init(QOpenGLFramebufferObject *, const QSi
GL_RGBA, GL_UNSIGNED_BYTE, NULL);
}
}
- glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
funcs.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
target, texture, 0);
@@ -655,7 +657,7 @@ void QOpenGLFramebufferObjectPrivate::initAttachments(QOpenGLContext *ctx, QOpen
generates a 2D OpenGL texture (using the \c{GL_TEXTURE_2D} target),
which is used as the internal rendering target.
- \bold{It is important to have a current OpenGL context when creating a
+ \b{It is important to have a current OpenGL context when creating a
QOpenGLFramebufferObject, otherwise initialization will fail.}
When using a QPainter to paint to a QOpenGLFramebufferObject you should take
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 6850eac59e..fe9b370189 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -309,15 +309,15 @@ struct QBrushDataPointerDeleter
otherwise false. A brush is considered opaque if:
\list
- \o The alpha component of the color() is 255.
- \o Its texture() does not have an alpha channel and is not a QBitmap.
- \o The colors in the gradient() all have an alpha component that is 255.
+ \li The alpha component of the color() is 255.
+ \li Its texture() does not have an alpha channel and is not a QBitmap.
+ \li The colors in the gradient() all have an alpha component that is 255.
\endlist
\table 100%
\row
- \o \inlineimage brush-outline.png Outlines
- \o
+ \li \inlineimage brush-outline.png Outlines
+ \li
To specify the style and color of lines and outlines, use the
QPainter's \l {QPen}{pen} combined with Qt::PenStyle and
@@ -826,10 +826,10 @@ Q_GUI_EXPORT bool qt_isExtendedRadialGradient(const QBrush &brush)
is considered opaque if:
\list
- \i The alpha component of the color() is 255.
- \i Its texture() does not have an alpha channel and is not a QBitmap.
- \i The colors in the gradient() all have an alpha component that is 255.
- \i It is an extended radial gradient.
+ \li The alpha component of the color() is 255.
+ \li Its texture() does not have an alpha channel and is not a QBitmap.
+ \li The colors in the gradient() all have an alpha component that is 255.
+ \li It is an extended radial gradient.
\endlist
*/
@@ -1178,12 +1178,12 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
Qt currently supports three types of gradient fills:
\list
- \o \e Linear gradients interpolate colors between start and end points.
- \o \e Simple radial gradients interpolate colors between a focal point
+ \li \e Linear gradients interpolate colors between start and end points.
+ \li \e Simple radial gradients interpolate colors between a focal point
and end points on a circle surrounding it.
- \o \e Extended radial gradients interpolate colors between a center and
+ \li \e Extended radial gradients interpolate colors between a center and
a focal circle.
- \o \e Conical gradients interpolate colors around a center point.
+ \li \e Conical gradients interpolate colors around a center point.
\endlist
A gradient's type can be retrieved using the type() function.
@@ -1191,13 +1191,13 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\table
\header
- \o QLinearGradient
- \o QRadialGradient
- \o QConicalGradient
+ \li QLinearGradient
+ \li QRadialGradient
+ \li QConicalGradient
\row
- \o \inlineimage qgradient-linear.png
- \o \inlineimage qgradient-radial.png
- \o \inlineimage qgradient-conical.png
+ \li \inlineimage qgradient-linear.png
+ \li \inlineimage qgradient-radial.png
+ \li \inlineimage qgradient-conical.png
\endtable
The colors in a gradient are defined using stop points of the
@@ -1232,13 +1232,13 @@ QDataStream &operator>>(QDataStream &s, QBrush &b)
\table
\row
- \o \inlineimage qradialgradient-pad.png
- \o \inlineimage qradialgradient-repeat.png
- \o \inlineimage qradialgradient-reflect.png
+ \li \inlineimage qradialgradient-pad.png
+ \li \inlineimage qradialgradient-repeat.png
+ \li \inlineimage qradialgradient-reflect.png
\row
- \o \l {QGradient::PadSpread}{PadSpread}
- \o \l {QGradient::RepeatSpread}{RepeatSpread}
- \o \l {QGradient::ReflectSpread}{ReflectSpread}
+ \li \l {QGradient::PadSpread}{PadSpread}
+ \li \l {QGradient::RepeatSpread}{RepeatSpread}
+ \li \l {QGradient::ReflectSpread}{ReflectSpread}
\endtable
Note that the setSpread() function only has effect for linear and
@@ -1537,13 +1537,13 @@ bool QGradient::operator==(const QGradient &gradient) const
\table
\row
- \o \inlineimage qlineargradient-pad.png
- \o \inlineimage qlineargradient-reflect.png
- \o \inlineimage qlineargradient-repeat.png
+ \li \inlineimage qlineargradient-pad.png
+ \li \inlineimage qlineargradient-reflect.png
+ \li \inlineimage qlineargradient-repeat.png
\row
- \o \l {QGradient::PadSpread}{PadSpread} (default)
- \o \l {QGradient::ReflectSpread}{ReflectSpread}
- \o \l {QGradient::RepeatSpread}{RepeatSpread}
+ \li \l {QGradient::PadSpread}{PadSpread} (default)
+ \li \l {QGradient::ReflectSpread}{ReflectSpread}
+ \li \l {QGradient::RepeatSpread}{RepeatSpread}
\endtable
The colors in a gradient is defined using stop points of the
@@ -1723,13 +1723,13 @@ void QLinearGradient::setFinalStop(const QPointF &stop)
\table
\row
- \o \inlineimage qradialgradient-pad.png
- \o \inlineimage qradialgradient-reflect.png
- \o \inlineimage qradialgradient-repeat.png
+ \li \inlineimage qradialgradient-pad.png
+ \li \inlineimage qradialgradient-reflect.png
+ \li \inlineimage qradialgradient-repeat.png
\row
- \o \l {QGradient::PadSpread}{PadSpread} (default)
- \o \l {QGradient::ReflectSpread}{ReflectSpread}
- \o \l {QGradient::RepeatSpread}{RepeatSpread}
+ \li \l {QGradient::PadSpread}{PadSpread} (default)
+ \li \l {QGradient::ReflectSpread}{ReflectSpread}
+ \li \l {QGradient::RepeatSpread}{RepeatSpread}
\endtable
The colors in a gradient is defined using stop points of the
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 96491918cd..f531565fb9 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -69,11 +69,11 @@ QT_BEGIN_NAMESPACE
\table
\header
- \o RGB \o HSV \o CMYK
+ \li RGB \li HSV \li CMYK
\row
- \o \inlineimage qcolor-rgb.png
- \o \inlineimage qcolor-hsv.png
- \o \inlineimage qcolor-cmyk.png
+ \li \inlineimage qcolor-rgb.png
+ \li \inlineimage qcolor-hsv.png
+ \li \inlineimage qcolor-cmyk.png
\endtable
The QColor constructor creates the color based on RGB values. To
@@ -194,20 +194,20 @@ QT_BEGIN_NAMESPACE
HSV, like RGB, has three components:
\list
- \o H, for hue, is in the range 0 to 359 if the color is chromatic (not
+ \li H, for hue, is in the range 0 to 359 if the color is chromatic (not
gray), or meaningless if it is gray. It represents degrees on the
color wheel familiar to most people. Red is 0 (degrees), green is
120, and blue is 240.
\inlineimage qcolor-hue.png
- \o S, for saturation, is in the range 0 to 255, and the bigger it is,
+ \li S, for saturation, is in the range 0 to 255, and the bigger it is,
the stronger the color is. Grayish colors have saturation near 0; very
strong colors have saturation near 255.
\inlineimage qcolor-saturation.png
- \o V, for value, is in the range 0 to 255 and represents lightness or
+ \li V, for value, is in the range 0 to 255 and represents lightness or
brightness of the color. 0 is black; 255 is as far from black as
possible.
@@ -498,16 +498,16 @@ QString QColor::name() const
of these formats:
\list
- \i #RGB (each of R, G, and B is a single hex digit)
- \i #RRGGBB
- \i #RRRGGGBBB
- \i #RRRRGGGGBBBB
- \i A name from the list of colors defined in the list of \l{SVG color keyword names}
+ \li #RGB (each of R, G, and B is a single hex digit)
+ \li #RRGGBB
+ \li #RRRGGGBBB
+ \li #RRRRGGGGBBBB
+ \li A name from the list of colors defined in the list of \l{SVG color keyword names}
provided by the World Wide Web Consortium; for example, "steelblue" or "gainsboro".
These color names work on all platforms. Note that these color names are \e not the
same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not
refer to the same color.
- \i \c transparent - representing the absence of a color.
+ \li \c transparent - representing the absence of a color.
\endlist
The color is invalid if \a name cannot be parsed.
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 6b5eb14f5f..ced2e4548c 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -111,8 +111,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qmatrix-simpletransformation.png
- \o
+ \li \inlineimage qmatrix-simpletransformation.png
+ \li
\snippet doc/src/snippets/matrix/matrix.cpp 0
\endtable
@@ -123,8 +123,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qmatrix-combinedtransformation.png
- \o
+ \li \inlineimage qmatrix-combinedtransformation.png
+ \li
\snippet doc/src/snippets/matrix/matrix.cpp 1
\endtable
@@ -171,8 +171,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qmatrix-combinedtransformation.png
- \o
+ \li \inlineimage qmatrix-combinedtransformation.png
+ \li
\snippet doc/src/snippets/matrix/matrix.cpp 2
\endtable
diff --git a/src/gui/painting/qpaintengine_p.h b/src/gui/painting/qpaintengine_p.h
index 594259367c..15495cace8 100644
--- a/src/gui/painting/qpaintengine_p.h
+++ b/src/gui/painting/qpaintengine_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QPaintDevice;
-class QPaintEnginePrivate
+class Q_GUI_EXPORT QPaintEnginePrivate
{
Q_DECLARE_PUBLIC(QPaintEngine)
public:
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 43429abe8a..0f5468df4e 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -984,41 +984,41 @@ void QPainterPrivate::updateState(QPainterState *newState)
\list
- \o font() is the font used for drawing text. If the painter
+ \li font() is the font used for drawing text. If the painter
isActive(), you can retrieve information about the currently set
font, and its metrics, using the fontInfo() and fontMetrics()
functions respectively.
- \o brush() defines the color or pattern that is used for filling
+ \li brush() defines the color or pattern that is used for filling
shapes.
- \o pen() defines the color or stipple that is used for drawing
+ \li pen() defines the color or stipple that is used for drawing
lines or boundaries.
- \o backgroundMode() defines whether there is a background() or
+ \li backgroundMode() defines whether there is a background() or
not, i.e it is either Qt::OpaqueMode or Qt::TransparentMode.
- \o background() only applies when backgroundMode() is \l
+ \li background() only applies when backgroundMode() is \l
Qt::OpaqueMode and pen() is a stipple. In that case, it
describes the color of the background pixels in the stipple.
- \o brushOrigin() defines the origin of the tiled brushes, normally
+ \li brushOrigin() defines the origin of the tiled brushes, normally
the origin of widget's background.
- \o viewport(), window(), worldTransform() make up the painter's coordinate
+ \li viewport(), window(), worldTransform() make up the painter's coordinate
transformation system. For more information, see the \l
{Coordinate Transformations} section and the \l {Coordinate
System} documentation.
- \o hasClipping() tells whether the painter clips at all. (The paint
+ \li hasClipping() tells whether the painter clips at all. (The paint
device clips, too.) If the painter clips, it clips to clipRegion().
- \o layoutDirection() defines the layout direction used by the
+ \li layoutDirection() defines the layout direction used by the
painter when drawing text.
- \o worldMatrixEnabled() tells whether world transformation is enabled.
+ \li worldMatrixEnabled() tells whether world transformation is enabled.
- \o viewTransformEnabled() tells whether view transformation is
+ \li viewTransformEnabled() tells whether view transformation is
enabled.
\endlist
@@ -1052,9 +1052,9 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table 100%
\row
- \o \inlineimage qpainter-basicdrawing.png
- \o
- \bold {Basic Drawing Example}
+ \li \inlineimage qpainter-basicdrawing.png
+ \li
+ \b {Basic Drawing Example}
The \l {painting/basicdrawing}{Basic Drawing} example shows how to
display basic graphics primitives in a variety of styles using the
@@ -1068,8 +1068,8 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table 100%
\row
- \o
- \bold {Painter Paths example}
+ \li
+ \b {Painter Paths example}
The QPainterPath class provides a container for painting
operations, enabling graphical shapes to be constructed and
@@ -1078,7 +1078,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
The \l {painting/painterpaths}{Painter Paths} example shows how
painter paths can be used to build complex shapes for rendering.
- \o \inlineimage qpainter-painterpaths.png
+ \li \inlineimage qpainter-painterpaths.png
\endtable
QPainter also provides the fillPath() function which fills the
@@ -1096,13 +1096,13 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table
\header
- \o \l {painting/deform}{Vector Deformation}
- \o \l {painting/gradients}{Gradients}
- \o \l {painting/pathstroke}{Path Stroking}
+ \li \l {painting/deform}{Vector Deformation}
+ \li \l {painting/gradients}{Gradients}
+ \li \l {painting/pathstroke}{Path Stroking}
\row
- \o \inlineimage qpainter-vectordeformation.png
- \o \inlineimage qpainter-gradients.png
- \o \inlineimage qpainter-pathstroking.png
+ \li \inlineimage qpainter-vectordeformation.png
+ \li \inlineimage qpainter-gradients.png
+ \li \inlineimage qpainter-pathstroking.png
\endtable
@@ -1136,9 +1136,9 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table 100%
\row
- \o \inlineimage qpainter-concentriccircles.png
- \o
- \bold {Concentric Circles Example}
+ \li \inlineimage qpainter-concentriccircles.png
+ \li
+ \b {Concentric Circles Example}
The \l {painting/concentriccircles}{Concentric Circles} example
shows the improved rendering quality that can be obtained using
@@ -1176,12 +1176,12 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table
\header
- \o nop \o rotate() \o scale() \o translate()
+ \li nop \li rotate() \li scale() \li translate()
\row
- \o \inlineimage qpainter-clock.png
- \o \inlineimage qpainter-rotation.png
- \o \inlineimage qpainter-scale.png
- \o \inlineimage qpainter-translation.png
+ \li \inlineimage qpainter-clock.png
+ \li \inlineimage qpainter-rotation.png
+ \li \inlineimage qpainter-scale.png
+ \li \inlineimage qpainter-translation.png
\endtable
The most commonly used transformations are scaling, rotation,
@@ -1200,15 +1200,15 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table 100%
\row
- \o
- \bold {Affine Transformations Example}
+ \li
+ \b {Affine Transformations Example}
The \l {painting/affine}{Affine Transformations} example shows Qt's
ability to perform affine transformations on painting
operations. The demo also allows the user to experiment with the
transformation operations and see the results immediately.
- \o \inlineimage qpainter-affinetransformations.png
+ \li \inlineimage qpainter-affinetransformations.png
\endtable
All the tranformation operations operate on the transformation
@@ -1282,10 +1282,10 @@ void QPainterPrivate::updateState(QPainterState *newState)
\table 100%
\row
- \o \inlineimage qpainter-compositiondemo.png
+ \li \inlineimage qpainter-compositiondemo.png
- \o
- \bold {Composition Modes Example}
+ \li
+ \b {Composition Modes Example}
The \l {painting/composition}{Composition Modes} example, available in
Qt's examples directory, allows you to experiment with the various
@@ -1333,14 +1333,14 @@ void QPainterPrivate::updateState(QPainterState *newState)
\list
- \o Raster - This backend implements all rendering in pure software
+ \li Raster - This backend implements all rendering in pure software
and is always used to render into QImages. For optimal performance
only use the format types QImage::Format_ARGB32_Premultiplied,
QImage::Format_RGB32 or QImage::Format_RGB16. Any other format,
including QImage::Format_ARGB32, has significantly worse
performance. This engine is used by default for QWidget and QPixmap.
- \o OpenGL 2.0 (ES) - This backend is the primary backend for
+ \li OpenGL 2.0 (ES) - This backend is the primary backend for
hardware accelerated graphics. It can be run on desktop machines
and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0
specification. This includes most graphics chips produced in the
@@ -1348,7 +1348,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
onto a QOpenGLWidget or by passing \c {-graphicssystem opengl} on the
command line when the underlying system supports it.
- \o OpenVG - This backend implements the Khronos standard for 2D
+ \li OpenVG - This backend implements the Khronos standard for 2D
and Vector Graphics. It is primarily for embedded devices with
hardware support for OpenVG. The engine can be enabled by
passing \c {-graphicssystem openvg} on the command line when
@@ -1360,26 +1360,26 @@ void QPainterPrivate::updateState(QPainterState *newState)
\list
- \o Simple transformations, meaning translation and scaling, pluss
+ \li Simple transformations, meaning translation and scaling, pluss
0, 90, 180, 270 degree rotations.
- \o \c drawPixmap() in combination with simple transformations and
+ \li \c drawPixmap() in combination with simple transformations and
opacity with non-smooth transformation mode
(\c QPainter::SmoothPixmapTransform not enabled as a render hint).
- \o Rectangle fills with solid color, two-color linear gradients
+ \li Rectangle fills with solid color, two-color linear gradients
and simple transforms.
- \o Rectangular clipping with simple transformations and intersect
+ \li Rectangular clipping with simple transformations and intersect
clip.
- \o Composition Modes \c QPainter::CompositionMode_Source and
+ \li Composition Modes \c QPainter::CompositionMode_Source and
QPainter::CompositionMode_SourceOver
- \o Rounded rectangle filling using solid color and two-color
+ \li Rounded rectangle filling using solid color and two-color
linear gradients fills.
- \o 3x3 patched pixmaps, via qDrawBorderPixmap.
+ \li 3x3 patched pixmaps, via qDrawBorderPixmap.
\endlist
@@ -1963,14 +1963,14 @@ QPaintEngine *QPainter::paintEngine() const
2 engine:
\list
- \i blending is disabled
- \i the depth, stencil and scissor tests are disabled
- \i the active texture unit is reset to 0
- \i the depth mask, depth function and the clear depth are reset to their
+ \li blending is disabled
+ \li the depth, stencil and scissor tests are disabled
+ \li the active texture unit is reset to 0
+ \li the depth mask, depth function and the clear depth are reset to their
default values
- \i the stencil mask, stencil operation and stencil function are reset to
+ \li the stencil mask, stencil operation and stencil function are reset to
their default values
- \i the current color is reset to solid white
+ \li the current color is reset to solid white
\endlist
If, for example, the OpenGL polygon mode is changed by the user inside a
@@ -2885,10 +2885,10 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
The following functions can transform the coordinate system without using
a QMatrix:
\list
- \i translate()
- \i scale()
- \i shear()
- \i rotate()
+ \li translate()
+ \li scale()
+ \li shear()
+ \li rotate()
\endlist
They operate on the painter's worldMatrix() and are implemented like this:
@@ -3360,8 +3360,8 @@ void QPainter::fillPath(const QPainterPath &path, const QBrush &brush)
\table 100%
\row
- \o \inlineimage qpainter-path.png
- \o
+ \li \inlineimage qpainter-path.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 5
\endtable
@@ -3405,8 +3405,8 @@ void QPainter::drawPath(const QPainterPath &path)
\table 100%
\row
- \o \inlineimage qpainter-line.png
- \o
+ \li \inlineimage qpainter-line.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 6
\endtable
@@ -3452,8 +3452,8 @@ void QPainter::drawPath(const QPainterPath &path)
\table 100%
\row
- \o \inlineimage qpainter-rectangle.png
- \o
+ \li \inlineimage qpainter-rectangle.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 7
\endtable
@@ -4121,8 +4121,8 @@ const QFont &QPainter::font() const
\table 100%
\row
- \o \inlineimage qpainter-roundrect.png
- \o
+ \li \inlineimage qpainter-roundrect.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 8
\endtable
@@ -4221,8 +4221,8 @@ void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
\table 100%
\row
- \o \inlineimage qpainter-ellipse.png
- \o
+ \li \inlineimage qpainter-ellipse.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 9
\endtable
@@ -4347,8 +4347,8 @@ void QPainter::drawEllipse(const QRect &r)
\table 100%
\row
- \o \inlineimage qpainter-arc.png
- \o
+ \li \inlineimage qpainter-arc.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 10
\endtable
@@ -4411,8 +4411,8 @@ void QPainter::drawArc(const QRectF &r, int a, int alen)
\table 100%
\row
- \o \inlineimage qpainter-pie.png
- \o
+ \li \inlineimage qpainter-pie.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 11
\endtable
@@ -4480,8 +4480,8 @@ void QPainter::drawPie(const QRectF &r, int a, int alen)
\table 100%
\row
- \o \inlineimage qpainter-chord.png
- \o
+ \li \inlineimage qpainter-chord.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 12
\endtable
@@ -4696,7 +4696,7 @@ void QPainter::drawLines(const QPoint *pointPairs, int lineCount)
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 13
\endtable
@@ -4802,8 +4802,8 @@ void QPainter::drawPolyline(const QPoint *points, int pointCount)
\table 100%
\row
- \o \inlineimage qpainter-polygon.png
- \o
+ \li \inlineimage qpainter-polygon.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 14
\endtable
@@ -4915,8 +4915,8 @@ void QPainter::drawPolygon(const QPoint *points, int pointCount, Qt::FillRule fi
\table 100%
\row
- \o \inlineimage qpainter-polygon.png
- \o
+ \li \inlineimage qpainter-polygon.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 15
\endtable
@@ -5039,7 +5039,7 @@ static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransfor
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 16
\endtable
@@ -5952,8 +5952,8 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
\table 100%
\row
- \o \inlineimage qpainter-text.png
- \o
+ \li \inlineimage qpainter-text.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 17
\endtable
@@ -5962,20 +5962,20 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
OR of the following flags:
\list
- \o Qt::AlignLeft
- \o Qt::AlignRight
- \o Qt::AlignHCenter
- \o Qt::AlignJustify
- \o Qt::AlignTop
- \o Qt::AlignBottom
- \o Qt::AlignVCenter
- \o Qt::AlignCenter
- \o Qt::TextDontClip
- \o Qt::TextSingleLine
- \o Qt::TextExpandTabs
- \o Qt::TextShowMnemonic
- \o Qt::TextWordWrap
- \o Qt::TextIncludeTrailingSpaces
+ \li Qt::AlignLeft
+ \li Qt::AlignRight
+ \li Qt::AlignHCenter
+ \li Qt::AlignJustify
+ \li Qt::AlignTop
+ \li Qt::AlignBottom
+ \li Qt::AlignVCenter
+ \li Qt::AlignCenter
+ \li Qt::TextDontClip
+ \li Qt::TextSingleLine
+ \li Qt::TextExpandTabs
+ \li Qt::TextShowMnemonic
+ \li Qt::TextWordWrap
+ \li Qt::TextIncludeTrailingSpaces
\endlist
\sa Qt::AlignmentFlag, Qt::TextFlag, boundingRect(), layoutDirection()
@@ -6044,18 +6044,18 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
the following flags:
\list
- \o Qt::AlignLeft
- \o Qt::AlignRight
- \o Qt::AlignHCenter
- \o Qt::AlignJustify
- \o Qt::AlignTop
- \o Qt::AlignBottom
- \o Qt::AlignVCenter
- \o Qt::AlignCenter
- \o Qt::TextSingleLine
- \o Qt::TextExpandTabs
- \o Qt::TextShowMnemonic
- \o Qt::TextWordWrap
+ \li Qt::AlignLeft
+ \li Qt::AlignRight
+ \li Qt::AlignHCenter
+ \li Qt::AlignJustify
+ \li Qt::AlignTop
+ \li Qt::AlignBottom
+ \li Qt::AlignVCenter
+ \li Qt::AlignCenter
+ \li Qt::TextSingleLine
+ \li Qt::TextExpandTabs
+ \li Qt::TextShowMnemonic
+ \li Qt::TextWordWrap
\endlist
By default, QPainter draws text anti-aliased.
@@ -6472,18 +6472,18 @@ void QPainter::drawTextItem(const QPointF &p, const QTextItem &_ti)
The \a flags argument is a bitwise OR of the following flags:
\list
- \o Qt::AlignLeft
- \o Qt::AlignRight
- \o Qt::AlignHCenter
- \o Qt::AlignTop
- \o Qt::AlignBottom
- \o Qt::AlignVCenter
- \o Qt::AlignCenter
- \o Qt::TextSingleLine
- \o Qt::TextExpandTabs
- \o Qt::TextShowMnemonic
- \o Qt::TextWordWrap
- \o Qt::TextIncludeTrailingSpaces
+ \li Qt::AlignLeft
+ \li Qt::AlignRight
+ \li Qt::AlignHCenter
+ \li Qt::AlignTop
+ \li Qt::AlignBottom
+ \li Qt::AlignVCenter
+ \li Qt::AlignCenter
+ \li Qt::TextSingleLine
+ \li Qt::TextExpandTabs
+ \li Qt::TextShowMnemonic
+ \li Qt::TextWordWrap
+ \li Qt::TextIncludeTrailingSpaces
\endlist
If several of the horizontal or several of the vertical alignment
flags are set, the resulting alignment is undefined.
@@ -6691,7 +6691,7 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 18
\endtable
@@ -7675,7 +7675,7 @@ void QPainterState::init(QPainter *p) {
\table 100%
\row
- \o
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainter.cpp 20
\endtable
@@ -7791,21 +7791,21 @@ void QPainterState::init(QPainter *p) {
\target GetFunction
\table
- \header \o Property Flag \o Current Property Value
- \row \o QPaintEngine::DirtyBackground \o backgroundBrush()
- \row \o QPaintEngine::DirtyBackgroundMode \o backgroundMode()
- \row \o QPaintEngine::DirtyBrush \o brush()
- \row \o QPaintEngine::DirtyBrushOrigin \o brushOrigin()
- \row \o QPaintEngine::DirtyClipRegion \e or QPaintEngine::DirtyClipPath
- \o clipOperation()
- \row \o QPaintEngine::DirtyClipPath \o clipPath()
- \row \o QPaintEngine::DirtyClipRegion \o clipRegion()
- \row \o QPaintEngine::DirtyCompositionMode \o compositionMode()
- \row \o QPaintEngine::DirtyFont \o font()
- \row \o QPaintEngine::DirtyTransform \o transform()
- \row \o QPaintEngine::DirtyClipEnabled \o isClipEnabled()
- \row \o QPaintEngine::DirtyPen \o pen()
- \row \o QPaintEngine::DirtyHints \o renderHints()
+ \header \li Property Flag \li Current Property Value
+ \row \li QPaintEngine::DirtyBackground \li backgroundBrush()
+ \row \li QPaintEngine::DirtyBackgroundMode \li backgroundMode()
+ \row \li QPaintEngine::DirtyBrush \li brush()
+ \row \li QPaintEngine::DirtyBrushOrigin \li brushOrigin()
+ \row \li QPaintEngine::DirtyClipRegion \e or QPaintEngine::DirtyClipPath
+ \li clipOperation()
+ \row \li QPaintEngine::DirtyClipPath \li clipPath()
+ \row \li QPaintEngine::DirtyClipRegion \li clipRegion()
+ \row \li QPaintEngine::DirtyCompositionMode \li compositionMode()
+ \row \li QPaintEngine::DirtyFont \li font()
+ \row \li QPaintEngine::DirtyTransform \li transform()
+ \row \li QPaintEngine::DirtyClipEnabled \li isClipEnabled()
+ \row \li QPaintEngine::DirtyPen \li pen()
+ \row \li QPaintEngine::DirtyHints \li renderHints()
\endtable
The QPaintEngineState class also provide the painter() function
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 25dd134401..eb67709318 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -227,8 +227,8 @@ static void qt_debug_path(const QPainterPath &path)
\table 100%
\row
- \o \inlineimage qpainterpath-construction.png
- \o
+ \li \inlineimage qpainterpath-construction.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 0
\endtable
@@ -241,11 +241,11 @@ static void qt_debug_path(const QPainterPath &path)
\table
\header
- \o Qt::OddEvenFill
- \o Qt::WindingFill
+ \li Qt::OddEvenFill
+ \li Qt::WindingFill
\row
- \o \inlineimage qt-fillrule-oddeven.png
- \o \inlineimage qt-fillrule-winding.png
+ \li \inlineimage qt-fillrule-oddeven.png
+ \li \inlineimage qt-fillrule-winding.png
\endtable
See the Qt::FillRule documentation for the definition of the
@@ -316,11 +316,11 @@ static void qt_debug_path(const QPainterPath &path)
\table
\header
- \o \l {painting/painterpaths}{Painter Paths Example}
- \o \l {painting/deform}{Vector Deformation Example}
+ \li \l {painting/painterpaths}{Painter Paths Example}
+ \li \l {painting/deform}{Vector Deformation Example}
\row
- \o \inlineimage qpainterpath-example.png
- \o \inlineimage qpainterpath-demo.png
+ \li \inlineimage qpainterpath-example.png
+ \li \inlineimage qpainterpath-demo.png
\endtable
\sa QPainterPathStroker, QPainter, QRegion, {Painter Paths Example}
@@ -731,8 +731,8 @@ void QPainterPath::lineTo(const QPointF &p)
\table 100%
\row
- \o \inlineimage qpainterpath-cubicto.png
- \o
+ \li \inlineimage qpainterpath-cubicto.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 1
\endtable
@@ -858,8 +858,8 @@ void QPainterPath::quadTo(const QPointF &c, const QPointF &e)
\table 100%
\row
- \o \inlineimage qpainterpath-arcto.png
- \o
+ \li \inlineimage qpainterpath-arcto.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 2
\endtable
@@ -970,8 +970,8 @@ QPointF QPainterPath::currentPosition() const
\table 100%
\row
- \o \inlineimage qpainterpath-addrectangle.png
- \o
+ \li \inlineimage qpainterpath-addrectangle.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 3
\endtable
@@ -1017,8 +1017,8 @@ void QPainterPath::addRect(const QRectF &r)
\table 100%
\row
- \o \inlineimage qpainterpath-addpolygon.png
- \o
+ \li \inlineimage qpainterpath-addpolygon.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 4
\endtable
@@ -1053,8 +1053,8 @@ void QPainterPath::addPolygon(const QPolygonF &polygon)
\table 100%
\row
- \o \inlineimage qpainterpath-addellipse.png
- \o
+ \li \inlineimage qpainterpath-addellipse.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 5
\endtable
@@ -1105,8 +1105,8 @@ void QPainterPath::addEllipse(const QRectF &boundingRect)
\table 100%
\row
- \o \inlineimage qpainterpath-addtext.png
- \o
+ \li \inlineimage qpainterpath-addtext.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpainterpath.cpp 6
\endtable
@@ -1281,11 +1281,11 @@ Qt::FillRule QPainterPath::fillRule() const
\table
\header
- \o Qt::OddEvenFill (default)
- \o Qt::WindingFill
+ \li Qt::OddEvenFill (default)
+ \li Qt::WindingFill
\row
- \o \inlineimage qt-fillrule-oddeven.png
- \o \inlineimage qt-fillrule-winding.png
+ \li \inlineimage qt-fillrule-oddeven.png
+ \li \inlineimage qt-fillrule-winding.png
\endtable
\sa fillRule()
@@ -2457,10 +2457,10 @@ void qt_path_stroke_cubic_to(qfixed c1x, qfixed c1y,
functions:
\list
- \o setWidth()
- \o setCapStyle()
- \o setJoinStyle()
- \o setDashPattern()
+ \li setWidth()
+ \li setCapStyle()
+ \li setJoinStyle()
+ \li setDashPattern()
\endlist
The setDashPattern() function accepts both a Qt::PenStyle object
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index 8d05eb56ff..77f0edc52f 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -104,21 +104,21 @@ typedef QPenPrivate QPenData;
\table
\row
- \o \inlineimage qpen-solid.png
- \o \inlineimage qpen-dash.png
- \o \inlineimage qpen-dot.png
+ \li \inlineimage qpen-solid.png
+ \li \inlineimage qpen-dash.png
+ \li \inlineimage qpen-dot.png
\row
- \o Qt::SolidLine
- \o Qt::DashLine
- \o Qt::DotLine
+ \li Qt::SolidLine
+ \li Qt::DashLine
+ \li Qt::DotLine
\row
- \o \inlineimage qpen-dashdot.png
- \o \inlineimage qpen-dashdotdot.png
- \o \inlineimage qpen-custom.png
+ \li \inlineimage qpen-dashdot.png
+ \li \inlineimage qpen-dashdotdot.png
+ \li \inlineimage qpen-custom.png
\row
- \o Qt::DashDotLine
- \o Qt::DashDotDotLine
- \o Qt::CustomDashLine
+ \li Qt::DashDotLine
+ \li Qt::DashDotDotLine
+ \li Qt::CustomDashLine
\endtable
Simply use the setStyle() function to convert the pen style to
@@ -153,13 +153,13 @@ typedef QPenPrivate QPenData;
\table
\row
- \o \inlineimage qpen-square.png
- \o \inlineimage qpen-flat.png
- \o \inlineimage qpen-roundcap.png
+ \li \inlineimage qpen-square.png
+ \li \inlineimage qpen-flat.png
+ \li \inlineimage qpen-roundcap.png
\row
- \o Qt::SquareCap
- \o Qt::FlatCap
- \o Qt::RoundCap
+ \li Qt::SquareCap
+ \li Qt::FlatCap
+ \li Qt::RoundCap
\endtable
The Qt::SquareCap style is a square line end that covers the end
@@ -183,13 +183,13 @@ typedef QPenPrivate QPenData;
\table
\row
- \o \inlineimage qpen-bevel.png
- \o \inlineimage qpen-miter.png
- \o \inlineimage qpen-roundjoin.png
+ \li \inlineimage qpen-bevel.png
+ \li \inlineimage qpen-miter.png
+ \li \inlineimage qpen-roundjoin.png
\row
- \o Qt::BevelJoin
- \o Qt::MiterJoin
- \o Qt::RoundJoin
+ \li Qt::BevelJoin
+ \li Qt::MiterJoin
+ \li Qt::RoundJoin
\endtable
The Qt::BevelJoin style fills the triangular notch between the two
@@ -213,8 +213,8 @@ typedef QPenPrivate QPenData;
\table 100%
\row
- \o \inlineimage qpen-demo.png
- \o \bold {\l {painting/pathstroke}{The Path Stroking Example}}
+ \li \inlineimage qpen-demo.png
+ \li \b {\l {painting/pathstroke}{The Path Stroking Example}}
The Path Stroking example shows Qt's built-in dash patterns and shows
how custom patterns can be used to extend the range of available
@@ -474,8 +474,8 @@ QVector<qreal> QPen::dashPattern() const
\table 100%
\row
- \o \inlineimage qpen-custom.png
- \o
+ \li \inlineimage qpen-custom.png
+ \li
\snippet doc/src/snippets/code/src_gui_painting_qpen.cpp 3
\endtable
@@ -527,8 +527,8 @@ qreal QPen::dashOffset() const
to specify the dash pattern.
\table
- \row \o \inlineimage qpen-dashpattern.png
- \o For example, a pattern where each stroke is four units long, followed by a gap
+ \row \li \inlineimage qpen-dashpattern.png
+ \li For example, a pattern where each stroke is four units long, followed by a gap
of two units, will begin with the stroke when drawn as a line.
However, if the dash offset is set to 4.0, any line drawn will begin with the gap.
diff --git a/src/gui/painting/qplatformbackingstore_qpa.cpp b/src/gui/painting/qplatformbackingstore_qpa.cpp
index 485190d301..ff7d91ccea 100644
--- a/src/gui/painting/qplatformbackingstore_qpa.cpp
+++ b/src/gui/painting/qplatformbackingstore_qpa.cpp
@@ -114,6 +114,9 @@ QWindow* QPlatformBackingStore::window() const
This function is called before painting onto the surface begins,
with the \a region in which the painting will occur.
+ \note A platform providing a backing store with an alpha channel
+ needs to properly initialize the region to be painted.
+
\sa endPaint(), paintDevice()
*/
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 48b0c00014..ebca1edddc 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -894,11 +894,11 @@ QRegion QRegion::intersect(const QRect &r) const
The rectangles \e must be optimally Y-X sorted and follow these restrictions:
\list
- \o The rectangles must not intersect.
- \o All rectangles with a given top coordinate must have the same height.
- \o No two rectangles may abut horizontally (they should be combined
+ \li The rectangles must not intersect.
+ \li All rectangles with a given top coordinate must have the same height.
+ \li No two rectangles may abut horizontally (they should be combined
into a single wider rectangle in that case).
- \o The rectangles must be sorted in ascending order, with Y as the major
+ \li The rectangles must be sorted in ascending order, with Y as the major
sort key and X as the minor sort key.
\endlist
\omit
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 363dd26bbf..e5c41efc15 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -156,8 +156,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qtransform-simpletransformation.png
- \o
+ \li \inlineimage qtransform-simpletransformation.png
+ \li
\snippet doc/src/snippets/transform/main.cpp 0
\endtable
@@ -168,8 +168,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qtransform-combinedtransformation.png
- \o
+ \li \inlineimage qtransform-combinedtransformation.png
+ \li
\snippet doc/src/snippets/transform/main.cpp 1
\endtable
@@ -218,8 +218,8 @@ QT_BEGIN_NAMESPACE
\table 100%
\row
- \o \inlineimage qtransform-combinedtransformation2.png
- \o
+ \li \inlineimage qtransform-combinedtransformation2.png
+ \li
\snippet doc/src/snippets/transform/main.cpp 2
\endtable
diff --git a/src/gui/text/qabstracttextdocumentlayout.cpp b/src/gui/text/qabstracttextdocumentlayout.cpp
index 86de48b1dc..589c0f701f 100644
--- a/src/gui/text/qabstracttextdocumentlayout.cpp
+++ b/src/gui/text/qabstracttextdocumentlayout.cpp
@@ -100,14 +100,14 @@ QT_BEGIN_NAMESPACE
custom text object into a document:
\list
- \o Choose an \a objectType. The \a objectType is an integer with a
+ \li Choose an \a objectType. The \a objectType is an integer with a
value greater or equal to QTextFormat::UserObject.
- \o Create a QTextCharFormat object and set the object type to the
+ \li Create a QTextCharFormat object and set the object type to the
chosen type using the setObjectType() function.
- \o Implement the QTextObjectInterface class.
- \o Call QAbstractTextDocumentLayout::registerHandler() with an instance of your
+ \li Implement the QTextObjectInterface class.
+ \li Call QAbstractTextDocumentLayout::registerHandler() with an instance of your
QTextObjectInterface subclass to register your object type.
- \o Insert QChar::ObjectReplacementCharacter with the aforementioned
+ \li Insert QChar::ObjectReplacementCharacter with the aforementioned
QTextCharFormat of the chosen object type into the document.
As mentioned, the functions of QTextObjectInterface
\l{QTextObjectInterface::}{intrinsicSize()} and
@@ -269,17 +269,17 @@ QT_BEGIN_NAMESPACE
implementation of this function would have to do the following:
\list
- \o Determine the list of changed \l{QTextBlock}(s) using the parameters
+ \li Determine the list of changed \l{QTextBlock}(s) using the parameters
provided.
- \o Each QTextBlock object's corresponding QTextLayout object needs to
+ \li Each QTextBlock object's corresponding QTextLayout object needs to
be processed. You can access the \l{QTextBlock}'s layout using the
QTextBlock::layout() function. This processing should take the
document's page size into consideration.
- \o If the total number of pages changed, the pageCountChanged() signal
+ \li If the total number of pages changed, the pageCountChanged() signal
should be emitted.
- \o If the total size changed, the documentSizeChanged() signal should
+ \li If the total size changed, the documentSizeChanged() signal should
be emitted.
- \o The update() signal should be emitted to schedule a repaint of areas
+ \li The update() signal should be emitted to schedule a repaint of areas
in the layout that require repainting.
\endlist
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index ee833a06cf..c68452d55a 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -419,14 +419,14 @@ QFontEngineData::~QFontEngineData()
\target fontmatching
The font matching algorithm works as follows:
\list 1
- \o The specified font family is searched for.
- \o If not found, the styleHint() is used to select a replacement
+ \li The specified font family is searched for.
+ \li If not found, the styleHint() is used to select a replacement
family.
- \o Each replacement font family is searched for.
- \o If none of these are found or there was no styleHint(), "helvetica"
+ \li Each replacement font family is searched for.
+ \li If none of these are found or there was no styleHint(), "helvetica"
will be searched for.
- \o If "helvetica" isn't found Qt will try the lastResortFamily().
- \o If the lastResortFamily() isn't found Qt will try the
+ \li If "helvetica" isn't found Qt will try the lastResortFamily().
+ \li If the lastResortFamily() isn't found Qt will try the
lastResortFont() which will always return a name of some kind.
\endlist
@@ -440,10 +440,10 @@ QFontEngineData::~QFontEngineData()
Once a font is found, the remaining attributes are matched in order of
priority:
\list 1
- \o fixedPitch()
- \o pointSize() (see below)
- \o weight()
- \o style()
+ \li fixedPitch()
+ \li pointSize() (see below)
+ \li weight()
+ \li style()
\endlist
If you have a font which matches on family, even if none of the
@@ -861,35 +861,35 @@ int QFont::pointSize() const
\table
\header
- \o
- \o PreferDefaultHinting
- \o PreferNoHinting
- \o PreferVerticalHinting
- \o PreferFullHinting
+ \li
+ \li PreferDefaultHinting
+ \li PreferNoHinting
+ \li PreferVerticalHinting
+ \li PreferFullHinting
\row
- \o Windows Vista (w/o Platform Update) and earlier
- \o Full hinting
- \o Full hinting
- \o Full hinting
- \o Full hinting
+ \li Windows Vista (w/o Platform Update) and earlier
+ \li Full hinting
+ \li Full hinting
+ \li Full hinting
+ \li Full hinting
\row
- \o Windows 7 and Windows Vista (w/Platform Update) and DirectWrite enabled in Qt
- \o Full hinting
- \o Vertical hinting
- \o Vertical hinting
- \o Full hinting
+ \li Windows 7 and Windows Vista (w/Platform Update) and DirectWrite enabled in Qt
+ \li Full hinting
+ \li Vertical hinting
+ \li Vertical hinting
+ \li Full hinting
\row
- \o FreeType
- \o Operating System setting
- \o No hinting
- \o Vertical hinting (light)
- \o Full hinting
+ \li FreeType
+ \li Operating System setting
+ \li No hinting
+ \li Vertical hinting (light)
+ \li Full hinting
\row
- \o Cocoa on Mac OS X
- \o No hinting
- \o No hinting
- \o No hinting
- \o No hinting
+ \li Cocoa on Mac OS X
+ \li No hinting
+ \li No hinting
+ \li No hinting
+ \li No hinting
\endtable
\note Please be aware that altering the hinting preference on Windows is available through
@@ -2277,7 +2277,7 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
There are three ways to create a QFontInfo object.
\list 1
- \o Calling the QFontInfo constructor with a QFont creates a font
+ \li Calling the QFontInfo constructor with a QFont creates a font
info object for a screen-compatible font, i.e. the font cannot be
a printer font. If the font is changed later, the font
info object is \e not updated.
@@ -2286,12 +2286,12 @@ QDataStream &operator>>(QDataStream &s, QFont &font)
inaccurate. Printer fonts are not always accessible so the nearest
screen font is used if a printer font is supplied.)
- \o QWidget::fontInfo() returns the font info for a widget's font.
+ \li QWidget::fontInfo() returns the font info for a widget's font.
This is equivalent to calling QFontInfo(widget->font()). If the
widget's font is changed later, the font info object is \e not
updated.
- \o QPainter::fontInfo() returns the font info for a painter's
+ \li QPainter::fontInfo() returns the font info for a painter's
current font. If the painter's font is changed later, the font
info object is \e not updated.
\endlist
@@ -2715,18 +2715,22 @@ QFontEngine *QFontCache::findEngine(const Key &key)
EngineCache::Iterator it = engineCache.find(key),
end = engineCache.end();
if (it == end) return 0;
-
// found... update the hitcount and timestamp
- it.value().hits++;
- it.value().timestamp = ++current_timestamp;
+ updateHitCountAndTimeStamp(it.value());
+
+ return it.value().data;
+}
+
+void QFontCache::updateHitCountAndTimeStamp(Engine &value)
+{
+ value.hits++;
+ value.timestamp = ++current_timestamp;
FC_DEBUG("QFontCache: found font engine\n"
" %p: timestamp %4u hits %3u ref %2d/%2d, type '%s'",
- it.value().data, it.value().timestamp, it.value().hits,
- it.value().data->ref.load(), it.value().data->cache_count,
- it.value().data->name());
-
- return it.value().data;
+ value.data, value.timestamp, value.hits,
+ value.data->ref.load(), value.data->cache_count,
+ value.data->name());
}
void QFontCache::removeEngine(QFontEngine *engine)
@@ -2743,14 +2747,17 @@ void QFontCache::removeEngine(QFontEngine *engine)
}
}
-void QFontCache::insertEngine(const Key &key, QFontEngine *engine)
+void QFontCache::insertEngine(const Key &key, QFontEngine *engine, bool insertMulti)
{
FC_DEBUG("QFontCache: inserting new engine %p", engine);
Engine data(engine);
data.timestamp = ++current_timestamp;
- engineCache.insert(key, data);
+ if (insertMulti)
+ engineCache.insertMulti(key, data);
+ else
+ engineCache.insert(key, data);
// only increase the cost if this is the first time we insert the engine
if (engine->cache_count == 0)
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index d10249201a..06cf787880 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -242,9 +242,10 @@ public:
EngineCache engineCache;
QFontEngine *findEngine(const Key &key);
- void insertEngine(const Key &key, QFontEngine *engine);
- void removeEngine(QFontEngine *engine);
+ void updateHitCountAndTimeStamp(Engine &value);
+ void insertEngine(const Key &key, QFontEngine *engine, bool insertMulti = false);
+ void removeEngine(QFontEngine *engine);
private:
void increaseCost(uint cost);
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 7fa486e1ee..468d029cf2 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -2244,7 +2244,7 @@ int QFontDatabase::addApplicationFont(const QString &fileName)
Currently only TrueType fonts and TrueType font collections are supported.
- \bold{Note:} Adding application fonts on Unix/X11 platforms without fontconfig is
+ \b{Note:} Adding application fonts on Unix/X11 platforms without fontconfig is
currently not supported.
\sa addApplicationFont(), applicationFontFamilies(), removeApplicationFont()
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index a084a3dd8c..142d627100 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -227,6 +227,15 @@ HB_Face QFontEngine::harfbuzzFace() const
return hbFace;
}
+HB_Face QFontEngine::initializedHarfbuzzFace() const
+{
+ HB_Face face = harfbuzzFace();
+ if (face != 0 && face->font_for_init != 0)
+ face = qHBLoadFace(face);
+
+ return face;
+}
+
glyph_metrics_t QFontEngine::boundingBox(glyph_t glyph, const QTransform &matrix)
{
glyph_metrics_t metrics = boundingBox(glyph);
@@ -1148,25 +1157,6 @@ QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &fami
return f;
}
-class QRgbGreyPalette: public QVector<QRgb>
-{
-public:
- QRgbGreyPalette()
- {
- resize(256);
- QRgb *it = data();
- for (int i = 0; i < size(); ++i, ++it)
- *it = 0xff000000 | i | (i<<8) | (i<<16);
- }
-};
-
-Q_GLOBAL_STATIC(QVector<QRgb>, qt_grayPalette)
-
-const QVector<QRgb> &QFontEngine::grayPalette()
-{
- return *qt_grayPalette();
-}
-
QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
{
if (glyphs.numGlyphs >= 1) {
@@ -1383,15 +1373,13 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
for (int x=1; x < engines.size(); ++x) {
- if (!shouldLoadFontEngineForCharacter(x, ucs4))
+ if (engines.at(x) == 0 && !shouldLoadFontEngineForCharacter(x, ucs4))
continue;
QFontEngine *engine = engines.at(x);
- bool deleteThisEngine = false;
if (!engine) {
const_cast<QFontEngineMulti *>(this)->loadEngine(x);
engine = engines.at(x);
- deleteThisEngine = true;
}
Q_ASSERT(engine != 0);
if (engine->type() == Box)
@@ -1407,8 +1395,6 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
// set the high byte to indicate which engine the glyph came from
glyphs->glyphs[glyph_pos] |= (x << 24);
break;
- } else if (deleteThisEngine) {
- const_cast<QFontEngineMulti *>(this)->unloadEngine(x);
}
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 14e2dba364..8880eb7cb3 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -877,7 +877,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
if (err != FT_Err_Ok)
qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph);
- if (!set || set->outline_drawing || fetchMetricsOnly)
+ if ((!set || set->outline_drawing) && fetchMetricsOnly)
return 0;
FT_GlyphSlot slot = face->glyph;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 023882d560..660e3be459 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -85,6 +85,7 @@ struct QGlyphLayout;
class Q_GUI_EXPORT QFontEngine : public QObject
{
+ Q_OBJECT
public:
enum Type {
Box,
@@ -234,6 +235,7 @@ public:
HB_Font harfbuzzFont() const;
HB_Face harfbuzzFace() const;
+ HB_Face initializedHarfbuzzFace() const;
virtual HB_Error getPointInOutline(HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints);
@@ -278,7 +280,6 @@ public:
int m_subPixelPositionCount; // Number of positions within a single pixel for this cache
protected:
- static const QVector<QRgb> &grayPalette();
QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
private:
@@ -344,6 +345,7 @@ private:
class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine
{
+ Q_OBJECT
public:
explicit QFontEngineMulti(int engineCount);
~QFontEngineMulti();
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index 33657367fa..48679824a4 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -46,8 +46,10 @@
#include <QtCore/QDir>
#include <QtCore/QBuffer>
-#include <QtGui/QPlatformFontDatabase>
#include <QtGui/private/qpaintengine_raster_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/QPlatformFontDatabase>
+#include <QtGui/QPlatformIntegration>
QT_BEGIN_NAMESPACE
@@ -662,6 +664,20 @@ void QPAGenerator::writeTaggedQFixed(QFontEngineQPA::HeaderTag tag, QFixed value
QFontEngineMultiQPA::QFontEngineMultiQPA(QFontEngine *fe, int _script, const QStringList &fallbacks)
: QFontEngineMulti(fallbacks.size() + 1),
fallbackFamilies(fallbacks), script(_script)
+ , fallbacksQueried(true)
+{
+ init(fe);
+}
+
+QFontEngineMultiQPA::QFontEngineMultiQPA(QFontEngine *fe, int _script)
+ : QFontEngineMulti(2)
+ , script(_script)
+ , fallbacksQueried(false)
+{
+ init(fe);
+}
+
+void QFontEngineMultiQPA::init(QFontEngine *fe)
{
Q_ASSERT(fe && fe->type() != QFontEngine::Multi);
engines[0] = fe;
@@ -672,18 +688,73 @@ QFontEngineMultiQPA::QFontEngineMultiQPA(QFontEngine *fe, int _script, const QSt
void QFontEngineMultiQPA::loadEngine(int at)
{
+ bool canLoadFallbackEngine = true;
+ if (!fallbacksQueried) {
+ // Original FontEngine to restore after the fill.
+ QFontEngine *fe = engines[0];
+ fallbackFamilies = QGuiApplicationPrivate::instance()->platformIntegration()->fontDatabase()->fallbacksForFamily(fe->fontDef.family, QFont::Style(fe->fontDef.style)
+ , QFont::AnyStyle, QUnicodeTables::Script(script));
+ if (fallbackFamilies.size() > 1) {
+ engines.fill(0, fallbackFamilies.size() + 1);
+ engines[0] = fe;
+ } else {
+ // Turns out we lied about having any fallback at all.
+ canLoadFallbackEngine = false;
+ engines[1] = fe;
+ }
+ fallbacksQueried = true;
+ }
Q_ASSERT(at < engines.size());
Q_ASSERT(engines.at(at) == 0);
-
QFontDef request = fontDef;
- request.styleStrategy |= QFont::NoFontMerging;
- request.family = fallbackFamilies.at(at-1);
- engines[at] = QFontDatabase::findFont(script,
- /*fontprivate*/0,
- request, false);
+ if (canLoadFallbackEngine) {
+ request.styleStrategy |= QFont::NoFontMerging;
+ request.family = fallbackFamilies.at(at-1);
+ engines[at] = QFontDatabase::findFont(script,
+ /*fontprivate = */0,
+ request, /*multi = */false);
+ }
Q_ASSERT(engines[at]);
engines[at]->ref.ref();
engines[at]->fontDef = request;
}
+/*
+ This is used indirectly by QtWebKit when using QTextLayout::setRawFont
+
+ The purpose of this is to provide the necessary font fallbacks when drawing complex
+ text. Since QtWebKit ends up repeatedly creating QTextLayout instances and passing them
+ the same raw font over and over again, we want to cache the corresponding multi font engine
+ as it may contain fallback font engines already.
+*/
+QFontEngine* QFontEngineMultiQPA::createMultiFontEngine(QFontEngine *fe, int script)
+{
+ QFontEngine *engine = 0;
+ QFontCache::Key key(fe->fontDef, script, /*multi = */true);
+ QFontCache *fc = QFontCache::instance();
+ // We can't rely on the fontDef (and hence the cache Key)
+ // alone to distinguish webfonts, since these should not be
+ // accidentally shared, even if the resulting fontcache key
+ // is strictly identical. See:
+ // http://www.w3.org/TR/css3-fonts/#font-face-rule
+ const bool faceIsLocal = !fe->faceId().filename.isEmpty();
+ QFontCache::EngineCache::Iterator it = fc->engineCache.find(key),
+ end = fc->engineCache.end();
+ while (it != end && it.key() == key) {
+ QFontEngineMulti *cachedEngine = qobject_cast<QFontEngineMulti *>(it.value().data);
+ if (faceIsLocal || (cachedEngine && fe == cachedEngine->engine(0))) {
+ engine = cachedEngine;
+ fc->updateHitCountAndTimeStamp(it.value());
+ break;
+ }
+ it++;
+ }
+ if (!engine) {
+ engine = new QFontEngineMultiQPA(fe, script);
+ QFontCache::instance()->insertEngine(key, engine, /* insertMulti */ !faceIsLocal);
+ }
+ Q_ASSERT(engine);
+ return engine;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontengine_qpa_p.h b/src/gui/text/qfontengine_qpa_p.h
index ed2e071ac2..16991ad2ca 100644
--- a/src/gui/text/qfontengine_qpa_p.h
+++ b/src/gui/text/qfontengine_qpa_p.h
@@ -249,13 +249,18 @@ public:
QFontEngineMultiQPA(QFontEngine *fe, int script, const QStringList &fallbacks);
void loadEngine(int at);
+ static QFontEngine* createMultiFontEngine(QFontEngine *fe, int script);
int fallbackFamilyCount() const { return fallbackFamilies.size(); }
QString fallbackFamilyAt(int at) const { return fallbackFamilies.at(at); }
private:
+ QFontEngineMultiQPA(QFontEngine *fe, int script);
+ void init(QFontEngine *fe);
+
QStringList fallbackFamilies;
int script;
+ bool fallbacksQueried;
};
QT_END_NAMESPACE
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index 283494e316..7209fbdfc3 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -76,7 +76,7 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
QFontMetrics object:
\list 1
- \o Calling the QFontMetrics constructor with a QFont creates a
+ \li Calling the QFontMetrics constructor with a QFont creates a
font metrics object for a screen-compatible font, i.e. the font
cannot be a printer font. If the font is changed
later, the font metrics object is \e not updated.
@@ -85,12 +85,12 @@ extern void qt_format_text(const QFont& font, const QRectF &_r,
inaccurate. Printer fonts are not always accessible so the nearest
screen font is used if a printer font is supplied.)
- \o QWidget::fontMetrics() returns the font metrics for a widget's
+ \li QWidget::fontMetrics() returns the font metrics for a widget's
font. This is equivalent to QFontMetrics(widget->font()). If the
widget's font is changed later, the font metrics object is \e not
updated.
- \o QPainter::fontMetrics() returns the font metrics for a
+ \li QPainter::fontMetrics() returns the font metrics for a
painter's current font. If the painter's font is changed later, the
font metrics object is \e not updated.
\endlist
@@ -713,20 +713,20 @@ QRect QFontMetrics::boundingRect(QChar ch) const
The \a flags argument is the bitwise OR of the following flags:
\list
- \o Qt::AlignLeft aligns to the left border, except for
+ \li Qt::AlignLeft aligns to the left border, except for
Arabic and Hebrew where it aligns to the right.
- \o Qt::AlignRight aligns to the right border, except for
+ \li Qt::AlignRight aligns to the right border, except for
Arabic and Hebrew where it aligns to the left.
- \o Qt::AlignJustify produces justified text.
- \o Qt::AlignHCenter aligns horizontally centered.
- \o Qt::AlignTop aligns to the top border.
- \o Qt::AlignBottom aligns to the bottom border.
- \o Qt::AlignVCenter aligns vertically centered
- \o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
- \o Qt::TextSingleLine ignores newline characters in the text.
- \o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
- \o Qt::TextWordWrap breaks the text to fit the rectangle.
+ \li Qt::AlignJustify produces justified text.
+ \li Qt::AlignHCenter aligns horizontally centered.
+ \li Qt::AlignTop aligns to the top border.
+ \li Qt::AlignBottom aligns to the bottom border.
+ \li Qt::AlignVCenter aligns vertically centered
+ \li Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
+ \li Qt::TextSingleLine ignores newline characters in the text.
+ \li Qt::TextExpandTabs expands tabs (see below)
+ \li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
+ \li Qt::TextWordWrap breaks the text to fit the rectangle.
\endlist
Qt::Horizontal alignment defaults to Qt::AlignLeft and vertical
@@ -780,10 +780,10 @@ QRect QFontMetrics::boundingRect(const QRect &rect, int flags, const QString &te
The \a flags argument is the bitwise OR of the following flags:
\list
- \o Qt::TextSingleLine ignores newline characters.
- \o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
- \o Qt::TextWordBreak breaks the text to fit the rectangle.
+ \li Qt::TextSingleLine ignores newline characters.
+ \li Qt::TextExpandTabs expands tabs (see below)
+ \li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
+ \li Qt::TextWordBreak breaks the text to fit the rectangle.
\endlist
If Qt::TextExpandTabs is set in \a flags, then: if \a tabArray is
@@ -1490,20 +1490,20 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
The \a flags argument is the bitwise OR of the following flags:
\list
- \o Qt::AlignLeft aligns to the left border, except for
+ \li Qt::AlignLeft aligns to the left border, except for
Arabic and Hebrew where it aligns to the right.
- \o Qt::AlignRight aligns to the right border, except for
+ \li Qt::AlignRight aligns to the right border, except for
Arabic and Hebrew where it aligns to the left.
- \o Qt::AlignJustify produces justified text.
- \o Qt::AlignHCenter aligns horizontally centered.
- \o Qt::AlignTop aligns to the top border.
- \o Qt::AlignBottom aligns to the bottom border.
- \o Qt::AlignVCenter aligns vertically centered
- \o Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
- \o Qt::TextSingleLine ignores newline characters in the text.
- \o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
- \o Qt::TextWordWrap breaks the text to fit the rectangle.
+ \li Qt::AlignJustify produces justified text.
+ \li Qt::AlignHCenter aligns horizontally centered.
+ \li Qt::AlignTop aligns to the top border.
+ \li Qt::AlignBottom aligns to the bottom border.
+ \li Qt::AlignVCenter aligns vertically centered
+ \li Qt::AlignCenter (== \c{Qt::AlignHCenter | Qt::AlignVCenter})
+ \li Qt::TextSingleLine ignores newline characters in the text.
+ \li Qt::TextExpandTabs expands tabs (see below)
+ \li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
+ \li Qt::TextWordWrap breaks the text to fit the rectangle.
\endlist
Qt::Horizontal alignment defaults to Qt::AlignLeft and vertical
@@ -1517,9 +1517,9 @@ QRectF QFontMetricsF::boundingRect(QChar ch) const
If Qt::TextExpandTabs is set in \a flags, the following behavior is
used to interpret tab characters in the text:
\list
- \o If \a tabArray is non-null, it specifies a 0-terminated sequence of
+ \li If \a tabArray is non-null, it specifies a 0-terminated sequence of
pixel-positions for tabs in the text.
- \o If \a tabStops is non-zero, it is used as the tab spacing (in pixels).
+ \li If \a tabStops is non-zero, it is used as the tab spacing (in pixels).
\endlist
Note that the bounding rectangle may extend to the left of (0, 0),
@@ -1559,10 +1559,10 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
The \a flags argument is the bitwise OR of the following flags:
\list
- \o Qt::TextSingleLine ignores newline characters.
- \o Qt::TextExpandTabs expands tabs (see below)
- \o Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
- \o Qt::TextWordBreak breaks the text to fit the rectangle.
+ \li Qt::TextSingleLine ignores newline characters.
+ \li Qt::TextExpandTabs expands tabs (see below)
+ \li Qt::TextShowMnemonic interprets "&x" as \underline{x}; i.e., underlined.
+ \li Qt::TextWordBreak breaks the text to fit the rectangle.
\endlist
These flags are defined in \l{Qt::TextFlags}.
@@ -1570,9 +1570,9 @@ QRectF QFontMetricsF::boundingRect(const QRectF &rect, int flags, const QString&
If Qt::TextExpandTabs is set in \a flags, the following behavior is
used to interpret tab characters in the text:
\list
- \o If \a tabArray is non-null, it specifies a 0-terminated sequence of
+ \li If \a tabArray is non-null, it specifies a 0-terminated sequence of
pixel-positions for tabs in the text.
- \o If \a tabStops is non-zero, it is used as the tab spacing (in pixels).
+ \li If \a tabStops is non-zero, it is used as the tab spacing (in pixels).
\endlist
Newline characters are processed as line breaks.
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 7ddc8975e4..e48460ffd0 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -61,7 +61,7 @@ class QRect;
class Q_GUI_EXPORT QFontMetrics
{
public:
- QFontMetrics(const QFont &);
+ explicit QFontMetrics(const QFont &);
QFontMetrics(const QFont &, QPaintDevice *pd);
QFontMetrics(const QFontMetrics &);
~QFontMetrics();
@@ -127,7 +127,7 @@ private:
class Q_GUI_EXPORT QFontMetricsF
{
public:
- QFontMetricsF(const QFont &);
+ explicit QFontMetricsF(const QFont &);
QFontMetricsF(const QFont &, QPaintDevice *pd);
QFontMetricsF(const QFontMetrics &);
QFontMetricsF(const QFontMetricsF &);
diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp
index 8fcf421330..47a9fe5ab1 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.cpp
+++ b/src/gui/text/qplatformfontdatabase_qpa.cpp
@@ -375,18 +375,6 @@ QFont QPlatformFontDatabase::defaultFont() const
}
/*!
- Returns fonts for class names.
-
- \sa QGuiApplication::font()
- \since 5.0
-*/
-
-QHash<QByteArray, QFont> QPlatformFontDatabase::defaultFonts() const
-{
- return QHash<QByteArray, QFont>();
-}
-
-/*!
Resolve alias to actual font family names.
\since 5.0
diff --git a/src/gui/text/qplatformfontdatabase_qpa.h b/src/gui/text/qplatformfontdatabase_qpa.h
index 6a58a3106c..5a5a8f321f 100644
--- a/src/gui/text/qplatformfontdatabase_qpa.h
+++ b/src/gui/text/qplatformfontdatabase_qpa.h
@@ -100,7 +100,7 @@ public:
virtual QString fontDir() const;
virtual QFont defaultFont() const;
- virtual QHash<QByteArray, QFont> defaultFonts() const;
+
virtual QString resolveFontFamilyAlias(const QString &family) const;
//callback
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 79793d5845..9fbeef4685 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -86,13 +86,13 @@ QT_BEGIN_NAMESPACE
QRawFont can be constructed in a number of ways:
\list
- \o It can be constructed by calling QTextLayout::glyphs() or QTextFragment::glyphs(). The
+ \li It can be constructed by calling QTextLayout::glyphs() or QTextFragment::glyphs(). The
returned QGlyphs objects will contain QRawFont objects which represent the actual fonts
used to render each portion of the text.
- \o It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
+ \li It can be constructed by passing a QFont object to QRawFont::fromFont(). The function
will return a QRawFont object representing the font that will be selected as response to
the QFont query and the selected writing system.
- \o It can be constructed by passing a file name or QByteArray directly to the QRawFont
+ \li It can be constructed by passing a file name or QByteArray directly to the QRawFont
constructor, or by calling loadFromFile() or loadFromData(). In this case, the
font will not be registered in QFontDatabase, and it will not be available as part of
regular font selection.
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 5cd996e705..bc5f6621c8 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -138,6 +138,7 @@ public:
private:
friend class QRawFontPrivate;
friend class QTextLayout;
+ friend class QTextEngine;
QExplicitlySharedDataPointer<QRawFontPrivate> d;
};
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index ddf2fb080e..02fd921fac 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -950,15 +950,15 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{
document with the cursor:
\list
- \i Lists are ordered sequences of block elements that are decorated with
+ \li Lists are ordered sequences of block elements that are decorated with
bullet points or symbols. These are inserted in a specified format
with insertList().
- \i Tables are inserted with the insertTable() function, and can be
+ \li Tables are inserted with the insertTable() function, and can be
given an optional format. These contain an array of cells that can
be traversed using the cursor.
- \i Inline images are inserted with insertImage(). The image to be
+ \li Inline images are inserted with insertImage(). The image to be
used can be specified in an image format, or by name.
- \i Frames are inserted by calling insertFrame() with a specified format.
+ \li Frames are inserted by calling insertFrame() with a specified format.
\endlist
Actions can be grouped (i.e. treated as a single action for
@@ -1621,7 +1621,7 @@ void QTextCursor::selectedTableCells(int *firstRow, int *numRows, int *firstColu
/*!
Clears the current selection by setting the anchor to the cursor position.
- Note that it does \bold{not} delete the text of the selection.
+ Note that it does \b{not} delete the text of the selection.
\sa removeSelectedText() hasSelection()
*/
@@ -2325,7 +2325,7 @@ void QTextCursor::insertImage(const QImage &image, const QString &name)
}
QString imageName = name;
if (name.isEmpty())
- imageName = QString::number(image.serialNumber());
+ imageName = QString::number(image.cacheKey());
d->priv->document()->addResource(QTextDocument::ImageResource, QUrl(imageName), image);
QTextImageFormat format;
format.setName(imageName);
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 1fad064b5c..a8991d5428 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -261,14 +261,14 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba)
system. The following are the undo/redo operations of a QTextDocument:
\list
- \o Insertion or removal of characters. A sequence of insertions or removals
+ \li Insertion or removal of characters. A sequence of insertions or removals
within the same text block are regarded as a single undo/redo operation.
- \o Insertion or removal of text blocks. Sequences of insertion or removals
+ \li Insertion or removal of text blocks. Sequences of insertion or removals
in a single operation (e.g., by selecting and then deleting text) are
regarded as a single undo/redo operation.
- \o Text character format changes.
- \o Text block format changes.
- \o Text block group format changes.
+ \li Text character format changes.
+ \li Text block format changes.
+ \li Text block group format changes.
\endlist
\sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example}
@@ -887,7 +887,7 @@ QChar QTextDocument::characterAt(int pos) const
The style sheet needs to be compliant to CSS 2.1 syntax.
- \bold{Note:} Changing the default style sheet does not have any effect to the existing content
+ \b{Note:} Changing the default style sheet does not have any effect to the existing content
of the document.
\sa {Supported HTML Subset}
@@ -1169,7 +1169,7 @@ void QTextDocument::setPlainText(const QString &text)
The HTML formatting is respected as much as possible; for example,
"<b>bold</b> text" will produce text where the first word has a font
- weight that gives it a bold appearance: "\bold{bold} text".
+ weight that gives it a bold appearance: "\b{bold} text".
\note It is the responsibility of the caller to make sure that the
text is correctly decoded when a QString containing HTML is created
diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp
index d43a61866d..b0bbeb7a47 100644
--- a/src/gui/text/qtextdocumentwriter.cpp
+++ b/src/gui/text/qtextdocumentwriter.cpp
@@ -345,10 +345,10 @@ QTextCodec *QTextDocumentWriter::codec() const
By default, Qt can write the following formats:
\table
- \header \o Format \o Description
- \row \o plaintext \o Plain text
- \row \o HTML \o HyperText Markup Language
- \row \o ODF \o OpenDocument Format
+ \header \li Format \li Description
+ \row \li plaintext \li Plain text
+ \row \li HTML \li HyperText Markup Language
+ \row \li ODF \li OpenDocument Format
\endtable
\sa setFormat()
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index c63f0fede8..dae02def07 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -53,13 +53,18 @@
#include "qstring.h"
#include <private/qunicodetables_p.h>
#include "qtextdocument_p.h"
+#include "qrawfont.h"
+#include "qrawfont_p.h"
#include <qguiapplication.h>
#include <qinputmethod.h>
#include <stdlib.h>
+#include "qfontengine_qpa_p.h"
QT_BEGIN_NAMESPACE
+static const float smallCapsFraction = 0.7;
+
namespace {
// Helper class used in QTextEngine::itemize
// keep it out here to allow us to keep supporting various compilers.
@@ -900,13 +905,25 @@ void QTextEngine::shapeText(int item) const
return;
QGlyphLayout glyphs = shapedGlyphs(&si);
- QFont font = this->font(si);
- bool letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute;
- QFixed letterSpacing = font.d->letterSpacing;
- QFixed wordSpacing = font.d->wordSpacing;
+ bool letterSpacingIsAbsolute;
+ QFixed letterSpacing, wordSpacing;
+#ifndef QT_NO_RAWFONT
+ if (useRawFont) {
+ QTextCharFormat f = format(&si);
+ wordSpacing = QFixed::fromReal(f.fontWordSpacing());
+ letterSpacing = QFixed::fromReal(f.fontLetterSpacing());
+ letterSpacingIsAbsolute = true;
+ } else
+#endif
+ {
+ QFont font = this->font(si);
+ letterSpacingIsAbsolute = font.d->letterSpacingIsAbsolute;
+ letterSpacing = font.d->letterSpacing;
+ wordSpacing = font.d->wordSpacing;
- if (letterSpacingIsAbsolute && letterSpacing.value())
- letterSpacing *= font.d->dpi / qt_defaultDpiY();
+ if (letterSpacingIsAbsolute && letterSpacing.value())
+ letterSpacing *= font.d->dpi / qt_defaultDpiY();
+ }
if (letterSpacing != 0) {
for (int i = 1; i < si.num_glyphs; ++i) {
@@ -973,7 +990,14 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
QFontEngine *font = fontEngine(si, &si.ascent, &si.descent, &si.leading);
- bool kerningEnabled = this->font(si).d->kerning;
+ bool kerningEnabled;
+#ifndef QT_NO_RAWFONT
+ if (useRawFont) {
+ QTextCharFormat f = format(&si);
+ kerningEnabled = f.fontKerning();
+ } else
+#endif
+ kerningEnabled = this->font(si).d->kerning;
HB_ShaperItem entire_shaper_item;
qMemSet(&entire_shaper_item, 0, sizeof(entire_shaper_item));
@@ -1088,7 +1112,7 @@ void QTextEngine::shapeTextWithHarfbuzz(int item) const
si.leading = qMax(actualFontEngine->leading(), si.leading);
shaper_item.font = actualFontEngine->harfbuzzFont();
- shaper_item.face = actualFontEngine->harfbuzzFace();
+ shaper_item.face = actualFontEngine->initializedHarfbuzzFace();
shaper_item.glyphIndicesPresent = true;
@@ -1159,6 +1183,9 @@ static void init(QTextEngine *e)
e->underlinePositions = 0;
e->specialData = 0;
e->stackEngine = false;
+#ifndef QT_NO_RAWFONT
+ e->useRawFont = false;
+#endif
}
QTextEngine::QTextEngine()
@@ -1401,7 +1428,21 @@ void QTextEngine::itemize() const
++it;
}
} else {
- itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital));
+#ifndef QT_NO_RAWFONT
+ if (useRawFont && specialData) {
+ int lastIndex = 0;
+ for (int i = 0; i < specialData->addFormats.size(); ++i) {
+ const QTextLayout::FormatRange &range = specialData->addFormats.at(i);
+ if (range.format.fontCapitalization()) {
+ itemizer.generate(lastIndex, range.start - lastIndex, QFont::MixedCase);
+ itemizer.generate(range.start, range.length, range.format.fontCapitalization());
+ lastIndex = range.start + range.length;
+ }
+ }
+ itemizer.generate(lastIndex, length - lastIndex, QFont::MixedCase);
+ } else
+#endif
+ itemizer.generate(0, length, static_cast<QFont::Capitalization> (fnt.d->capital));
}
addRequiredBoundaries();
@@ -1663,59 +1704,85 @@ QFontEngine *QTextEngine::fontEngine(const QScriptItem &si, QFixed *ascent, QFix
int script = si.analysis.script;
QFont font = fnt;
- if (hasFormats()) {
- if (feCache.prevFontEngine && feCache.prevPosition == si.position && feCache.prevLength == length(&si) && feCache.prevScript == script) {
+#ifndef QT_NO_RAWFONT
+ if (useRawFont && rawFont.isValid()) {
+ if (feCache.prevFontEngine && feCache.prevFontEngine->type() == QFontEngine::Multi && feCache.prevScript == script) {
engine = feCache.prevFontEngine;
- scaledEngine = feCache.prevScaledFontEngine;
} else {
- QTextCharFormat f = format(&si);
- font = f.font();
-
- if (block.docHandle() && block.docHandle()->layout()) {
- // Make sure we get the right dpi on printers
- QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
- if (pdev)
- font = QFont(font, pdev);
- } else {
- font = font.resolve(fnt);
- }
- engine = font.d->engineForScript(script);
- QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
- if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
- if (font.pointSize() != -1)
- font.setPointSize((font.pointSize() * 2) / 3);
- else
- font.setPixelSize((font.pixelSize() * 2) / 3);
- scaledEngine = font.d->engineForScript(script);
- }
+ engine = QFontEngineMultiQPA::createMultiFontEngine(rawFont.d->fontEngine, script);
feCache.prevFontEngine = engine;
- if (engine)
- engine->ref.ref();
- feCache.prevScaledFontEngine = scaledEngine;
- if (scaledEngine)
- scaledEngine->ref.ref();
feCache.prevScript = script;
- feCache.prevPosition = si.position;
- feCache.prevLength = length(&si);
+ engine->ref.ref();
+ if (feCache.prevScaledFontEngine)
+ releaseCachedFontEngine(feCache.prevScaledFontEngine);
}
- } else {
- if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1)
- engine = feCache.prevFontEngine;
- else {
- engine = font.d->engineForScript(script);
- feCache.prevFontEngine = engine;
- if (engine)
- engine->ref.ref();
- feCache.prevScript = script;
- feCache.prevPosition = -1;
- feCache.prevLength = -1;
- feCache.prevScaledFontEngine = 0;
+ if (si.analysis.flags & QFont::SmallCaps) {
+ if (feCache.prevScaledFontEngine) {
+ scaledEngine = feCache.prevScaledFontEngine;
+ } else {
+ QFontEngine *scEngine = rawFont.d->fontEngine->cloneWithSize(smallCapsFraction * rawFont.pixelSize());
+ scaledEngine = QFontEngineMultiQPA::createMultiFontEngine(scEngine, script);
+ scaledEngine->ref.ref();
+ feCache.prevScaledFontEngine = scaledEngine;
+ }
+ }
+ } else
+#endif
+ {
+ if (hasFormats()) {
+ if (feCache.prevFontEngine && feCache.prevPosition == si.position && feCache.prevLength == length(&si) && feCache.prevScript == script) {
+ engine = feCache.prevFontEngine;
+ scaledEngine = feCache.prevScaledFontEngine;
+ } else {
+ QTextCharFormat f = format(&si);
+ font = f.font();
+
+ if (block.docHandle() && block.docHandle()->layout()) {
+ // Make sure we get the right dpi on printers
+ QPaintDevice *pdev = block.docHandle()->layout()->paintDevice();
+ if (pdev)
+ font = QFont(font, pdev);
+ } else {
+ font = font.resolve(fnt);
+ }
+ engine = font.d->engineForScript(script);
+ QTextCharFormat::VerticalAlignment valign = f.verticalAlignment();
+ if (valign == QTextCharFormat::AlignSuperScript || valign == QTextCharFormat::AlignSubScript) {
+ if (font.pointSize() != -1)
+ font.setPointSize((font.pointSize() * 2) / 3);
+ else
+ font.setPixelSize((font.pixelSize() * 2) / 3);
+ scaledEngine = font.d->engineForScript(script);
+ }
+ feCache.prevFontEngine = engine;
+ if (engine)
+ engine->ref.ref();
+ feCache.prevScaledFontEngine = scaledEngine;
+ if (scaledEngine)
+ scaledEngine->ref.ref();
+ feCache.prevScript = script;
+ feCache.prevPosition = si.position;
+ feCache.prevLength = length(&si);
+ }
+ } else {
+ if (feCache.prevFontEngine && feCache.prevScript == script && feCache.prevPosition == -1)
+ engine = feCache.prevFontEngine;
+ else {
+ engine = font.d->engineForScript(script);
+ feCache.prevFontEngine = engine;
+ if (engine)
+ engine->ref.ref();
+ feCache.prevScript = script;
+ feCache.prevPosition = -1;
+ feCache.prevLength = -1;
+ feCache.prevScaledFontEngine = 0;
+ }
}
- }
- if (si.analysis.flags == QScriptAnalysis::SmallCaps) {
- QFontPrivate *p = font.d->smallCapsFontPrivate();
- scaledEngine = p->engineForScript(script);
+ if (si.analysis.flags == QScriptAnalysis::SmallCaps) {
+ QFontPrivate *p = font.d->smallCapsFontPrivate();
+ scaledEngine = p->engineForScript(script);
+ }
}
if (ascent) {
diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h
index b29f626b68..6f1fd713f1 100644
--- a/src/gui/text/qtextengine_p.h
+++ b/src/gui/text/qtextengine_p.h
@@ -581,7 +581,10 @@ public:
mutable FontEngineCache feCache;
QString text;
- QFont fnt;
+ mutable QFont fnt;
+#ifndef QT_NO_RAWFONT
+ QRawFont rawFont;
+#endif
QTextBlock block;
QTextOption option;
@@ -594,6 +597,9 @@ public:
uint stackEngine : 1;
uint forceJustification : 1;
uint visualMovement : 1;
+#ifndef QT_NO_RAWFONT
+ uint useRawFont : 1;
+#endif
int *underlinePositions;
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 943caea644..d5b05a8957 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -361,6 +361,22 @@ QTextLayout::~QTextLayout()
delete d;
}
+#ifndef QT_NO_RAWFONT
+/*!
+ \internal
+ Sets a raw font, to be used with QTextLayout::glyphRuns.
+ Note that this only supports the needs of WebKit.
+ Use of this function with e.g. QTextLayout::draw will result
+ in undefined behaviour.
+*/
+void QTextLayout::setRawFont(const QRawFont &rawFont)
+{
+ d->rawFont = rawFont;
+ d->useRawFont = true;
+ d->resetFontEngineCache();
+}
+#endif
+
/*!
Sets the layout's font to the given \a font. The layout is
invalidated and must be laid out again.
@@ -370,6 +386,9 @@ QTextLayout::~QTextLayout()
void QTextLayout::setFont(const QFont &font)
{
d->fnt = font;
+#ifndef QT_NO_RAWFONT
+ d->useRawFont = false;
+#endif
d->resetFontEngineCache();
}
@@ -2204,15 +2223,17 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
continue;
}
- QFont font = eng->font(si);
-
+ QFont font;
QGlyphRun::GlyphRunFlags flags;
- if (font.overline())
- flags |= QGlyphRun::Overline;
- if (font.underline())
- flags |= QGlyphRun::Underline;
- if (font.strikeOut())
- flags |= QGlyphRun::StrikeOut;
+ if (!eng->useRawFont) {
+ font = eng->font(si);
+ if (font.overline())
+ flags |= QGlyphRun::Overline;
+ if (font.underline())
+ flags |= QGlyphRun::Underline;
+ if (font.strikeOut())
+ flags |= QGlyphRun::StrikeOut;
+ }
bool rtl = false;
if (si.analysis.bidiLevel % 2) {
@@ -2264,7 +2285,8 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
iterator.getSelectionBounds(&x, &width);
if (glyphLayout.numGlyphs > 0) {
- QFontEngine *mainFontEngine = font.d->engineForScript(si.analysis.script);
+ QFontEngine *mainFontEngine = eng->fontEngine(si);
+
if (mainFontEngine->type() == QFontEngine::Multi) {
QFontEngineMulti *multiFontEngine = static_cast<QFontEngineMulti *>(mainFontEngine);
int end = rtl ? glyphLayout.numGlyphs : 0;
@@ -2331,6 +2353,10 @@ QList<QGlyphRun> QTextLine::glyphRuns(int from, int length) const
*/
void QTextLine::draw(QPainter *p, const QPointF &pos, const QTextLayout::FormatRange *selection) const
{
+#ifndef QT_NO_RAWFONT
+ // Not intended to work with rawfont
+ Q_ASSERT(!eng->useRawFont);
+#endif
const QScriptLine &line = eng->lines[index];
QPen pen = p->pen();
diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h
index a3bc79dc52..2c38973371 100644
--- a/src/gui/text/qtextlayout.h
+++ b/src/gui/text/qtextlayout.h
@@ -59,6 +59,9 @@ QT_BEGIN_NAMESPACE
class QTextEngine;
class QFont;
+#ifndef QT_NO_RAWFONT
+class QRawFont;
+#endif
class QRect;
class QRegion;
class QTextFormat;
@@ -114,6 +117,10 @@ public:
void setFont(const QFont &f);
QFont font() const;
+#ifndef QT_NO_RAWFONT
+ void setRawFont(const QRawFont &rawFont);
+#endif
+
void setText(const QString& string);
QString text() const;
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 5a642e90ef..c3c71bc021 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -107,7 +107,7 @@ public:
Returns true if the list has no items; otherwise returns false.
- \bold{Note:} Empty lists are automatically deleted by the QTextDocument that owns
+ \b{Note:} Empty lists are automatically deleted by the QTextDocument that owns
them.
\sa count()
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index 12af933fd0..65bc8fde1e 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -541,22 +541,22 @@ void QTextTablePrivate::update() const
\table 80%
\row
- \o \inlineimage texttable-split.png Original Table
- \o Suppose we have a 2x3 table of names and addresses. To merge both
+ \li \inlineimage texttable-split.png Original Table
+ \li Suppose we have a 2x3 table of names and addresses. To merge both
columns in the first row we invoke mergeCells() with \a row = 0,
\a column = 0, \a numRows = 1 and \a numColumns = 2.
\snippet doc/src/snippets/textdocument-texttable/main.cpp 0
\row
- \o \inlineimage texttable-merge.png
- \o This gives us the following table. To split the first row of the table
+ \li \inlineimage texttable-merge.png
+ \li This gives us the following table. To split the first row of the table
back into two cells, we invoke the splitCell() function with \a numRows
and \a numCols = 1.
\snippet doc/src/snippets/textdocument-texttable/main.cpp 1
\row
- \o \inlineimage texttable-split.png Split Table
- \o This results in the original table.
+ \li \inlineimage texttable-split.png Split Table
+ \li This results in the original table.
\endtable
\sa QTextTableFormat
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index 02552f5a53..ce16785d1d 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -82,18 +82,18 @@ QT_BEGIN_NAMESPACE
\list
- \i For a line edit that accepts integers from 10 to 1000 inclusive,
+ \li For a line edit that accepts integers from 10 to 1000 inclusive,
42 and 123 are \l Acceptable, the empty string and 5 are \l
Intermediate, and "asdf" and 1114 is \l Invalid.
- \i For an editable combobox that accepts URLs, any well-formed URL
+ \li For an editable combobox that accepts URLs, any well-formed URL
is \l Acceptable, "http://example.com/," is \l Intermediate
(it might be a cut and paste action that accidentally took in a
comma at the end), the empty string is \l Intermediate (the user
might select and delete all of the text in preparation for entering
a new URL) and "http:///./" is \l Invalid.
- \i For a spin box that accepts lengths, "11cm" and "1in" are \l
+ \li For a spin box that accepts lengths, "11cm" and "1in" are \l
Acceptable, "11" and the empty string are \l Intermediate, and
"http://example.com" and "hour" are \l Invalid.
@@ -801,13 +801,13 @@ QDoubleValidator::Notation QDoubleValidator::notation() const
When QRegExpValidator determines whether a string is \l Acceptable
or not, the regexp is treated as if it begins with the start of string
- assertion (\bold{^}) and ends with the end of string assertion
- (\bold{$}); the match is against the entire input string, or from
+ assertion (\b{^}) and ends with the end of string assertion
+ (\b{$}); the match is against the entire input string, or from
the given position if a start position greater than zero is given.
If a string is a prefix of an \l Acceptable string, it is considered
\l Intermediate. For example, "" and "A" are \l Intermediate for the
- regexp \bold{[A-Z][0-9]} (whereas "_" would be \l Invalid).
+ regexp \b{[A-Z][0-9]} (whereas "_" would be \l Invalid).
For a brief introduction to Qt's regexp engine, see \l QRegExp.
@@ -837,7 +837,7 @@ QRegExpValidator::QRegExpValidator(QObject *parent)
accepts all strings that match the regular expression \a rx.
The match is made against the entire string; e.g. if the regexp is
- \bold{[A-Fa-f0-9]+} it will be treated as \bold{^[A-Fa-f0-9]+$}.
+ \b{[A-Fa-f0-9]+} it will be treated as \b{^[A-Fa-f0-9]+$}.
*/
QRegExpValidator::QRegExpValidator(const QRegExp& rx, QObject *parent)
@@ -862,7 +862,7 @@ QRegExpValidator::~QRegExpValidator()
The \a pos parameter is set to the length of the \a input parameter.
- For example, if the regular expression is \bold{\\w\\d\\d}
+ For example, if the regular expression is \b{\\w\\d\\d}
(word-character, digit, digit) then "A57" is \l Acceptable,
"E5" is \l Intermediate, and "+9" is \l Invalid.