summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp131
-rw-r--r--src/gui/image/qgifhandler.pri1
-rw-r--r--src/gui/image/qicon.cpp7
-rw-r--r--src/gui/image/qimage.cpp16
-rw-r--r--src/gui/image/qjpeghandler.pri1
-rw-r--r--src/gui/image/qpixmapcache.cpp14
-rw-r--r--src/gui/image/qpnghandler.pri1
-rw-r--r--src/gui/kernel/qevent.cpp56
-rw-r--r--src/gui/kernel/qguiapplication.cpp10
-rw-r--r--src/gui/kernel/qsessionmanager.cpp2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp16
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h2
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp6
-rw-r--r--src/gui/opengl/qopengldebug.cpp6
-rw-r--r--src/gui/opengl/qopengltexture.cpp5
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp10
-rw-r--r--src/gui/painting/qbackingstore.cpp14
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qimagescale.cpp5
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpdf.cpp8
-rw-r--r--src/gui/text/qfontdatabase.cpp85
-rw-r--r--src/gui/text/qfontengine.cpp14
-rw-r--r--src/gui/text/qfontmetrics.cpp5
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp14
-rw-r--r--src/gui/text/qtextdocument.cpp3
-rw-r--r--src/gui/text/qtextlayout.cpp81
27 files changed, 425 insertions, 94 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index fce92b9511..e0ebcd18ce 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1381,10 +1381,18 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
*/
/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QObject *object, const QVariant &value)
+
Constructs a new QAccessibleValueChangeEvent for \a object.
The event contains the new \a value.
*/
+/*! \fn QAccessibleValueChangeEvent::QAccessibleValueChangeEvent(QAccessibleInterface *iface, const QVariant &val)
+
+ Constructs a new QAccessibleValueChangeEvent for \a iface.
+ The event contains the new value \a val.
+*/
+
/*! \fn void QAccessibleValueChangeEvent::setValue(const QVariant & value)
+
Sets the new \a value for this event.
*/
/*!
@@ -1406,11 +1414,13 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
\sa QAccessibleInterface::state()
*/
/*! \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QObject *object, QAccessible::State state)
+
Constructs a new QAccessibleStateChangeEvent for \a object.
The difference to the object's previous state is in \a state.
*/
/*!
\fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state)
+
Constructs a new QAccessibleStateChangeEvent.
\a iface is the interface associated with the event
\a state is the state of the accessible object.
@@ -1419,8 +1429,8 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
\fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const
\brief Returns the states that have been changed.
- Be aware that the returned states are the ones that have changed,
- to find out about the state of an object, use QAccessibleInterface::state().
+ Keep in mind that the returned states are the ones that have changed.
+ To find out about the state of an object, use QAccessibleInterface::state().
For example, if an object used to have the focus but loses it,
the object's state will have focused set to \c false. This event on the
@@ -1443,7 +1453,7 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
*/
/*! \enum QAccessibleTableModelChangeEvent::ModelChangeType
- This enum describes different types of changes in the table model.
+ This enum describes the different types of changes in the table model.
\value ModelReset The model has been reset, all previous knowledge about the model is now invalid.
\value DataChanged No cells have been added or removed, but the data of the specified cell range is invalid.
\value RowsInserted New rows have been inserted.
@@ -1452,42 +1462,57 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
\value ColumnsRemoved Columns have been removed.
*/
/*! \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QObject *object, ModelChangeType changeType)
+
Constructs a new QAccessibleTableModelChangeEvent for \a object of with \a changeType.
*/
/*! \fn int QAccessibleTableModelChangeEvent::firstColumn() const
+
Returns the first changed column.
*/
/*! \fn int QAccessibleTableModelChangeEvent::firstRow() const
+
Returns the first changed row.
*/
/*! \fn int QAccessibleTableModelChangeEvent::lastColumn() const
+
Returns the last changed column.
*/
/*! \fn int QAccessibleTableModelChangeEvent::lastRow() const
+
Returns the last changed row.
*/
/*! \fn QAccessibleTableModelChangeEvent::ModelChangeType QAccessibleTableModelChangeEvent::modelChangeType() const
+
Returns the type of change.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setFirstColumn(int column)
+
Sets the first changed \a column.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setFirstRow(int row)
+
Sets the first changed \a row.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setLastColumn(int column)
+
Sets the last changed \a column.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setLastRow(int row)
+
Sets the last changed \a row.
*/
/*! \fn void QAccessibleTableModelChangeEvent::setModelChangeType(ModelChangeType changeType)
+
Sets the type of change to \a changeType.
*/
+/*!
+ \fn QAccessibleTableModelChangeEvent::QAccessibleTableModelChangeEvent(QAccessibleInterface *iface, ModelChangeType changeType)
-
+ Constructs a new QAccessibleTableModelChangeEvent for interface \a iface with a model
+ change type \a changeType.
+*/
/*!
- \class QAccessibleTextCursorEvent
+ \class QAccessibleTextCursorEvent
\ingroup accessibility
\inmodule QtGui
@@ -1495,18 +1520,28 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
This class is used with \l QAccessible::updateAccessibility().
*/
-/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPosition)
+/*! \fn QAccessibleTextCursorEvent::QAccessibleTextCursorEvent(QObject *object, int cursorPos)
+
Create a new QAccessibleTextCursorEvent for \a object.
- The \a cursorPosition is the new cursor position.
+ The \a cursorPos is the new cursor position.
*/
/*! \fn int QAccessibleTextCursorEvent::cursorPosition() const
+
Returns the cursor position.
*/
/*! \fn void QAccessibleTextCursorEvent::setCursorPosition(int position)
+
Sets the cursor \a position for this event.
*/
/*!
+ \fn QAccessibleTextCursorEvent(QAccessibleInterface *iface, int cursorPos)
+
+ Create a new QAccessibleTextCursorEvent for \a iface,
+ The \a cursorPos is the new cursor position.
+*/
+
+/*!
\class QAccessibleTextInsertEvent
\ingroup accessibility
\inmodule QtGui
@@ -1516,6 +1551,7 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QObject *object, int position, const QString &text)
+
Constructs a new QAccessibleTextInsertEvent event for \a object.
The \a text has been inserted at \a position.
By default, it is assumed that the cursor has moved to the end
@@ -1523,9 +1559,11 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
*/
/*! \fn int QAccessibleTextInsertEvent::changePosition() const
+
Returns the position where the text was inserted.
*/
/*! \fn QString QAccessibleTextInsertEvent::textInserted() const
+
Returns the text that has been inserted.
*/
@@ -1539,19 +1577,54 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QObject *object, int position, const QString &text)
+
Constructs a new QAccessibleTextRemoveEvent event for \a object.
The \a text has been removed at \a position.
By default it is assumed that the cursor has moved to \a position.
If that is not the case, one needs to manually
set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
*/
+/*! \fn QAccessibleTextRemoveEvent::QAccessibleTextRemoveEvent(QAccessibleInterface *iface, int position, const QString &text)
+
+ Constructs a new QAccessibleTextRemoveEvent event for \a iface.
+ The \a text has been removed at \a position.
+ By default it is assumed that the cursor has moved to \a position.
+ If that is not the case, one needs to manually
+ set it with \l QAccessibleTextCursorEvent::setCursorPosition() for this event.
+*/
/*! \fn int QAccessibleTextRemoveEvent::changePosition() const
+
Returns the position where the text was removed.
*/
/*! \fn QString QAccessibleTextRemoveEvent::textRemoved() const
+
Returns the text that has been removed.
*/
+/*!
+ \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QAccessibleInterface *iface, int start, int end)
+
+ Constructs a new QAccessibleTextSelectionEvent for \a iface. The new selection this
+ event notifies about is from position \a start to \a end.
+*/
+
+/*!
+ \fn QAccessibleTextInsertEvent::QAccessibleTextInsertEvent(QAccessibleInterface *iface, int position, const QString &text)
+
+ Constructs a new QAccessibleTextInsertEvent event for \a iface. The text has been inserted at
+ \a position.
+*/
+
+/*!
+ \fn inline QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QAccessibleInterface *iface, int position, const QString &oldText,
+ const QString &text)
+
+ Constructs a new QAccessibleTextUpdateEvent for \a iface. The text change takes place at
+ \a position where the \a oldText was removed and \a text inserted instead.
+
+*/
+
+
/*!
\class QAccessibleTextUpdateEvent
@@ -1566,16 +1639,20 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextUpdateEvent::QAccessibleTextUpdateEvent(QObject *object, int position, const QString &oldText, const QString &text)
+
Constructs a new QAccessibleTextUpdateEvent for \a object.
The text change takes place at \a position where the \a oldText was removed and \a text inserted instead.
*/
/*! \fn int QAccessibleTextUpdateEvent::changePosition() const
+
Returns where the change took place.
*/
/*! \fn QString QAccessibleTextUpdateEvent::textInserted() const
+
Returns the inserted text.
*/
/*! \fn QString QAccessibleTextUpdateEvent::textRemoved() const
+
Returns the removed text.
*/
@@ -1589,16 +1666,20 @@ QAccessible::Id QAccessibleEvent::uniqueId() const
This class is used with \l QAccessible::updateAccessibility().
*/
/*! \fn QAccessibleTextSelectionEvent::QAccessibleTextSelectionEvent(QObject *object, int start, int end)
+
Constructs a new QAccessibleTextSelectionEvent for \a object.
The new selection this event notifies about is from position \a start to \a end.
*/
/*! \fn int QAccessibleTextSelectionEvent::selectionEnd() const
+
Returns the position of the last selected character.
*/
/*! \fn int QAccessibleTextSelectionEvent::selectionStart() const
+
Returns the position of the first selected character.
*/
/*! \fn void QAccessibleTextSelectionEvent::setSelection(int start, int end)
+
Sets the selection for this event from position \a start to \a end.
*/
@@ -1840,11 +1921,13 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
/*!
\fn QAccessibleTextInterface::~QAccessibleTextInterface()
+
Destroys the QAccessibleTextInterface.
*/
/*!
\fn void QAccessibleTextInterface::addSelection(int startOffset, int endOffset)
+
Select the text from \a startOffset to \a endOffset.
The \a startOffset is the first character that will be selected.
The \a endOffset is the first character that will not be selected.
@@ -1857,6 +1940,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
/*!
\fn QString QAccessibleTextInterface::attributes(int offset, int *startOffset, int *endOffset) const
+
Returns the text attributes at the position \a offset.
In addition the range of the attributes is returned in \a startOffset and \a endOffset.
*/
@@ -1869,6 +1953,7 @@ QDebug operator<<(QDebug d, const QAccessibleEvent &ev)
/*!
\fn QRect QAccessibleTextInterface::characterRect(int offset) const
+
Returns the position and size of the character at position \a offset in screen coordinates.
*/
@@ -2222,6 +2307,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
/*!
\fn QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface()
+
Destroys the QAccessibleEditableTextInterface.
*/
@@ -2263,6 +2349,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
/*!
\fn QAccessibleValueInterface::~QAccessibleValueInterface()
+
Destructor.
*/
@@ -2335,46 +2422,55 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
/*!
\fn virtual QAccessibleTableCellInterface::~QAccessibleTableCellInterface()
+
Destroys the QAccessibleTableCellInterface.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::columnExtent() const
+
Returns the number of columns occupied by this cell accessible.
*/
/*!
\fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::columnHeaderCells() const
+
Returns the column headers as an array of cell accessibles.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::columnIndex() const
+
Translates this cell accessible into the corresponding column index.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::rowExtent() const
+
Returns the number of rows occupied by this cell accessible.
*/
/*!
\fn virtual QList<QAccessibleInterface*> QAccessibleTableCellInterface::rowHeaderCells() const
+
Returns the row headers as an array of cell accessibles.
*/
/*!
\fn virtual int QAccessibleTableCellInterface::rowIndex() const
+
Translates this cell accessible into the corresponding row index.
*/
/*!
\fn virtual bool QAccessibleTableCellInterface::isSelected() const
+
Returns a boolean value indicating whether this cell is selected.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableCellInterface::table() const
+
Returns the QAccessibleInterface of the table containing this cell.
*/
@@ -2391,105 +2487,125 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
/*!
\fn virtual QAccessibleTableInterface::~QAccessibleTableInterface()
+
Destroys the QAccessibleTableInterface.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::cellAt(int row, int column) const
+
Returns the cell at the specified \a row and \a column in the table.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::caption() const
+
Returns the caption for the table.
*/
/*!
\fn virtual QString QAccessibleTableInterface::columnDescription(int column) const
+
Returns the description text of the specified \a column in the table.
*/
/*!
\fn virtual int QAccessibleTableInterface::columnCount() const
+
Returns the total number of columns in table.
*/
/*!
\fn virtual int QAccessibleTableInterface::rowCount() const
+
Returns the total number of rows in table.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedCellCount() const
+
Returns the total number of selected cells.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedColumnCount() const
+
Returns the total number of selected columns.
*/
/*!
\fn virtual int QAccessibleTableInterface::selectedRowCount() const
+
Returns the total number of selected rows.
*/
/*!
\fn virtual QString QAccessibleTableInterface::rowDescription(int row) const
+
Returns the description text of the specified \a row in the table.
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedCells() const
+
Returns the list of selected cell (by their index as \l QAccessibleInterface::child() accepts).
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedColumns() const
+
Returns the list of currently selected columns.
*/
/*!
\fn virtual QList<int> QAccessibleTableInterface::selectedRows() const
+
Returns the list of currently selected columns.
*/
/*!
\fn virtual QAccessibleInterface *QAccessibleTableInterface::summary() const
+
Returns a QAccessibleInterface that represents a summary of the table.
This function may return 0 if no such interface exists.
*/
/*!
\fn virtual bool QAccessibleTableInterface::isColumnSelected(int column) const
+
Returns a boolean value indicating whether the specified \a column is completely selected.
*/
/*!
\fn virtual bool QAccessibleTableInterface::isRowSelected(int row) const
+
Returns a boolean value indicating whether the specified \a row is completely selected.
*/
/*!
\fn virtual bool QAccessibleTableInterface::selectRow(int row)
+
Selects \a row. This function might unselect all previously selected rows.
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::selectColumn(int column)
+
Selects \a column. This function might unselect all previously selected columns.
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::unselectRow(int row)
+
Unselects \a row, leaving other selected rows selected (if any).
Returns \c true if the selection was successful.
*/
/*!
\fn virtual bool QAccessibleTableInterface::unselectColumn(int column)
+
Unselects \a column, leaving other selected columns selected (if any).
Returns \c true if the selection was successful.
*/
@@ -2544,6 +2660,7 @@ QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible::TextBoun
/*!
\fn QAccessibleActionInterface::~QAccessibleActionInterface()
+
Destroys the QAccessibleActionInterface.
*/
diff --git a/src/gui/image/qgifhandler.pri b/src/gui/image/qgifhandler.pri
index 6eb0751372..ec33101451 100644
--- a/src/gui/image/qgifhandler.pri
+++ b/src/gui/image/qgifhandler.pri
@@ -1,4 +1,3 @@
# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qgifhandler_p.h
SOURCES += $$PWD/qgifhandler.cpp
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index cafc966fbb..66bb77795e 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -631,6 +631,13 @@ QIcon::QIcon(const QIcon &other)
}
/*!
+ \fn QIcon::QIcon(QIcon &&other)
+
+ Move-constructs a QIcon instance, making it point to the same object
+ that \a other was pointing to.
+*/
+
+/*!
Constructs an icon from the file with the given \a fileName. The
file will be loaded on demand.
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index cd0cbf7f49..176cdfe09f 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -568,12 +568,13 @@ bool QImageData::checkForAlphaPixels() const
\endtable
+ \target qimage-legalese
\section1 Legal Information
For smooth scaling, the transformed() functions use code based on
smooth scaling algorithm by Daniel M. Duley.
- \legalese
+ \badcode
Copyright (C) 2004, 2005 Daniel M. Duley
Redistribution and use in source and binary forms, with or without
@@ -596,7 +597,7 @@ bool QImageData::checkForAlphaPixels() const
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- \endlegalese
+ \endcode
\sa QImageReader, QImageWriter, QPixmap, QSvgRenderer, {Image Composition Example},
{Image Viewer Example}, {Scribble Example}, {Pixelator Example}
@@ -4133,9 +4134,6 @@ QImage QImage::alphaChannel() const
if (!d)
return QImage();
- if (d->format == QImage::Format_Alpha8)
- return *this;
-
int w = d->width;
int h = d->height;
@@ -4165,6 +4163,10 @@ QImage QImage::alphaChannel() const
src_data += d->bytes_per_line;
dest_data += image.d->bytes_per_line;
}
+ } else if (d->format == Format_Alpha8) {
+ const uchar *src_data = d->data;
+ uchar *dest_data = image.d->data;
+ memcpy(dest_data, src_data, d->bytes_per_line * h);
} else {
QImage alpha32 = *this;
bool canSkipConversion = (d->format == Format_ARGB32 || d->format == Format_ARGB32_Premultiplied);
@@ -4256,6 +4258,10 @@ int QImage::bitPlaneCount() const
return bpc;
}
+/*!
+ Returns a smoothly scaled copy of the image. The returned image has a size
+ of width \a w by height \a h pixels.
+*/
QImage QImage::smoothScaled(int w, int h) const {
QImage src = *this;
switch (src.format()) {
diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri
index c8de33d8b4..de40c6742e 100644
--- a/src/gui/image/qjpeghandler.pri
+++ b/src/gui/image/qjpeghandler.pri
@@ -1,5 +1,4 @@
# common to plugin and built-in forms
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qjpeghandler_p.h
SOURCES += $$PWD/qjpeghandler.cpp
contains(QT_CONFIG, system-jpeg) {
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index f9c362e194..3836976975 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -660,5 +660,19 @@ QList< QPair<QString,QPixmap> > QPixmapCache::allPixmaps()
{
return pm_cache()->allPixmaps();
}
+/*!
+ \fn QPixmapCache::KeyData::KeyData()
+
+ \internal
+*/
+/*!
+ \fn QPixmapCache::KeyData::KeyData(const KeyData &other)
+ \internal
+*/
+/*!
+ \fn QPixmapCache::KeyData::~KeyData()
+
+ \internal
+*/
QT_END_NAMESPACE
diff --git a/src/gui/image/qpnghandler.pri b/src/gui/image/qpnghandler.pri
index aca7e2c568..9ab175d628 100644
--- a/src/gui/image/qpnghandler.pri
+++ b/src/gui/image/qpnghandler.pri
@@ -1,4 +1,3 @@
-INCLUDEPATH *= $$PWD
HEADERS += $$PWD/qpnghandler_p.h
SOURCES += $$PWD/qpnghandler.cpp
contains(QT_CONFIG, system-png) {
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 98fb0f1f20..c231c47576 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -83,6 +83,52 @@ QEnterEvent::~QEnterEvent()
}
/*!
+ \fn QPoint QEnterEvent::globalPos() const
+
+ Returns the global position of the widget \e{at the time of the event}.
+*/
+/*!
+ \fn int QEnterEvent::globalX() const
+
+ Returns the global position on the X-axis of the mouse cursor relative to the the widget.
+*/
+/*!
+ \fn int QEnterEvent::globalY() const
+
+ Returns the global position on the Y-axis of the mouse cursor relative to the the widget.
+*/
+/*!
+ \fn QPoint QEnterEvent::localPos() const
+
+ Returns the mouse cursor's position relative to the receiving widget.
+*/
+/*!
+ \fn QPoint QEnterEvent::pos() const
+
+ Returns the position of the mouse cursor in global screen coordinates.
+*/
+/*!
+ \fn QPoint QEnterEvent::screenPos() const
+
+ Returns the position of the mouse cursor relative to the receiving screen.
+*/
+/*!
+ \fn QPoint QEnterEvent::windowPos() const
+
+ Returns the position of the mouse cursor relative to the receiving window.
+*/
+/*!
+ \fn int QEnterEvent::x() const
+
+ Returns the x position of the mouse cursor relative to the receiving widget.
+*/
+/*!
+ \fn int QEnterEvent::y() const
+
+ Returns the y position of the mouse cursor relative to the receiving widget.
+*/
+
+/*!
\class QInputEvent
\ingroup events
\inmodule QtGui
@@ -4161,6 +4207,12 @@ QTouchEvent::~QTouchEvent()
\sa QTouchDevice::type(), QTouchEvent::device()
*/
+/*! \fn QTouchEvent::TouchPoint::TouchPoint(TouchPoint &&other)
+
+ Move-constructs a TouchPoint instance, making it point to the same
+ object that \a other was pointing to.
+*/
+
/*! \fn Qt::TouchPointStates QTouchEvent::touchPointStates() const
Returns a bitwise OR of all the touch point states for this event.
@@ -4688,6 +4740,10 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
*/
/*!
+ \fn TouchPoint &TouchPoint::operator=(TouchPoint &&other)
+ \internal
+ */
+/*!
\fn void QTouchEvent::TouchPoint::swap(TouchPoint &other);
\internal
*/
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 8ebddf33a6..654567e7df 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1884,8 +1884,14 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
#if !defined(Q_OS_OSX)
// On OS X the shortcut override is checked earlier, see: QWindowSystemInterface::handleKeyEvent()
const bool checkShortcut = e->keyType == QEvent::KeyPress && window != 0;
- if (checkShortcut && QWindowSystemInterface::tryHandleShortcutEvent(window, e->timestamp, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount))
- return;
+ if (checkShortcut) {
+ QKeyEvent override(QEvent::ShortcutOverride, e->key, e->modifiers,
+ e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers,
+ e->unicode, e->repeat, e->repeatCount);
+ override.setTimestamp(e->timestamp);
+ if (QWindowSystemInterface::tryHandleShortcutOverrideEvent(window, &override))
+ return;
+ }
#endif // Q_OS_OSX
QKeyEvent ev(e->keyType, e->key, e->modifiers,
diff --git a/src/gui/kernel/qsessionmanager.cpp b/src/gui/kernel/qsessionmanager.cpp
index b54b7b468c..f4b56fd01b 100644
--- a/src/gui/kernel/qsessionmanager.cpp
+++ b/src/gui/kernel/qsessionmanager.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\class QSessionManager
\brief The QSessionManager class provides access to the session manager.
- \inmodule QtWidgets
+ \inmodule QtGui
A session manager in a desktop environment (in which Qt GUI applications
live) keeps track of a session, which is a group of running applications,
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index b17978cb7d..9a9eab2fe7 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -225,6 +225,22 @@ bool QWindowSystemInterface::tryHandleShortcutEvent(QWindow *w, ulong timestamp,
#endif
}
+bool QWindowSystemInterface::tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev)
+{
+#ifndef QT_NO_SHORTCUT
+ Q_ASSERT(ev->type() == QKeyEvent::ShortcutOverride);
+
+ QObject *focus = w->focusObject();
+ if (!focus)
+ focus = w;
+ return QGuiApplicationPrivate::instance()->shortcutMap.tryShortcutEvent(focus, ev);
+#else
+ Q_UNUSED(w)
+ Q_UNUSED(ev)
+ return false;
+#endif
+}
+
// used by QTestLib to directly send shortcuts to objects
bool QWindowSystemInterface::tryHandleShortcutEventToObject(QObject *o, ulong timestamp, int k, Qt::KeyboardModifiers mods,
const QString &text, bool autorep, ushort count)
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index c004fc6ef2..448c5d0893 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -78,6 +78,8 @@ public:
Qt::KeyboardModifiers mods = Qt::NoModifier,
Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
+ static bool tryHandleShortcutOverrideEvent(QWindow *w, QKeyEvent *ev);
+
static bool tryHandleShortcutEvent(QWindow *w, int k, Qt::KeyboardModifiers mods,
const QString & text = QString(), bool autorep = false, ushort count = 1);
static bool tryHandleShortcutEvent(QWindow *w, ulong timestamp, int k, Qt::KeyboardModifiers mods,
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 7b46bb452c..2c9dfd8bb5 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -69,12 +69,6 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \fn QGenericMatrix::QGenericMatrix(const QGenericMatrix<N, M, T>& other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
\fn QGenericMatrix::QGenericMatrix(const T *values)
Constructs a matrix from the given N * M floating-point \a values.
diff --git a/src/gui/opengl/qopengldebug.cpp b/src/gui/opengl/qopengldebug.cpp
index e747372df9..8b2ffb1a20 100644
--- a/src/gui/opengl/qopengldebug.cpp
+++ b/src/gui/opengl/qopengldebug.cpp
@@ -916,6 +916,12 @@ QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(const QOpenGLDebugMessage &d
}
/*!
+ \fn QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(QOpenGLDebugMessage &&debugMessage)
+
+ Move-assigns \a debugMessage to this object.
+*/
+
+/*!
\fn void QOpenGLDebugMessage::swap(QOpenGLDebugMessage &debugMessage)
Swaps the message \a debugMessage with this message. This operation is very
diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp
index 5edaddcd6a..5271826015 100644
--- a/src/gui/opengl/qopengltexture.cpp
+++ b/src/gui/opengl/qopengltexture.cpp
@@ -179,8 +179,9 @@ void QOpenGLTexturePrivate::destroy()
// not created or already destroyed
return;
}
- if (QOpenGLContext::currentContext() != context) {
- qWarning("Requires a valid current OpenGL context.\n"
+ QOpenGLContext *currentContext = QOpenGLContext::currentContext();
+ if (!currentContext || !QOpenGLContext::areSharing(currentContext, context)) {
+ qWarning("Texture is not valid in the current context.\n"
"Texture has not been destroyed");
return;
}
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 346a526054..17cd55720a 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -186,11 +186,17 @@ void QAbstractOpenGLFunctionsPrivate::removeExternalFunctions(QOpenGLContext *co
\sa QOpenGLContext::versionFunctions()
*/
+/*!
+ Constructs a QAbstractOpenGLFunctions object.
+*/
QAbstractOpenGLFunctions::QAbstractOpenGLFunctions()
: d_ptr(new QAbstractOpenGLFunctionsPrivate)
{
}
+/*!
+ Destroys a QAbstractOpenGLFunctions object.
+*/
QAbstractOpenGLFunctions::~QAbstractOpenGLFunctions()
{
Q_D(QAbstractOpenGLFunctions);
@@ -228,12 +234,16 @@ bool QAbstractOpenGLFunctions::isInitialized() const
return d->initialized;
}
+/*! \internal
+ */
void QAbstractOpenGLFunctions::setOwningContext(const QOpenGLContext *context)
{
Q_D(QAbstractOpenGLFunctions);
d->owningContext = const_cast<QOpenGLContext*>(context);
}
+/*! \internal
+ */
QOpenGLContext *QAbstractOpenGLFunctions::owningContext() const
{
Q_D(const QAbstractOpenGLFunctions);
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 19074e4c47..f2fee99b99 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -197,16 +197,27 @@ bool QBackingStore::scroll(const QRegion &area, int dx, int dy)
return d_ptr->platformBackingStore->scroll(area, dx, dy);
}
+/*!
+ Set \a region as the static contents of this window.
+*/
void QBackingStore::setStaticContents(const QRegion &region)
{
d_ptr->staticContents = region;
}
+/*!
+ Returns a pointer to the QRegion that has the static contents
+ of this window.
+*/
QRegion QBackingStore::staticContents() const
{
return d_ptr->staticContents;
}
+/*!
+ Returns a boolean indicating if this window
+ has static contents or not.
+*/
bool QBackingStore::hasStaticContents() const
{
return !d_ptr->staticContents.isEmpty();
@@ -259,6 +270,9 @@ void Q_GUI_EXPORT qt_scrollRectInImage(QImage &img, const QRect &rect, const QPo
}
}
+/*!
+ Returns a pointer to the QPlatformBackingStore implementation
+*/
QPlatformBackingStore *QBackingStore::handle() const
{
return d_ptr->platformBackingStore;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 670717c5f1..c3a0f5c615 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -35,7 +35,7 @@
#include "qpixmap.h"
#include "qbitmap.h"
#include "qpixmapcache.h"
-#include "qplatformpixmap.h"
+#include <qpa/qplatformpixmap.h>
#include "qdatastream.h"
#include "qvariant.h"
#include "qline.h"
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 867c64c5e0..2f85e90c49 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -312,7 +312,10 @@ static void qt_qimageScaleAARGBA_up_xy(QImageScaleInfo *isi, unsigned int *dest,
for (int x = dxx; x < end; x++) {
const unsigned int *pix = sptr + xpoints[x];
const int xap = xapoints[x];
- *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
+ if (xap > 0)
+ *dptr = INTERPOLATE_PIXEL_256(pix[0], 256 - xap, pix[1], xap);
+ else
+ *dptr = pix[0];
dptr++;
}
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 18522cb6d0..aabf4a9427 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3281,6 +3281,10 @@ bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontE
return QPaintEngineEx::requiresPretransformedGlyphPositions(fontEngine, m);
}
+/*!
+ Indicates whether glyph caching is supported by the font engine
+ \a fontEngine with the given transform \a m applied.
+*/
bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
{
// The raster engine does not support projected cached glyph drawing
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 6ea0800538..54e656e339 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1979,8 +1979,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
if (reflect && step % 2) {
for (int i = stops.size() - 1; i > 0; --i) {
QGradientBound b;
- b.start = step + 1 - qBound(0., stops.at(i).first, 1.);
- b.stop = step + 1 - qBound(0., stops.at(i - 1).first, 1.);
+ b.start = step + 1 - qBound(qreal(0.), stops.at(i).first, qreal(1.));
+ b.stop = step + 1 - qBound(qreal(0.), stops.at(i - 1).first, qreal(1.));
b.function = functions.at(i - 1);
b.reverse = true;
gradientBounds << b;
@@ -1988,8 +1988,8 @@ int QPdfEnginePrivate::createShadingFunction(const QGradient *gradient, int from
} else {
for (int i = 0; i < stops.size() - 1; ++i) {
QGradientBound b;
- b.start = step + qBound(0., stops.at(i).first, 1.);
- b.stop = step + qBound(0., stops.at(i + 1).first, 1.);
+ b.start = step + qBound(qreal(0.), stops.at(i).first, qreal(1.));
+ b.stop = step + qBound(qreal(0.), stops.at(i + 1).first, qreal(1.));
b.function = functions.at(i);
b.reverse = false;
gradientBounds << b;
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 6b7a9837cb..85a804acfe 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -72,12 +72,14 @@ QT_BEGIN_NAMESPACE
#define SMOOTH_SCALABLE 0xffff
+#if defined(QT_BUILD_INTERNAL)
bool qt_enable_test_font = false;
Q_AUTOTEST_EXPORT void qt_setQtEnableTestFont(bool value)
{
qt_enable_test_font = value;
}
+#endif
static int getFontWeight(const QString &weightString)
{
@@ -756,7 +758,47 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
return alias;
}
-static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
+QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+{
+ Q_UNUSED(family);
+ Q_UNUSED(styleHint);
+
+ QStringList retList;
+
+ size_t writingSystem = std::find(scriptForWritingSystem,
+ scriptForWritingSystem + QFontDatabase::WritingSystemsCount,
+ script) - scriptForWritingSystem;
+ if (writingSystem >= QFontDatabase::WritingSystemsCount)
+ writingSystem = QFontDatabase::Any;
+
+ QFontDatabasePrivate *db = privateDb();
+ for (int i = 0; i < db->count; ++i) {
+ QtFontFamily *f = db->families[i];
+
+ f->ensurePopulated();
+
+ if (writingSystem > QFontDatabase::Any && f->writingSystems[writingSystem] != QtFontFamily::Supported)
+ continue;
+
+ for (int j = 0; j < f->count; ++j) {
+ QtFontFoundry *foundry = f->foundries[j];
+
+ for (int k = 0; k < foundry->count; ++k) {
+ if (style == foundry->styles[k]->key.style) {
+ if (foundry->name.isEmpty())
+ retList.append(f->name);
+ else
+ retList.append(f->name + QLatin1String(" [") + foundry->name + QLatin1Char(']'));
+ break;
+ }
+ }
+ }
+ }
+
+ return retList;
+}
+
+QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
// make sure that the db has all fallback families
QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
@@ -884,17 +926,19 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);
Q_ASSERT(!engine || engine->type() != QFontEngine::Multi);
if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
- QStringList fallbacks = request.fallBackFamilies;
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
+ QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
+ if (!request.fallBackFamilies.isEmpty()) {
+ QStringList fallbacks = request.fallBackFamilies;
- QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
- if (styleHint == QFont::AnyStyle && request.fixedPitch)
- styleHint = QFont::TypeWriter;
+ QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
+ if (styleHint == QFont::AnyStyle && request.fixedPitch)
+ styleHint = QFont::TypeWriter;
- fallbacks += fallbackFamilies(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));
+ fallbacks += qt_fallbacksForFamily(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));
- QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
- QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
- pfMultiEngine->setFallbackFamiliesList(fallbacks);
+ pfMultiEngine->setFallbackFamiliesList(fallbacks);
+ }
engine = pfMultiEngine;
// Cache Multi font engine as well in case we got the single
@@ -2519,6 +2563,15 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
QFontEngine *engine;
+#if defined(QT_BUILD_INTERNAL)
+ // For testing purpose only, emulates an exact-matching monospace font
+ if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
+ engine = new QTestFontEngine(request.pixelSize);
+ engine->fontDef = request;
+ return engine;
+ }
+#endif
+
// Until we specifically asked not to, try looking for Multi font engine
// first, the last '1' indicates that we want Multi font engine instead
// of single ones
@@ -2534,12 +2587,6 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
parseFontName(request.family, foundry_name, family_name);
- if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
- engine =new QTestFontEngine(request.pixelSize);
- engine->fontDef = request;
- return engine;
- }
-
QtFontDesc desc;
QList<int> blackListed;
int index = match(script, request, family_name, foundry_name, &desc, blackListed);
@@ -2560,10 +2607,10 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
styleHint = QFont::TypeWriter;
QStringList fallbacks = request.fallBackFamilies
- + fallbackFamilies(request.family,
- QFont::Style(request.style),
- styleHint,
- QChar::Script(script));
+ + qt_fallbacksForFamily(request.family,
+ QFont::Style(request.style),
+ styleHint,
+ QChar::Script(script));
if (script > QChar::Script_Common)
fallbacks += QString(); // Find the first font matching the specified script.
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index c5b28fb536..2087bad9f6 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1700,15 +1700,15 @@ QFontEngineMulti::~QFontEngineMulti()
}
}
+QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script);
+
void QFontEngineMulti::ensureFallbackFamiliesQueried()
{
- if (QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration()) {
- const QStringList fallbackFamilies = integration->fontDatabase()->fallbacksForFamily(fontDef.family,
- QFont::Style(fontDef.style),
- QFont::AnyStyle,
- QChar::Script(m_script));
- setFallbackFamiliesList(fallbackFamilies);
- }
+ QFont::StyleHint styleHint = QFont::StyleHint(fontDef.styleHint);
+ if (styleHint == QFont::AnyStyle && fontDef.fixedPitch)
+ styleHint = QFont::TypeWriter;
+
+ setFallbackFamiliesList(qt_fallbacksForFamily(fontDef.family, QFont::Style(fontDef.style), styleHint, QChar::Script(m_script)));
}
void QFontEngineMulti::setFallbackFamiliesList(const QStringList &fallbackFamilies)
diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp
index e351d4d2c5..5bc9fe3c7f 100644
--- a/src/gui/text/qfontmetrics.cpp
+++ b/src/gui/text/qfontmetrics.cpp
@@ -208,6 +208,11 @@ QFontMetrics &QFontMetrics::operator=(const QFontMetrics &fm)
\since 5.2
*/
+/*!
+ \fn QFontMetricsF &QFontMetricsF::operator=(QFontMetricsF &&other)
+
+ Move-assigns \a other to this QFontMetricsF instance.
+*/
/*!
\fn void QFontMetrics::swap(QFontMetrics &other)
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 502348a79a..8764c8cebf 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -343,17 +343,15 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QByteArray &fontData, qreal
}
/*!
+ \fn QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
+
Returns a list of alternative fonts for the specified \a family and
\a style and \a script using the \a styleHint given.
+
+ Default implementation returns a list of fonts for which \a style and \a script support
+ has been reported during the font database population.
*/
-QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const
-{
- Q_UNUSED(family);
- Q_UNUSED(style);
- Q_UNUSED(styleHint);
- Q_UNUSED(script);
- return QStringList();
-}
+// implemented in qfontdatabase.cpp
/*!
Adds an application font described by the font contained supplied \a fontData
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index d3b70aaf26..29e00d481e 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -135,9 +135,8 @@ bool Qt::mightBeRichText(const QString& text)
return false;
}
-/*!
- \fn QString Qt::convertFromPlainText(const QString &plain, WhiteSpaceMode mode)
+/*!
Converts the plain text string \a plain to an HTML-formatted
paragraph while preserving most of its look.
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 7da3e84041..013cd8ae0f 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1605,8 +1605,8 @@ namespace {
bool checkFullOtherwiseExtend(QScriptLine &line);
QFixed calculateNewWidth(const QScriptLine &line) const {
- return line.textWidth + tmpData.textWidth + spaceData.textWidth + softHyphenWidth
- - qMin(rightBearing, QFixed());
+ return line.textWidth + tmpData.textWidth + spaceData.textWidth
+ + softHyphenWidth + negativeRightBearing();
}
inline glyph_t currentGlyph() const
@@ -1626,33 +1626,51 @@ namespace {
}
}
- inline void adjustRightBearing(glyph_t glyph)
+ inline void calculateRightBearing(glyph_t glyph)
{
qreal rb;
fontEngine->getGlyphBearings(glyph, 0, &rb);
- rightBearing = qMin(QFixed(), QFixed::fromReal(rb));
+
+ // We only care about negative right bearings, so we limit the range
+ // of the bearing here so that we can assume it's negative in the rest
+ // of the code, as well ase use QFixed(1) as a sentinel to represent
+ // the state where we have yet to compute the right bearing.
+ rightBearing = qMin(QFixed::fromReal(rb), QFixed(0));
}
- inline void adjustRightBearing()
+ inline void calculateRightBearing()
{
if (currentPosition <= 0)
return;
- adjustRightBearing(currentGlyph());
+ calculateRightBearing(currentGlyph());
}
- inline void adjustPreviousRightBearing()
+ inline void calculateRightBearingForPreviousGlyph()
{
if (previousGlyph > 0)
- adjustRightBearing(previousGlyph);
+ calculateRightBearing(previousGlyph);
}
+ static const QFixed RightBearingNotCalculated;
+
inline void resetRightBearing()
{
- rightBearing = QFixed(1); // Any positive number is defined as invalid since only
- // negative right bearings are interesting to us.
+ rightBearing = RightBearingNotCalculated;
+ }
+
+ // We express the negative right bearing as an absolute number
+ // so that it can be applied to the width using addition.
+ inline QFixed negativeRightBearing() const
+ {
+ if (rightBearing == RightBearingNotCalculated)
+ return QFixed(0);
+
+ return qAbs(rightBearing);
}
};
+const QFixed LineBreakHelper::RightBearingNotCalculated = QFixed(1);
+
inline bool LineBreakHelper::checkFullOtherwiseExtend(QScriptLine &line)
{
LB_DEBUG("possible break width %f, spacew=%f", tmpData.textWidth.toReal(), spaceData.textWidth.toReal());
@@ -1805,7 +1823,7 @@ void QTextLine::layout_helper(int maxGlyphs)
current, lbh.logClusters, lbh.glyphs);
} else {
lbh.tmpData.length++;
- lbh.adjustPreviousRightBearing();
+ lbh.calculateRightBearingForPreviousGlyph();
}
line += lbh.tmpData;
goto found;
@@ -1887,22 +1905,29 @@ void QTextLine::layout_helper(int maxGlyphs)
lbh.tmpData.textWidth += lbh.glyphs.advances[lbh.logClusters[lbh.currentPosition - 1]];
}
- // The actual width of the text needs to take the right bearing into account. The
- // right bearing is left-ward, which means that if the rightmost pixel is to the right
- // of the advance of the glyph, the bearing will be negative. We flip the sign
- // for the code to be more readable. Logic borrowed from qfontmetrics.cpp.
- // We ignore the right bearing if the minimum negative bearing is too little to
- // expand the text beyond the edge.
if (sb_or_ws|breakany) {
- QFixed rightBearing = lbh.rightBearing; // store previous right bearing
+ // To compute the final width of the text we need to take negative right bearing
+ // into account (negative right bearing means the glyph has pixel data past the
+ // advance length). Note that the negative right bearing is an absolute number,
+ // so that we can apply it to the width using straight forward addition.
+
+ // Store previous right bearing (for the already accepted glyph) in case we
+ // end up breaking due to the current glyph being too wide.
+ QFixed previousRightBearing = lbh.rightBearing;
+
+ // We ignore the right bearing if the minimum negative bearing is too little to
+ // expand the text beyond the edge.
if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width)
- lbh.adjustRightBearing();
+ lbh.calculateRightBearing();
+
if (lbh.checkFullOtherwiseExtend(line)) {
- // we are too wide, fix right bearing
- if (rightBearing <= 0)
- lbh.rightBearing = rightBearing; // take from cache
+ // We are too wide to accept the next glyph with its bearing, so we restore the
+ // right bearing to that of the previous glyph (the one that was already accepted),
+ // so that the bearing can be be applied to the final width of the text below.
+ if (previousRightBearing != LineBreakHelper::RightBearingNotCalculated)
+ lbh.rightBearing = previousRightBearing;
else
- lbh.adjustPreviousRightBearing();
+ lbh.calculateRightBearingForPreviousGlyph();
if (!breakany) {
line.textWidth += lbh.softHyphenWidth;
@@ -1919,10 +1944,14 @@ void QTextLine::layout_helper(int maxGlyphs)
LB_DEBUG("reached end of line");
lbh.checkFullOtherwiseExtend(line);
found:
- if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted
- lbh.adjustRightBearing();
line.textAdvance = line.textWidth;
- line.textWidth -= qMin(QFixed(), lbh.rightBearing);
+
+ // If right bearing has not been calculated yet, do that now
+ if (lbh.rightBearing == LineBreakHelper::RightBearingNotCalculated && !lbh.whiteSpaceOrObject)
+ lbh.calculateRightBearing();
+
+ // Then apply any negative right bearing
+ line.textWidth += lbh.negativeRightBearing();
if (line.length == 0) {
LB_DEBUG("no break available in line, adding temp: length %d, width %f, space: length %d, width %f",