summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp14
-rw-r--r--src/gui/accessible/qaccessible.h12
-rw-r--r--src/gui/accessible/qaccessiblebridge.cpp2
-rw-r--r--src/gui/doc/images/qpainter-text-bounds.pngbin0 -> 1501 bytes
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp20
-rw-r--r--src/gui/doc/src/richtext.qdoc2
-rw-r--r--src/gui/image/qicon.cpp3
-rw-r--r--src/gui/image/qiconloader_p.h1
-rw-r--r--src/gui/image/qimage_p.h4
-rw-r--r--src/gui/image/qjpeghandler.cpp2
-rw-r--r--src/gui/image/qpaintengine_pic.cpp2
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp6
-rw-r--r--src/gui/kernel/qclipboard.cpp18
-rw-r--r--src/gui/kernel/qdrag.cpp4
-rw-r--r--src/gui/kernel/qevent.cpp14
-rw-r--r--src/gui/kernel/qguiapplication.cpp2
-rw-r--r--src/gui/kernel/qkeysequence.cpp16
-rw-r--r--src/gui/kernel/qpalette.cpp2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp6
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h1
-rw-r--r--src/gui/kernel/qwindow.cpp2
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp12
-rw-r--r--src/gui/painting/qblendfunctions.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp10
-rw-r--r--src/gui/painting/qdrawhelper_p.h17
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp16
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h38
-rw-r--r--src/gui/painting/qpaintengine.cpp6
-rw-r--r--src/gui/painting/qpainter.cpp45
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfont_p.h4
-rw-r--r--src/gui/text/qfontdatabase.cpp29
-rw-r--r--src/gui/text/qfontengine.cpp10
-rw-r--r--src/gui/text/qfontmetrics.cpp2
-rw-r--r--src/gui/text/qfontmetrics.h4
-rw-r--r--src/gui/text/qrawfont.cpp2
-rw-r--r--src/gui/text/qtextformat.cpp2
-rw-r--r--src/gui/text/qzip.cpp201
41 files changed, 346 insertions, 199 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index 0edccd32a7..dc6933f9ff 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -85,7 +85,7 @@ QT_BEGIN_NAMESPACE
to replace or extend the default behavior of the static functions
in QAccessible.
- Qt supports Microsoft Active Accessibility (MSAA), Mac OS X
+ Qt supports Microsoft Active Accessibility (MSAA), OS X
Accessibility, and the Unix/X11 AT-SPI standard. Other backends
can be supported using QAccessibleBridge.
@@ -2833,7 +2833,7 @@ const QString &QAccessibleActionInterface::toggleAction()
Returns the name of the scroll left default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::scrollLeftAction()
+QString QAccessibleActionInterface::scrollLeftAction()
{
return accessibleActionStrings()->scrollLeftAction;
}
@@ -2842,7 +2842,7 @@ const QString &QAccessibleActionInterface::scrollLeftAction()
Returns the name of the scroll right default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::scrollRightAction()
+QString QAccessibleActionInterface::scrollRightAction()
{
return accessibleActionStrings()->scrollRightAction;
}
@@ -2851,7 +2851,7 @@ const QString &QAccessibleActionInterface::scrollRightAction()
Returns the name of the scroll up default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::scrollUpAction()
+QString QAccessibleActionInterface::scrollUpAction()
{
return accessibleActionStrings()->scrollUpAction;
}
@@ -2860,7 +2860,7 @@ const QString &QAccessibleActionInterface::scrollUpAction()
Returns the name of the scroll down default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::scrollDownAction()
+QString QAccessibleActionInterface::scrollDownAction()
{
return accessibleActionStrings()->scrollDownAction;
}
@@ -2869,7 +2869,7 @@ const QString &QAccessibleActionInterface::scrollDownAction()
Returns the name of the previous page default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::previousPageAction()
+QString QAccessibleActionInterface::previousPageAction()
{
return accessibleActionStrings()->previousPageAction;
}
@@ -2878,7 +2878,7 @@ const QString &QAccessibleActionInterface::previousPageAction()
Returns the name of the next page default action.
\sa actionNames(), localizedActionName()
*/
-const QString &QAccessibleActionInterface::nextPageAction()
+QString QAccessibleActionInterface::nextPageAction()
{
return accessibleActionStrings()->nextPageAction;
}
diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h
index a0281d1c11..a40d7209c3 100644
--- a/src/gui/accessible/qaccessible.h
+++ b/src/gui/accessible/qaccessible.h
@@ -635,12 +635,12 @@ public:
static const QString &showMenuAction();
static const QString &setFocusAction();
static const QString &toggleAction();
- static const QString &scrollLeftAction();
- static const QString &scrollRightAction();
- static const QString &scrollUpAction();
- static const QString &scrollDownAction();
- static const QString &nextPageAction();
- static const QString &previousPageAction();
+ static QString scrollLeftAction();
+ static QString scrollRightAction();
+ static QString scrollUpAction();
+ static QString scrollDownAction();
+ static QString nextPageAction();
+ static QString previousPageAction();
};
class Q_GUI_EXPORT QAccessibleImageInterface
diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp
index b4f28a6968..ddee4b0676 100644
--- a/src/gui/accessible/qaccessiblebridge.cpp
+++ b/src/gui/accessible/qaccessiblebridge.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\ingroup accessibility
\inmodule QtWidgets
- Qt supports Microsoft Active Accessibility (MSAA), Mac OS X
+ Qt supports Microsoft Active Accessibility (MSAA), OS X
Accessibility, and the Unix/X11 AT-SPI standard. By subclassing
QAccessibleBridge, you can support other backends than the
predefined ones.
diff --git a/src/gui/doc/images/qpainter-text-bounds.png b/src/gui/doc/images/qpainter-text-bounds.png
new file mode 100644
index 0000000000..f92b8502f4
--- /dev/null
+++ b/src/gui/doc/images/qpainter-text-bounds.png
Binary files differ
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
index 1367ab2f8c..6d0308b1e9 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
@@ -257,3 +257,23 @@ glDisable(GL_SCISSOR_TEST);
painter.endNativePainting();
//! [21]
+
+//! [drawText]
+QPainter painter(this);
+QFont font = painter.font();
+font.setPixelSize(48);
+painter.setFont(font);
+
+const QRect rectangle = QRect(0, 0, 100, 50);
+QRect boundingRect;
+painter.drawText(rectangle, 0, tr("Hello"), &boundingRect);
+
+QPen pen = painter.pen();
+pen.setStyle(Qt::DotLine);
+painter.setPen(pen);
+painter.drawRect(boundingRect.adjusted(0, 0, -pen.width(), -pen.width()));
+
+pen.setStyle(Qt::DashLine);
+painter.setPen(pen);
+painter.drawRect(rectangle.adjusted(0, 0, -pen.width(), -pen.width()));
+//! [drawText]
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc
index 770ff985af..58f7890f8b 100644
--- a/src/gui/doc/src/richtext.qdoc
+++ b/src/gui/doc/src/richtext.qdoc
@@ -874,7 +874,7 @@
The following table lists the HTML tags supported by Qt's
\l{Rich Text Processing}{rich text} engine:
- \table
+ \table 70%
\header \li Tag
\li Description
\li Comment
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index cca8052424..f115707500 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -1170,7 +1170,8 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback)
icon = *qtIconCache()->object(name);
} else {
QPlatformTheme * const platformTheme = QGuiApplicationPrivate::platformTheme();
- QIconEngine * const engine = platformTheme ? platformTheme->createIconEngine(name)
+ bool hasUserTheme = QIconLoader::instance()->hasUserTheme();
+ QIconEngine * const engine = (platformTheme && !hasUserTheme) ? platformTheme->createIconEngine(name)
: new QIconLoaderEngine(name);
QIcon *cachedIcon = new QIcon(engine);
icon = *cachedIcon;
diff --git a/src/gui/image/qiconloader_p.h b/src/gui/image/qiconloader_p.h
index 38cf9c1736..5b0362e218 100644
--- a/src/gui/image/qiconloader_p.h
+++ b/src/gui/image/qiconloader_p.h
@@ -173,6 +173,7 @@ public:
void updateSystemTheme();
void invalidateKey() { m_themeKey++; }
void ensureInitialized();
+ bool hasUserTheme() const { return !m_userTheme.isEmpty(); }
private:
QThemeIconInfo findIconHelper(const QString &themeName,
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 7eb571900a..feeab60abd 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -116,7 +116,7 @@ void qInitImageConversions();
const uchar *qt_get_bitflip_array();
Q_GUI_EXPORT void qGamma_correct_back_to_linear_cs(QImage *image);
-#if defined(Q_OS_WINRT) && defined(_M_ARM) // QTBUG-42038
+#if defined(_M_ARM) // QTBUG-42038
#pragma optimize("", off)
#endif
inline int qt_depthForFormat(QImage::Format format)
@@ -163,7 +163,7 @@ inline int qt_depthForFormat(QImage::Format format)
}
return depth;
}
-#if defined(Q_OS_WINRT) && defined(_M_ARM)
+#if defined(_M_ARM)
#pragma optimize("", on)
#endif
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 4ff3917fe6..c0fda647aa 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -929,8 +929,6 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
if (!exifData.isEmpty()) {
// Exif data present
int exifOrientation = getExifOrientation(exifData);
- if (exifOrientation == -1)
- return false;
if (exifOrientation > 0)
transformation = exif2Qt(exifOrientation);
}
diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp
index be2b216509..47480ebbae 100644
--- a/src/gui/image/qpaintengine_pic.cpp
+++ b/src/gui/image/qpaintengine_pic.cpp
@@ -342,7 +342,7 @@ void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr)
}
br = painter()->transform().mapRect(br);
if (painter()->hasClipping()) {
- QRect cr = painter()->clipRegion().boundingRect();
+ QRectF cr = painter()->clipBoundingRect();
br &= cr;
}
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 7ba91475f2..c5006d88ed 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -1865,9 +1865,11 @@ bool QStandardItem::operator<(const QStandardItem &other) const
const int role = model() ? model()->sortRole() : Qt::DisplayRole;
const QVariant l = data(role), r = other.data(role);
// this code is copied from QSortFilterProxyModel::lessThan()
+ if (l.userType() == QVariant::Invalid)
+ return false;
+ if (r.userType() == QVariant::Invalid)
+ return true;
switch (l.userType()) {
- case QVariant::Invalid:
- return (r.type() == QVariant::Invalid);
case QVariant::Int:
return l.toInt() < r.toInt();
case QVariant::UInt:
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 402f5005fd..922c7fb8d9 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -110,22 +110,22 @@ QT_BEGIN_NAMESPACE
\endlist
- \section1 Notes for Mac OS X Users
+ \section1 Notes for OS X Users
- Mac OS X supports a separate find buffer that holds the current
+ OS X supports a separate find buffer that holds the current
search string in Find operations. This find clipboard can be accessed
by specifying the FindBuffer mode.
- \section1 Notes for Windows and Mac OS X Users
+ \section1 Notes for Windows and OS X Users
\list
- \li Windows and Mac OS X do not support the global mouse
+ \li Windows and 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.
- \li Windows and Mac OS X does not have the concept of ownership;
+ \li Windows and OS X does not have the concept of ownership;
the clipboard is a fully global resource so all applications are
notified of changes.
@@ -181,7 +181,7 @@ QClipboard::~QClipboard()
This signal is emitted when the clipboard data is changed.
- On Mac OS X and with Qt version 4.3 or higher, clipboard
+ On OS X and with Qt version 4.3 or higher, clipboard
changes made by other applications will only be detected
when the application is activated.
@@ -193,7 +193,7 @@ QClipboard::~QClipboard()
This signal is emitted when the selection is changed. This only
applies to windowing systems that support selections, e.g. X11.
- Windows and Mac OS X don't support selections.
+ Windows and OS X don't support selections.
\sa dataChanged(), findBufferChanged(), changed()
*/
@@ -203,7 +203,7 @@ QClipboard::~QClipboard()
\since 4.2
This signal is emitted when the find buffer is changed. This only
- applies to Mac OS X.
+ applies to OS X.
With Qt version 4.3 or higher, clipboard changes made by other
applications will only be detected when the application is activated.
@@ -226,7 +226,7 @@ QClipboard::~QClipboard()
systems with a global mouse selection (e.g. X11).
\value FindBuffer indicates that data should be stored and retrieved from
- the Find buffer. This mode is used for holding search strings on Mac OS X.
+ the Find buffer. This mode is used for holding search strings on OS X.
\omitvalue LastMode
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index 723b83d338..2736fac8e0 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -218,7 +218,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.
- \b{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and 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
@@ -240,7 +240,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.
- \b{Note:} On Linux and Mac OS X, the drag and drop operation
+ \b{Note:} On Linux and 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
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 1dc3e69470..adbaa5ff86 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -605,7 +605,7 @@ QHoverEvent::~QHoverEvent()
wheel event delta: angleDelta() returns the delta in wheel
degrees. This value is always provided. pixelDelta() returns
the delta in screen pixels and is available on platforms that
- have high-resolution trackpads, such as Mac OS X. If that is the
+ have high-resolution trackpads, such as OS X. If that is the
case, source() will return Qt::MouseEventSynthesizedBySystem.
The functions pos() and globalPos() return the mouse cursor's
@@ -825,7 +825,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Returns the scrolling distance in pixels on screen. This value is
provided on platforms that support high-resolution pixel-based
- delta values, such as Mac OS X. The value should be used directly
+ delta values, such as OS X. The value should be used directly
to scroll content on screen.
Example:
@@ -966,7 +966,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
Returns the scrolling phase of this wheel event.
\note The Qt::ScrollBegin and Qt::ScrollEnd phases are currently
- supported only on Mac OS X.
+ supported only on OS X.
*/
@@ -1578,7 +1578,7 @@ QCloseEvent::~QCloseEvent()
\ingroup events
Icon drag events are sent to widgets when the main icon of a window
- has been dragged away. On Mac OS X, this happens when the proxy
+ has been dragged away. On OS X, this happens when the proxy
icon of a window is dragged off the title bar.
It is normal to begin using drag and drop in response to this
@@ -3357,12 +3357,12 @@ QShowEvent::~QShowEvent()
when the operating system requests that a file or URL should be opened.
This is a high-level event that can be caused by different user actions
depending on the user's desktop environment; for example, double
- clicking on an file icon in the Finder on Mac OS X.
+ clicking on an file icon in the Finder on OS X.
This event is only used to notify the application of a request.
It may be safely ignored.
- \note This class is currently supported for Mac OS X only.
+ \note This class is currently supported for OS X only.
*/
/*!
@@ -3428,7 +3428,7 @@ bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const
\internal
\class QToolBarChangeEvent
\brief The QToolBarChangeEvent class provides an event that is
- sent whenever a the toolbar button is clicked on Mac OS X.
+ sent whenever a the toolbar button is clicked on OS X.
\ingroup events
\inmodule QtGui
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index eb275f2c81..b56a9da255 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -975,7 +975,7 @@ QWindow *QGuiApplication::topLevelAt(const QPoint &pos)
\list
\li \c android
- \li \c cocoa is a platform plugin for Mac OS X.
+ \li \c cocoa is a platform plugin for OS X.
\li \c directfb
\li \c eglfs is a platform plugin for running Qt5 applications on top of
EGL and OpenGL ES 2.0 without an actual windowing system (like X11
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index ff1438e250..9dc06138a6 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -194,7 +194,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
QKeySequence objects can be cast to a QString to obtain a human-readable
translated version of the sequence. Similarly, the toString() function
- produces human-readable strings for use in menus. On Mac OS X, the
+ produces human-readable strings for use in menus. On OS X, the
appropriate symbols are used to describe keyboard shortcuts using special
keys on the Macintosh keyboard.
@@ -202,12 +202,12 @@ 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.
- \b{Note:} On Mac OS X, references to "Ctrl", Qt::CTRL, Qt::Control
+ \b{Note:} On OS X, references to "Ctrl", Qt::CTRL, Qt::Control
and Qt::ControlModifier correspond to the \uicontrol Command keys on the
Macintosh keyboard, and references to "Meta", Qt::META, Qt::Meta and
Qt::MetaModifier correspond to the \uicontrol Control keys. Developers on
- Mac OS X can use the same shortcut descriptions across all platforms,
- and their applications will automatically work as expected on Mac OS X.
+ OS X can use the same shortcut descriptions across all platforms,
+ and their applications will automatically work as expected on OS X.
\section1 Standard Shortcuts
@@ -216,12 +216,12 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
setting up actions in a typical application. The table below shows
some common key sequences that are often used for these standard
shortcuts by applications on four widely-used platforms. Note
- that on Mac OS X, the \uicontrol Ctrl value corresponds to the \uicontrol
+ that on OS X, the \uicontrol Ctrl value corresponds to the \uicontrol
Command keys on the Macintosh keyboard, and the \uicontrol Meta value
corresponds to the \uicontrol Control keys.
\table
- \header \li StandardKey \li Windows \li Mac OS X \li KDE \li GNOME
+ \header \li StandardKey \li Windows \li 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
@@ -1207,7 +1207,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
#if defined(Q_OS_MACX)
if (nativeText) {
- // On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
+ // On OS X the order (by default) is Meta, Alt, Shift, Control.
// If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
// is Ctrl, Alt, Shift, Meta. The macSymbolForQtKey does this swap
// for us, which means that we have to adjust our order here.
@@ -1490,7 +1490,7 @@ bool QKeySequence::isDetached() const
If the key sequence has no keys, an empty string is returned.
- On Mac OS X, the string returned resembles the sequence that is
+ On OS X, the string returned resembles the sequence that is
shown in the menu bar.
\sa fromString()
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index cf17e1b5aa..ae05245e2f 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -382,7 +382,7 @@ static void qt_palette_from_color(QPalette &pal, const QColor &button)
\warning Some styles do not use the palette for all drawing, for
instance, if they make use of native theme engines. This is the
- case for both the Windows XP, Windows Vista, and the Mac OS X
+ case for both the Windows XP, Windows Vista, and the OS X
styles.
\sa QApplication::setPalette(), QWidget::setPalette(), QColor
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 3d35c4dcba..2d0458f705 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -136,12 +136,6 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi
return QVariant();
}
-void QPlatformDialogHelper::execModalForWindow(QWindow *parent)
-{
- Q_UNUSED(parent);
- exec();
-}
-
// Font dialog
class QFontDialogOptionsPrivate : public QSharedData
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 6d3a367e60..8b2b9881b7 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -145,7 +145,6 @@ public:
virtual QVariant styleHint(StyleHint hint) const;
virtual void exec() = 0;
- virtual void execModalForWindow(QWindow *parent);
virtual bool show(Qt::WindowFlags windowFlags,
Qt::WindowModality windowModality,
QWindow *parent) = 0;
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index e697efe31c..81e00c8d95 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2100,6 +2100,8 @@ void QWindowPrivate::deliverUpdateRequest()
be handled by the base class. For example, the default implementation of
this function relies on QEvent::Timer events. Filtering them away would
therefore break the delivery of the update events.
+
+ \since 5.5
*/
void QWindow::requestUpdate()
{
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 2579f0e77f..2b8488ab0e 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -289,8 +289,12 @@ static int qt_gl_resolve_features()
if (extensions.match("GL_OES_texture_npot"))
features |= QOpenGLFunctions::NPOTTextures |
QOpenGLFunctions::NPOTTextureRepeat;
- if (ctx->format().majorVersion() >= 3 || extensions.match("GL_EXT_texture_rg"))
- features |= QOpenGLFunctions::TextureRGFormats;
+ if (ctx->format().majorVersion() >= 3 || extensions.match("GL_EXT_texture_rg")) {
+ // Mesa's GLES implementation (as of 10.6.0) is unable to handle this, even though it provides 3.0.
+ const char *renderer = reinterpret_cast<const char *>(ctx->functions()->glGetString(GL_RENDERER));
+ if (!(renderer && strstr(renderer, "Mesa")))
+ features |= QOpenGLFunctions::TextureRGFormats;
+ }
return features;
} else {
// OpenGL
@@ -3221,7 +3225,11 @@ bool QOpenGLES3Helper::init()
m_gl.setFileName(QStringLiteral("libGLESv2d"));
# endif
# else
+# ifdef Q_OS_ANDROID
m_gl.setFileName(QStringLiteral("GLESv2"));
+# else
+ m_gl.setFileNameAndVersion(QStringLiteral("GLESv2"), 2);
+# endif
# endif // Q_OS_WIN
return m_gl.load();
#else
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index b3710411c9..dbdd82e432 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -422,8 +422,8 @@ static void qt_blend_argb32pm_on_a2rgb30pm(uchar *destPixels, int dbpl,
const_alpha = (const_alpha * 255) >> 8;
for (int y=0; y<h; ++y) {
for (int x=0; x<w; ++x) {
- uint s = BYTE_MUL(src[x], const_alpha);
- dst[x] = qConvertArgb32ToA2rgb30<PixelOrder>(s) + BYTE_MUL_RGB30(dst[x], 255 - qAlpha(s));
+ uint s = src[x];
+ dst[x] = BYTE_MUL_RGB30(qConvertArgb32ToA2rgb30<PixelOrder>(s), const_alpha) + BYTE_MUL_RGB30(dst[x], 255 - qt_div_255(qAlpha(s) * const_alpha));
}
dst = (quint32 *)(((uchar *) dst) + dbpl);
src = (const quint32 *)(((const uchar *) src) + sbpl);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 7b03cc00ff..07e5a3d19b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -6291,6 +6291,10 @@ void qt_memfill32(quint32 *dest, quint32 color, int count)
}
#endif
+#ifdef QT_COMPILER_SUPPORTS_SSE4_1
+template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
+#endif
+
void qInitDrawhelperAsm()
{
const uint features = qCpuFeatures();
@@ -6352,7 +6356,7 @@ void qInitDrawhelperAsm()
}
#endif // SSSE3
-#if QT_COMPILER_SUPPORTS_SSE4_1
+#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
#if !defined(__SSE4_1__)
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
@@ -6366,10 +6370,12 @@ void qInitDrawhelperAsm()
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
+ qPixelLayouts[QImage::Format_A2BGR30_Premultiplied].convertFromARGB32PM = convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>;
+ qPixelLayouts[QImage::Format_A2RGB30_Premultiplied].convertFromARGB32PM = convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>;
}
#endif
-#if QT_COMPILER_SUPPORTS_AVX2 && !defined(__AVX2__)
+#if defined(QT_COMPILER_SUPPORTS_AVX2) && !defined(__AVX2__)
if (qCpuHasFeature(AVX2)) {
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *);
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 179900ddd2..2c222b97c2 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -882,9 +882,25 @@ template<enum QtPixelOrder> inline uint qConvertRgb32ToRgb30(QRgb);
template<enum QtPixelOrder> inline QRgb qConvertA2rgb30ToArgb32(uint c);
+// A combined unpremultiply and premultiply with new simplified alpha.
+// Needed when alpha loses precision relative to other colors during conversion (ARGB32 -> A2RGB30).
+template<unsigned int Shift>
+inline QRgb qRepremultiply(QRgb p)
+{
+ const uint alpha = qAlpha(p);
+ if (alpha == 255 || alpha == 0)
+ return p;
+ p = qUnpremultiply(p);
+ Q_CONSTEXPR uint mult = 255 / (255 >> Shift);
+ const uint newAlpha = mult * (alpha >> Shift);
+ p = (p & ~0xff000000) | (newAlpha<<24);
+ return qPremultiply(p);
+}
+
template<>
inline uint qConvertArgb32ToA2rgb30<PixelOrderBGR>(QRgb c)
{
+ c = qRepremultiply<6>(c);
return (c & 0xc0000000)
| (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000))
| (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
@@ -894,6 +910,7 @@ inline uint qConvertArgb32ToA2rgb30<PixelOrderBGR>(QRgb c)
template<>
inline uint qConvertArgb32ToA2rgb30<PixelOrderRGB>(QRgb c)
{
+ c = qRepremultiply<6>(c);
return (c & 0xc0000000)
| (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000))
| (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00))
diff --git a/src/gui/painting/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp
index 43a3958997..7cc498eefc 100644
--- a/src/gui/painting/qdrawhelper_sse4.cpp
+++ b/src/gui/painting/qdrawhelper_sse4.cpp
@@ -74,6 +74,22 @@ const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *s
return buffer;
}
+template<QtPixelOrder PixelOrder>
+const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *)
+{
+ for (int i = 0; i < count; ++i)
+ buffer[i] = qConvertArgb32ToA2rgb30_sse4<PixelOrder>(src[i]);
+ return buffer;
+}
+
+template
+const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderBGR>(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *);
+template
+const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4<PixelOrderRGB>(uint *buffer, const uint *src, int count,
+ const QPixelLayout *, const QRgb *);
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 1a7dddf0d5..c74055e440 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -35,6 +35,7 @@
#define QDRAWINGPRIMITIVE_SSE2_P_H
#include <private/qsimd_p.h>
+#include "qdrawhelper_p.h"
#ifdef __SSE2__
@@ -256,6 +257,43 @@ inline QRgb qUnpremultiply_sse4(QRgb p)
vl = _mm_packus_epi16(vl, vl);
return _mm_cvtsi128_si32(vl);
}
+
+template<enum QtPixelOrder PixelOrder>
+QT_FUNCTION_TARGET(SSE4_1)
+inline uint qConvertArgb32ToA2rgb30_sse4(QRgb p)
+{
+ const uint alpha = qAlpha(p);
+ if (alpha == 255)
+ return qConvertRgb32ToRgb30<PixelOrder>(p);
+ if (alpha == 0)
+ return 0;
+ Q_CONSTEXPR uint mult = 255 / (255 >> 6);
+ const uint invAlpha = qt_inv_premul_factor[alpha];
+ const uint newalpha = (alpha >> 6);
+ const __m128i via = _mm_set1_epi32(invAlpha);
+ const __m128i vna = _mm_set1_epi32(mult * newalpha);
+ const __m128i vr1 = _mm_set1_epi32(0x1000);
+ const __m128i vr2 = _mm_set1_epi32(0x80);
+ __m128i vl = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(p));
+ vl = _mm_mullo_epi32(vl, via);
+ vl = _mm_add_epi32(vl, vr1);
+ vl = _mm_srli_epi32(vl, 14);
+ vl = _mm_mullo_epi32(vl, vna);
+ vl = _mm_add_epi32(vl, _mm_srli_epi32(vl, 8));
+ vl = _mm_add_epi32(vl, vr2);
+ vl = _mm_srli_epi32(vl, 8);
+ vl = _mm_packus_epi32(vl, vl);
+ uint rgb30 = (newalpha << 30);
+ rgb30 |= ((uint)_mm_extract_epi16(vl, 1)) << 10;
+ if (PixelOrder == PixelOrderRGB) {
+ rgb30 |= ((uint)_mm_extract_epi16(vl, 2)) << 20;
+ rgb30 |= ((uint)_mm_extract_epi16(vl, 0));
+ } else {
+ rgb30 |= ((uint)_mm_extract_epi16(vl, 0)) << 20;
+ rgb30 |= ((uint)_mm_extract_epi16(vl, 2));
+ }
+ return rgb30;
+}
#endif
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index bf1f31a85b..ef93094387 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -149,7 +149,7 @@ QFont QTextItem::font() const
provided is the raster paint engine, which contains a software
rasterizer which supports the full feature set on all supported platforms.
This is the default for painting on QWidget-based classes in e.g. on Windows,
- X11 and Mac OS X, it is the backend for painting on QImage and it is
+ X11 and OS X, it is the backend for painting on QImage and it is
used as a fallback for paint engines that do not support a certain
capability. In addition we provide QPaintEngine implementations for
OpenGL (accessible through QGLWidget) and printing (which allows using
@@ -363,8 +363,8 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw
\value X11
\value Windows
\value MacPrinter
- \value CoreGraphics Mac OS X's Quartz2D (CoreGraphics)
- \value QuickDraw Mac OS X's QuickDraw
+ \value CoreGraphics OS X's Quartz2D (CoreGraphics)
+ \value QuickDraw OS X's QuickDraw
\value QWindowSystem Qt for Embedded Linux
\value PostScript (No longer supported)
\value OpenGL
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index f9cabe840d..1726bbe71f 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5966,8 +5966,17 @@ void QPainter::drawText(const QRect &r, int flags, const QString &str, QRect *br
\endtable
The \a boundingRect (if not null) is set to the what the bounding rectangle
- should be in order to enclose the whole text. The \a flags argument is a bitwise
- OR of the following flags:
+ should be in order to enclose the whole text. For example, in the following
+ image, the dotted line represents \a boundingRect as calculated by the
+ function, and the dashed line represents \a rectangle:
+
+ \table 100%
+ \row
+ \li \inlineimage qpainter-text-bounds.png
+ \li \snippet code/src_gui_painting_qpainter.cpp drawText
+ \endtable
+
+ The \a flags argument is a bitwise OR of the following flags:
\list
\li Qt::AlignLeft
@@ -6016,8 +6025,18 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
\overload
Draws the given \a text within the provided \a rectangle according
- to the specified \a flags. The \a boundingRect (if not null) is set to
- the what the bounding rectangle should be in order to enclose the whole text.
+ to the specified \a flags.
+
+ The \a boundingRect (if not null) is set to the what the bounding rectangle
+ should be in order to enclose the whole text. For example, in the following
+ image, the dotted line represents \a boundingRect as calculated by the
+ function, and the dashed line represents \a rectangle:
+
+ \table 100%
+ \row
+ \li \inlineimage qpainter-text-bounds.png
+ \li \snippet code/src_gui_painting_qpainter.cpp drawText
+ \endtable
By default, QPainter draws text anti-aliased.
@@ -6050,9 +6069,19 @@ void QPainter::drawText(const QRectF &r, int flags, const QString &str, QRectF *
Draws the given \a text within the rectangle with origin (\a{x},
\a{y}), \a width and \a height.
- The \a boundingRect (if not null) is set to the actual bounding
- rectangle of the output. The \a flags argument is a bitwise OR of
- the following flags:
+ The \a boundingRect (if not null) is set to the what the bounding rectangle
+ should be in order to enclose the whole text. For example, in the following
+ image, the dotted line represents \a boundingRect as calculated by the
+ function, and the dashed line represents the rectangle defined by
+ \a x, \a y, \a width and \a height:
+
+ \table 100%
+ \row
+ \li \inlineimage qpainter-text-bounds.png
+ \li \snippet code/src_gui_painting_qpainter.cpp drawText
+ \endtable
+
+ The \a flags argument is a bitwise OR of the following flags:
\list
\li Qt::AlignLeft
@@ -6177,7 +6206,7 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen)
QPen wavePen = pen;
wavePen.setCapStyle(Qt::SquareCap);
- // This is to protect against making the line too fat, as happens on Mac OS X
+ // This is to protect against making the line too fat, as happens on OS X
// due to it having a rather thick width for the regular underline.
const qreal maxPenWidth = .8 * radius;
if (wavePen.widthF() > maxPenWidth)
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index e2f267d7ee..48010c0a71 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -218,7 +218,7 @@ static void qt_debug_path(const QPainterPath &path)
Below is a code snippet that shows how a QPainterPath object can
be used:
- \table 100%
+ \table 70%
\row
\li \inlineimage qpainterpath-construction.png
\li
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index 19314ef84f..e6b777a30e 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -906,7 +906,7 @@ QRegion QRegion::intersect(const QRect &r) const
sort key and X as the minor sort key.
\endlist
\omit
- Only some platforms have these restrictions (Qt for Embedded Linux, X11 and Mac OS X).
+ Only some platforms have these restrictions (Qt for Embedded Linux, X11 and OS X).
\endomit
*/
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index f967c091df..d3765bbd29 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -201,7 +201,7 @@ public:
QStroker();
~QStroker();
- void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = width >= 1 ? 1.0/width : 0.5;}
+ void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = qt_real_to_fixed(width > 4 ? 1.0/width : 0.25); }
qfixed strokeWidth() const { return m_strokeWidth; }
void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); }
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 3b55ace68d..796f223797 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -725,7 +725,7 @@ void QFont::setFamily(const QString &family)
Returns the requested font style name, it will be used to match the
font with irregular styles (that can't be normalized in other style
properties). It depends on system font support, thus only works for
- Mac OS X and X11 so far. On Windows irregular styles will be added
+ OS X and X11 so far. On Windows irregular styles will be added
as separate font families so there is no need for this.
\sa setFamily(), setStyle()
@@ -820,7 +820,7 @@ int QFont::pointSize() const
\li Vertical hinting (light)
\li Full hinting
\row
- \li Cocoa on Mac OS X
+ \li Cocoa on OS X
\li No hinting
\li No hinting
\li No hinting
diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h
index 3f8241a80e..25b5ef0b0e 100644
--- a/src/gui/text/qfont_p.h
+++ b/src/gui/text/qfont_p.h
@@ -102,7 +102,7 @@ struct QFontDef
&& styleStrategy == other.styleStrategy
&& ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch
&& family == other.family
- && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName)
+ && styleName == other.styleName
&& hintingPreference == other.hintingPreference
;
}
@@ -115,7 +115,7 @@ struct QFontDef
if (styleHint != other.styleHint) return styleHint < other.styleHint;
if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy;
if (family != other.family) return family < other.family;
- if (!styleName.isEmpty() && !other.styleName.isEmpty() && styleName != other.styleName)
+ if (styleName != other.styleName)
return styleName < other.styleName;
if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 0a3ce5c5d1..0b0940855d 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -1184,14 +1184,25 @@ static int match(int script, const QFontDef &request,
static QString styleStringHelper(int weight, QFont::Style style)
{
QString result;
- if (weight >= QFont::Black)
- result = QCoreApplication::translate("QFontDatabase", "Black");
- else if (weight >= QFont::Bold)
- result = QCoreApplication::translate("QFontDatabase", "Bold");
- else if (weight >= QFont::DemiBold)
- result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
- else if (weight < QFont::Normal)
- result = QCoreApplication::translate("QFontDatabase", "Light");
+ if (weight > QFont::Normal) {
+ if (weight >= QFont::Black)
+ result = QCoreApplication::translate("QFontDatabase", "Black");
+ else if (weight >= QFont::ExtraBold)
+ result = QCoreApplication::translate("QFontDatabase", "Extra Bold");
+ else if (weight >= QFont::Bold)
+ result = QCoreApplication::translate("QFontDatabase", "Bold");
+ else if (weight >= QFont::DemiBold)
+ result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
+ else if (weight >= QFont::Medium)
+ result = QCoreApplication::translate("QFontDatabase", "Medium", "The Medium font weight");
+ } else {
+ if (weight <= QFont::Thin)
+ result = QCoreApplication::translate("QFontDatabase", "Thin");
+ else if (weight <= QFont::ExtraLight)
+ result = QCoreApplication::translate("QFontDatabase", "Extra Light");
+ else if (weight <= QFont::Light)
+ result = QCoreApplication::translate("QFontDatabase", "Light");
+ }
if (style == QFont::StyleItalic)
result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
@@ -1199,7 +1210,7 @@ static QString styleStringHelper(int weight, QFont::Style style)
result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
if (result.isEmpty())
- result = QCoreApplication::translate("QFontDatabase", "Normal");
+ result = QCoreApplication::translate("QFontDatabase", "Normal", "The Normal or Regular font weight");
return result.simplified();
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 87e6c30afe..6f5d178655 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1344,13 +1344,13 @@ QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &fami
return f;
}
-/**
- * Some font engines like the windows font engine
- * can not reliable create outline paths
- */
+// Allow font engines (e.g. Windows) that can not reliably create
+// outline paths for distance-field rendering to switch the scene
+// graph over to native text rendering.
bool QFontEngine::hasUnreliableGlyphOutline() const
{
- return false;
+ // Color glyphs (Emoji) are generally not suited for outlining
+ return glyphFormat == QFontEngine::Format_ARGB;
}
QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index c2d4b64152..e351d4d2c5 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -582,6 +582,7 @@ int QFontMetrics::width(QChar ch) const
return qRound(advance);
}
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
/*! \obsolete
Returns the width of the character at position \a pos in the
@@ -634,6 +635,7 @@ int QFontMetrics::charWidth(const QString &text, int pos) const
}
return width;
}
+#endif
/*!
Returns the bounding rectangle of the characters in the string
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 65ec219a99..2031f022d4 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -86,7 +86,9 @@ public:
int width(const QString &, int len, int flags) const;
int width(QChar) const;
- int charWidth(const QString &str, int pos) const;
+#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
+ QT_DEPRECATED int charWidth(const QString &str, int pos) const;
+#endif
QRect boundingRect(QChar) const;
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index d5567e173d..0fd5f510c7 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE
also have accessors to some relevant data in the physical font.
QRawFont only provides support for the main font technologies: GDI and DirectWrite on Windows
- platforms, FreeType on Linux platforms and CoreText on Mac OS X. For other
+ platforms, FreeType on Linux platforms and CoreText on OS X. For other
font back-ends, the APIs will be disabled.
QRawFont can be constructed in a number of ways:
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index a6b0804023..7dcd060ba1 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1327,7 +1327,7 @@ bool QTextFormat::operator==(const QTextFormat &rhs) const
\value WaveUnderline The text is underlined using a wave shaped line.
\value SpellCheckUnderline The underline is drawn depending on the QStyle::SH_SpellCeckUnderlineStyle
style hint of the QApplication style. By default this is mapped to
- WaveUnderline, on Mac OS X it is mapped to DashDotLine.
+ WaveUnderline, on OS X it is mapped to DashDotLine.
\sa Qt::PenStyle
*/
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 927d8614c8..40088d573a 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -38,7 +38,6 @@
#include "qzipreader_p.h"
#include "qzipwriter_p.h"
#include <qdatetime.h>
-#include <qplatformdefs.h>
#include <qendian.h>
#include <qdebug.h>
#include <qdir.h>
@@ -49,44 +48,6 @@
// (actually, the only basic support of this version is implemented but it is enough for now)
#define ZIP_VERSION 20
-#if defined(Q_OS_WIN)
-# undef S_IFREG
-# define S_IFREG 0100000
-# ifndef S_IFDIR
-# define S_IFDIR 0040000
-# endif
-# ifndef S_ISDIR
-# define S_ISDIR(x) ((x) & S_IFDIR) > 0
-# endif
-# ifndef S_ISREG
-# define S_ISREG(x) ((x) & 0170000) == S_IFREG
-# endif
-# define S_IFLNK 020000
-# define S_ISLNK(x) ((x) & S_IFLNK) > 0
-# ifndef S_IRUSR
-# define S_IRUSR 0400
-# endif
-# ifndef S_IWUSR
-# define S_IWUSR 0200
-# endif
-# ifndef S_IXUSR
-# define S_IXUSR 0100
-# endif
-# define S_IRGRP 0040
-# define S_IWGRP 0020
-# define S_IXGRP 0010
-# define S_IROTH 0004
-# define S_IWOTH 0002
-# define S_IXOTH 0001
-#endif
-
-#ifndef FILE_ATTRIBUTE_READONLY
-# define FILE_ATTRIBUTE_READONLY 0x1
-#endif
-#ifndef FILE_ATTRIBUTE_DIRECTORY
-# define FILE_ATTRIBUTE_DIRECTORY 0x10
-#endif
-
#if 0
#define ZDEBUG qDebug
#else
@@ -159,36 +120,6 @@ static void writeMSDosDate(uchar *dest, const QDateTime& dt)
}
}
-static quint32 permissionsToMode(QFile::Permissions perms)
-{
- quint32 mode = 0;
- if (perms & QFile::ReadOwner)
- mode |= S_IRUSR;
- if (perms & QFile::WriteOwner)
- mode |= S_IWUSR;
- if (perms & QFile::ExeOwner)
- mode |= S_IXUSR;
- if (perms & QFile::ReadUser)
- mode |= S_IRUSR;
- if (perms & QFile::WriteUser)
- mode |= S_IWUSR;
- if (perms & QFile::ExeUser)
- mode |= S_IXUSR;
- if (perms & QFile::ReadGroup)
- mode |= S_IRGRP;
- if (perms & QFile::WriteGroup)
- mode |= S_IWGRP;
- if (perms & QFile::ExeGroup)
- mode |= S_IXGRP;
- if (perms & QFile::ReadOther)
- mode |= S_IROTH;
- if (perms & QFile::WriteOther)
- mode |= S_IWOTH;
- if (perms & QFile::ExeOther)
- mode |= S_IXOTH;
- return mode;
-}
-
static int inflate(Bytef *dest, ulong *destLen, const Bytef *source, ulong sourceLen)
{
z_stream stream;
@@ -253,36 +184,86 @@ static int deflate (Bytef *dest, ulong *destLen, const Bytef *source, ulong sour
return err;
}
+
+namespace WindowsFileAttributes {
+enum {
+ Dir = 0x10, // FILE_ATTRIBUTE_DIRECTORY
+ File = 0x80, // FILE_ATTRIBUTE_NORMAL
+ TypeMask = 0x90,
+
+ ReadOnly = 0x01, // FILE_ATTRIBUTE_READONLY
+ PermMask = 0x01
+};
+}
+
+namespace UnixFileAttributes {
+enum {
+ Dir = 0040000, // __S_IFDIR
+ File = 0100000, // __S_IFREG
+ SymLink = 0120000, // __S_IFLNK
+ TypeMask = 0170000, // __S_IFMT
+
+ ReadUser = 0400, // __S_IRUSR
+ WriteUser = 0200, // __S_IWUSR
+ ExeUser = 0100, // __S_IXUSR
+ ReadGroup = 0040, // __S_IRGRP
+ WriteGroup = 0020, // __S_IWGRP
+ ExeGroup = 0010, // __S_IXGRP
+ ReadOther = 0004, // __S_IROTH
+ WriteOther = 0002, // __S_IWOTH
+ ExeOther = 0001, // __S_IXOTH
+ PermMask = 0777
+};
+}
+
static QFile::Permissions modeToPermissions(quint32 mode)
{
QFile::Permissions ret;
- if (mode & S_IRUSR)
- ret |= QFile::ReadOwner;
- if (mode & S_IWUSR)
- ret |= QFile::WriteOwner;
- if (mode & S_IXUSR)
- ret |= QFile::ExeOwner;
- if (mode & S_IRUSR)
- ret |= QFile::ReadUser;
- if (mode & S_IWUSR)
- ret |= QFile::WriteUser;
- if (mode & S_IXUSR)
- ret |= QFile::ExeUser;
- if (mode & S_IRGRP)
+ if (mode & UnixFileAttributes::ReadUser)
+ ret |= QFile::ReadOwner | QFile::ReadUser;
+ if (mode & UnixFileAttributes::WriteUser)
+ ret |= QFile::WriteOwner | QFile::WriteUser;
+ if (mode & UnixFileAttributes::ExeUser)
+ ret |= QFile::ExeOwner | QFile::ExeUser;
+ if (mode & UnixFileAttributes::ReadGroup)
ret |= QFile::ReadGroup;
- if (mode & S_IWGRP)
+ if (mode & UnixFileAttributes::WriteGroup)
ret |= QFile::WriteGroup;
- if (mode & S_IXGRP)
+ if (mode & UnixFileAttributes::ExeGroup)
ret |= QFile::ExeGroup;
- if (mode & S_IROTH)
+ if (mode & UnixFileAttributes::ReadOther)
ret |= QFile::ReadOther;
- if (mode & S_IWOTH)
+ if (mode & UnixFileAttributes::WriteOther)
ret |= QFile::WriteOther;
- if (mode & S_IXOTH)
+ if (mode & UnixFileAttributes::ExeOther)
ret |= QFile::ExeOther;
return ret;
}
+static quint32 permissionsToMode(QFile::Permissions perms)
+{
+ quint32 mode = 0;
+ if (mode & (QFile::ReadOwner | QFile::ReadUser))
+ mode |= UnixFileAttributes::ReadUser;
+ if (mode & (QFile::WriteOwner | QFile::WriteUser))
+ mode |= UnixFileAttributes::WriteUser;
+ if (mode & (QFile::ExeOwner | QFile::ExeUser))
+ mode |= UnixFileAttributes::WriteUser;
+ if (perms & QFile::ReadGroup)
+ mode |= UnixFileAttributes::ReadGroup;
+ if (perms & QFile::WriteGroup)
+ mode |= UnixFileAttributes::WriteGroup;
+ if (perms & QFile::ExeGroup)
+ mode |= UnixFileAttributes::ExeGroup;
+ if (perms & QFile::ReadOther)
+ mode |= UnixFileAttributes::ReadOther;
+ if (perms & QFile::WriteOther)
+ mode |= UnixFileAttributes::WriteOther;
+ if (perms & QFile::ExeOther)
+ mode |= UnixFileAttributes::ExeOther;
+ return mode;
+}
+
static QDateTime readMSDosDate(const uchar *src)
{
uint dosDate = readUInt(src);
@@ -494,27 +475,38 @@ void QZipPrivate::fillFileInfo(int index, QZipReader::FileInfo &fileInfo) const
switch (hostOS) {
case HostUnix:
mode = (mode >> 16) & 0xffff;
- if (S_ISDIR(mode))
+ switch (mode & UnixFileAttributes::TypeMask) {
+ case UnixFileAttributes::SymLink:
+ fileInfo.isSymLink = true;
+ break;
+ case UnixFileAttributes::Dir:
fileInfo.isDir = true;
- else if (S_ISREG(mode))
+ break;
+ case UnixFileAttributes::File:
+ default: // ### just for the case; should we warn?
fileInfo.isFile = true;
- else if (S_ISLNK(mode))
- fileInfo.isSymLink = true;
+ break;
+ }
fileInfo.permissions = modeToPermissions(mode);
break;
case HostFAT:
case HostNTFS:
case HostHPFS:
case HostVFAT:
- fileInfo.permissions |= QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther;
- if ((mode & FILE_ATTRIBUTE_READONLY) == 0)
- fileInfo.permissions |= QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther;
- if ((mode & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) {
+ switch (mode & WindowsFileAttributes::TypeMask) {
+ case WindowsFileAttributes::Dir:
fileInfo.isDir = true;
- fileInfo.permissions |= QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther;
- } else {
+ break;
+ case WindowsFileAttributes::File:
+ default:
fileInfo.isFile = true;
+ break;
}
+ fileInfo.permissions |= QFile::ReadOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther;
+ if ((mode & WindowsFileAttributes::ReadOnly) == 0)
+ fileInfo.permissions |= QFile::WriteOwner | QFile::WriteUser | QFile::WriteGroup | QFile::WriteOther;
+ if (fileInfo.isDir)
+ fileInfo.permissions |= QFile::ExeOwner | QFile::ExeUser | QFile::ExeGroup | QFile::ExeOther;
break;
default:
qWarning("QZip: Zip entry format at %d is not supported.", index);
@@ -761,9 +753,18 @@ void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const
//uchar external_file_attributes[4];
quint32 mode = permissionsToMode(permissions);
switch (type) {
- case File: mode |= S_IFREG; break;
- case Directory: mode |= S_IFDIR; break;
- case Symlink: mode |= S_IFLNK; break;
+ case Symlink:
+ mode |= UnixFileAttributes::SymLink;
+ break;
+ case Directory:
+ mode |= UnixFileAttributes::Dir;
+ break;
+ case File:
+ mode |= UnixFileAttributes::File;
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
}
writeUInt(header.h.external_file_attributes, mode << 16);
writeUInt(header.h.offset_local_header, start_of_directory);