summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json6
-rw-r--r--src/gui/doc/snippets/draganddrop/dragwidget.h8
-rw-r--r--src/gui/doc/snippets/dragging/mainwindow.h2
-rw-r--r--src/gui/doc/snippets/dropevents/window.h4
-rw-r--r--src/gui/doc/snippets/droprectangle/window.h4
-rw-r--r--src/gui/doc/snippets/matrix/matrix.cpp6
-rw-r--r--src/gui/doc/snippets/plaintextlayout/window.h2
-rw-r--r--src/gui/doc/snippets/qfileopenevent/main.cpp2
-rw-r--r--src/gui/doc/snippets/separations/finalwidget.h4
-rw-r--r--src/gui/doc/snippets/textdocument-imagedrop/textedit.h4
-rw-r--r--src/gui/doc/snippets/transform/main.cpp6
-rw-r--r--src/gui/image/qimage_conversions.cpp92
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.cpp32
-rw-r--r--src/gui/itemmodels/qstandarditemmodel.h3
-rw-r--r--src/gui/kernel/qevent.cpp25
-rw-r--r--src/gui/kernel/qevent.h5
-rw-r--r--src/gui/kernel/qkeysequence.cpp5
-rw-r--r--src/gui/kernel/qopenglcontext.cpp2
-rw-r--r--src/gui/kernel/qplatformgraphicsbufferhelper.cpp41
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp19
-rw-r--r--src/gui/text/qfont.cpp13
-rw-r--r--src/gui/text/qtextengine.cpp10
-rw-r--r--src/gui/util/qvalidator.cpp2
23 files changed, 194 insertions, 103 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 506caf6794..8e6569c069 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -979,7 +979,7 @@
},
"evdev": {
"label": "evdev",
- "condition": "tests.evdev",
+ "condition": "features.thread && tests.evdev",
"output": [ "privateFeature" ]
},
"freetype": {
@@ -1170,7 +1170,7 @@
},
"egl_x11": {
"label": "EGL on X11",
- "condition": "features.egl && tests.egl-x11",
+ "condition": "features.thread && features.egl && tests.egl-x11",
"output": [ "privateFeature" ]
},
"eglfs": {
@@ -1300,7 +1300,7 @@
"section": "Platform plugins",
"autoDetect": "!config.darwin",
"enable": "input.xcb == 'system' || input.xcb == 'qt' || input.xcb == 'yes'",
- "condition": "libs.xcb",
+ "condition": "features.thread && libs.xcb",
"output": [ "privateFeature" ]
},
"system-xcb": {
diff --git a/src/gui/doc/snippets/draganddrop/dragwidget.h b/src/gui/doc/snippets/draganddrop/dragwidget.h
index 424c0b334b..709f9338bf 100644
--- a/src/gui/doc/snippets/draganddrop/dragwidget.h
+++ b/src/gui/doc/snippets/draganddrop/dragwidget.h
@@ -74,10 +74,10 @@ signals:
void mimeTypes(const QStringList &types);
protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private:
QByteArray data;
diff --git a/src/gui/doc/snippets/dragging/mainwindow.h b/src/gui/doc/snippets/dragging/mainwindow.h
index 5e796d530f..8a8e43b223 100644
--- a/src/gui/doc/snippets/dragging/mainwindow.h
+++ b/src/gui/doc/snippets/dragging/mainwindow.h
@@ -68,7 +68,7 @@ public:
MainWindow(QWidget *parent = 0);
protected:
- void mousePressEvent(QMouseEvent *event);
+ void mousePressEvent(QMouseEvent *event) override;
private:
QLabel *iconLabel;
diff --git a/src/gui/doc/snippets/dropevents/window.h b/src/gui/doc/snippets/dropevents/window.h
index 17c323b952..6ac35181ed 100644
--- a/src/gui/doc/snippets/dropevents/window.h
+++ b/src/gui/doc/snippets/dropevents/window.h
@@ -67,8 +67,8 @@ public:
Window(QWidget *parent = 0);
protected:
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
+ void dragEnterEvent(QDragEnterEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
private:
QComboBox *mimeTypeCombo;
diff --git a/src/gui/doc/snippets/droprectangle/window.h b/src/gui/doc/snippets/droprectangle/window.h
index 683e5cb813..5a9ef75d3b 100644
--- a/src/gui/doc/snippets/droprectangle/window.h
+++ b/src/gui/doc/snippets/droprectangle/window.h
@@ -67,8 +67,8 @@ public:
Window(QWidget *parent = 0);
protected:
- void dragMoveEvent(QDragMoveEvent *event);
- void dropEvent(QDropEvent *event);
+ void dragMoveEvent(QDragMoveEvent *event) override;
+ void dropEvent(QDropEvent *event) override;
private:
QComboBox *mimeTypeCombo;
diff --git a/src/gui/doc/snippets/matrix/matrix.cpp b/src/gui/doc/snippets/matrix/matrix.cpp
index ec9e130a29..115dc3d508 100644
--- a/src/gui/doc/snippets/matrix/matrix.cpp
+++ b/src/gui/doc/snippets/matrix/matrix.cpp
@@ -53,7 +53,7 @@
class SimpleTransformation : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [0]
@@ -73,7 +73,7 @@ void SimpleTransformation::paintEvent(QPaintEvent *)
class CombinedTransformation : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [1]
@@ -97,7 +97,7 @@ void CombinedTransformation::paintEvent(QPaintEvent *)
class BasicOperations : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [2]
diff --git a/src/gui/doc/snippets/plaintextlayout/window.h b/src/gui/doc/snippets/plaintextlayout/window.h
index 0068a37482..8552ecd4ba 100644
--- a/src/gui/doc/snippets/plaintextlayout/window.h
+++ b/src/gui/doc/snippets/plaintextlayout/window.h
@@ -61,7 +61,7 @@ public:
Window(QWidget *parent = 0);
protected:
- void paintEvent(QPaintEvent *event);
+ void paintEvent(QPaintEvent *event) override;
private:
QFont font;
diff --git a/src/gui/doc/snippets/qfileopenevent/main.cpp b/src/gui/doc/snippets/qfileopenevent/main.cpp
index 3e707f2ddf..f18e763bbc 100644
--- a/src/gui/doc/snippets/qfileopenevent/main.cpp
+++ b/src/gui/doc/snippets/qfileopenevent/main.cpp
@@ -61,7 +61,7 @@ public:
{
}
- bool event(QEvent *event)
+ bool event(QEvent *event) override
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
diff --git a/src/gui/doc/snippets/separations/finalwidget.h b/src/gui/doc/snippets/separations/finalwidget.h
index 0301f68fe9..886a5dfaf3 100644
--- a/src/gui/doc/snippets/separations/finalwidget.h
+++ b/src/gui/doc/snippets/separations/finalwidget.h
@@ -71,8 +71,8 @@ public:
const QPixmap *pixmap() const;
protected:
- void mouseMoveEvent(QMouseEvent *event);
- void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
private:
void createImage();
diff --git a/src/gui/doc/snippets/textdocument-imagedrop/textedit.h b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
index 9f73bceeaf..3f570884ba 100644
--- a/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
+++ b/src/gui/doc/snippets/textdocument-imagedrop/textedit.h
@@ -59,8 +59,8 @@ class TextEdit : public QTextEdit
public:
TextEdit(QWidget *parent=0);
- bool canInsertFromMimeData( const QMimeData *source ) const;
- void insertFromMimeData( const QMimeData *source );
+ bool canInsertFromMimeData( const QMimeData *source ) const override;
+ void insertFromMimeData( const QMimeData *source ) override;
};
#endif
diff --git a/src/gui/doc/snippets/transform/main.cpp b/src/gui/doc/snippets/transform/main.cpp
index e096eee7fc..e30a3b63bf 100644
--- a/src/gui/doc/snippets/transform/main.cpp
+++ b/src/gui/doc/snippets/transform/main.cpp
@@ -53,7 +53,7 @@
class SimpleTransformation : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [0]
@@ -73,7 +73,7 @@ void SimpleTransformation::paintEvent(QPaintEvent *)
class CombinedTransformation : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [1]
@@ -97,7 +97,7 @@ void CombinedTransformation::paintEvent(QPaintEvent *)
class BasicOperations : public QWidget
{
- void paintEvent(QPaintEvent *);
+ void paintEvent(QPaintEvent *) override;
};
//! [2]
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index dd21ade2fd..e1f66dceee 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -540,11 +540,12 @@ static bool convert_RGBA_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFl
return true;
}
-template<QtPixelOrder PixelOrder>
+template<QtPixelOrder PixelOrder, bool RGBA>
static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
- Q_ASSERT(src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32);
+ Q_ASSERT(RGBA || src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32);
+ Q_ASSERT(!RGBA || src->format == QImage::Format_RGBX8888 || src->format == QImage::Format_RGBA8888);
Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_RGB30);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
@@ -557,7 +558,10 @@ static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::Im
for (int i = 0; i < src->height; ++i) {
const quint32 *end = src_data + src->width;
while (src_data < end) {
- *dest_data = qConvertRgb32ToRgb30<PixelOrder>(*src_data);
+ QRgb c = *src_data;
+ if (RGBA)
+ c = RGBA2ARGB(c);
+ *dest_data = qConvertRgb32ToRgb30<PixelOrder>(c);
++src_data;
++dest_data;
}
@@ -566,10 +570,11 @@ static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::Im
}
}
-template<QtPixelOrder PixelOrder>
+template<QtPixelOrder PixelOrder, bool RGBA>
static bool convert_RGB_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags)
{
- Q_ASSERT(data->format == QImage::Format_RGB32 || data->format == QImage::Format_ARGB32);
+ Q_ASSERT(RGBA || (data->format == QImage::Format_RGB32 || data->format == QImage::Format_ARGB32));
+ Q_ASSERT(!RGBA || (data->format == QImage::Format_RGBX8888 || data->format == QImage::Format_RGBA8888));
const int pad = (data->bytes_per_line >> 2) - data->width;
QRgb *rgb_data = (QRgb *) data->data;
@@ -577,7 +582,10 @@ static bool convert_RGB_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFl
for (int i = 0; i < data->height; ++i) {
const QRgb *end = rgb_data + data->width;
while (rgb_data < end) {
- *rgb_data = qConvertRgb32ToRgb30<PixelOrder>(*rgb_data);
+ QRgb c = *rgb_data;
+ if (RGBA)
+ c = RGBA2ARGB(c);
+ *rgb_data = qConvertRgb32ToRgb30<PixelOrder>(c);
++rgb_data;
}
rgb_data += pad;
@@ -738,11 +746,11 @@ static bool convert_BGR30_to_A2RGB30_inplace(QImageData *data, Qt::ImageConversi
return true;
}
-template<QtPixelOrder PixelOrder>
+template<QtPixelOrder PixelOrder, bool RGBA>
static void convert_A2RGB30_PM_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags)
{
Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied);
- Q_ASSERT(dest->format == QImage::Format_ARGB32);
+ Q_ASSERT(RGBA ? dest->format == QImage::Format_RGBA8888 : dest->format == QImage::Format_ARGB32);
Q_ASSERT(src->width == dest->width);
Q_ASSERT(src->height == dest->height);
@@ -755,6 +763,8 @@ static void convert_A2RGB30_PM_to_ARGB(QImageData *dest, const QImageData *src,
const quint32 *end = src_data + src->width;
while (src_data < end) {
*dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*src_data));
+ if (RGBA)
+ *dest_data = ARGB2RGBA(*dest_data);
++src_data;
++dest_data;
}
@@ -763,7 +773,7 @@ static void convert_A2RGB30_PM_to_ARGB(QImageData *dest, const QImageData *src,
}
}
-template<QtPixelOrder PixelOrder>
+template<QtPixelOrder PixelOrder, bool RGBA>
static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConversionFlags)
{
Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied);
@@ -775,11 +785,16 @@ static bool convert_A2RGB30_PM_to_ARGB_inplace(QImageData *data, Qt::ImageConver
const uint *end = rgb_data + data->width;
while (rgb_data < end) {
*rgb_data = qConvertA2rgb30ToArgb32<PixelOrder>(qUnpremultiplyRgb30(*rgb_data));
+ if (RGBA)
+ *rgb_data = ARGB2RGBA(*rgb_data);
++rgb_data;
}
rgb_data += pad;
}
- data->format = QImage::Format_ARGB32;
+ if (RGBA)
+ data->format = QImage::Format_RGBA8888;
+ else
+ data->format = QImage::Format_ARGB32;
return true;
}
@@ -2354,9 +2369,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
0,
0,
- convert_RGB_to_RGB30<PixelOrderBGR>,
+ convert_RGB_to_RGB30<PixelOrderBGR, false>,
0,
- convert_RGB_to_RGB30<PixelOrderRGB>,
+ convert_RGB_to_RGB30<PixelOrderRGB, false>,
0,
0, 0,
0, 0, 0
@@ -2382,9 +2397,9 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
convert_ARGB_to_RGBx,
convert_ARGB_to_RGBA,
0,
- convert_RGB_to_RGB30<PixelOrderBGR>,
+ convert_RGB_to_RGB30<PixelOrderBGR, false>,
0,
- convert_RGB_to_RGB30<PixelOrderRGB>,
+ convert_RGB_to_RGB30<PixelOrderRGB, false>,
0,
0, 0,
0,
@@ -2634,7 +2649,10 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
convert_passthrough,
convert_passthrough,
- 0, 0, 0, 0,
+ convert_RGB_to_RGB30<PixelOrderBGR, true>,
+ 0,
+ convert_RGB_to_RGB30<PixelOrderRGB, true>,
+ 0,
0, 0,
0, 0, 0
}, // Format_RGBX8888
@@ -2658,7 +2676,11 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
mask_alpha_converter_RGBx,
0,
0,
- 0, 0, 0, 0, 0, 0,
+ convert_RGB_to_RGB30<PixelOrderBGR, true>,
+ 0,
+ convert_RGB_to_RGB30<PixelOrderRGB, true>,
+ 0,
+ 0, 0,
0,
convert_ARGB32_to_RGBA64<true>,
0
@@ -2719,8 +2741,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
0,
0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderBGR>,
- 0,
+ convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, false>,
0,
0,
0,
@@ -2732,6 +2753,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
0,
0,
+ convert_A2RGB30_PM_to_ARGB<PixelOrderBGR, true>,
0,
convert_A2RGB30_PM_to_RGB30<false>,
0,
@@ -2772,8 +2794,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
0,
0,
- convert_A2RGB30_PM_to_ARGB<PixelOrderRGB>,
- 0,
+ convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, false>,
0,
0,
0,
@@ -2785,6 +2806,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
0,
0,
0,
+ convert_A2RGB30_PM_to_ARGB<PixelOrderRGB, true>,
0,
convert_A2RGB30_PM_to_RGB30<true>,
convert_BGR30_to_RGB30,
@@ -2951,9 +2973,9 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
- convert_RGB_to_RGB30_inplace<PixelOrderBGR>,
+ convert_RGB_to_RGB30_inplace<PixelOrderBGR, false>,
0,
- convert_RGB_to_RGB30_inplace<PixelOrderRGB>,
+ convert_RGB_to_RGB30_inplace<PixelOrderRGB, false>,
0,
0, 0,
0, 0, 0
@@ -2978,9 +3000,9 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
convert_ARGB_to_RGBA_inplace<QImage::Format_RGBX8888>,
convert_ARGB_to_RGBA_inplace<QImage::Format_RGBA8888>,
0,
- convert_RGB_to_RGB30_inplace<PixelOrderBGR>,
+ convert_RGB_to_RGB30_inplace<PixelOrderBGR, false>,
0,
- convert_RGB_to_RGB30_inplace<PixelOrderRGB>,
+ convert_RGB_to_RGB30_inplace<PixelOrderRGB, false>,
0,
0, 0,
0, 0, 0
@@ -3056,7 +3078,12 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
convert_passthrough_inplace<QImage::Format_RGBA8888>,
convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>,
- 0, 0, 0, 0, 0, 0, 0, 0, 0
+ convert_RGB_to_RGB30_inplace<PixelOrderBGR, true>,
+ 0,
+ convert_RGB_to_RGB30_inplace<PixelOrderRGB, true>,
+ 0,
+ 0, 0,
+ 0, 0, 0
}, // Format_RGBX8888
{
0,
@@ -3078,7 +3105,12 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
mask_alpha_converter_rgbx_inplace,
0,
0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0
+ convert_RGB_to_RGB30_inplace<PixelOrderBGR, true>,
+ 0,
+ convert_RGB_to_RGB30_inplace<PixelOrderRGB, true>,
+ 0,
+ 0, 0,
+ 0, 0, 0
}, // Format_RGBA8888
{
0,
@@ -3135,8 +3167,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR>,
- 0,
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, false>,
0,
0,
0,
@@ -3148,6 +3179,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderBGR, true>,
0,
convert_A2RGB30_PM_to_RGB30_inplace<false>,
0, // self
@@ -3187,8 +3219,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
- convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB>,
- 0,
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, false>,
0,
0,
0,
@@ -3200,6 +3231,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
0,
0,
0,
+ convert_A2RGB30_PM_to_ARGB_inplace<PixelOrderRGB, true>,
0,
convert_A2RGB30_PM_to_RGB30_inplace<true>,
convert_BGR30_to_RGB30_inplace,
diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp
index 235bc5bd7d..a771bffa2f 100644
--- a/src/gui/itemmodels/qstandarditemmodel.cpp
+++ b/src/gui/itemmodels/qstandarditemmodel.cpp
@@ -931,6 +931,21 @@ void QStandardItem::setData(const QVariant &value, int role)
}
/*!
+ \since 5.12
+ Removes all the data from all roles previously set.
+ \sa data(), setData()
+*/
+void QStandardItem::clearData()
+{
+ Q_D(QStandardItem);
+ if (d->values.isEmpty())
+ return;
+ d->values.clear();
+ if (d->model)
+ d->model->d_func()->itemChanged(this, QVector<int>{});
+}
+
+/*!
Returns the item's data for the given \a role, or an invalid
QVariant if there is no data for the role.
@@ -2991,6 +3006,23 @@ bool QStandardItemModel::setData(const QModelIndex &index, const QVariant &value
}
/*!
+ \since 5.12
+ Removes the data stored in all the roles for the given \a index.
+ \sa setData(), data()
+*/
+bool QStandardItemModel::clearItemData(const QModelIndex &index)
+{
+ if (!checkIndex(index, CheckIndexOption::IndexIsValid))
+ return false;
+ Q_D(QStandardItemModel);
+ QStandardItem *item = d->itemFromIndex(index);
+ if (!item)
+ return false;
+ item->clearData();
+ return true;
+}
+
+/*!
\reimp
*/
bool QStandardItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant &value, int role)
diff --git a/src/gui/itemmodels/qstandarditemmodel.h b/src/gui/itemmodels/qstandarditemmodel.h
index 827179b31d..a9ee25da75 100644
--- a/src/gui/itemmodels/qstandarditemmodel.h
+++ b/src/gui/itemmodels/qstandarditemmodel.h
@@ -69,6 +69,7 @@ public:
virtual QVariant data(int role = Qt::UserRole + 1) const;
virtual void setData(const QVariant &value, int role = Qt::UserRole + 1);
+ void clearData();
inline QString text() const {
return qvariant_cast<QString>(data(Qt::DisplayRole));
@@ -343,6 +344,8 @@ public:
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+ // Qt 6: add override keyword
+ bool clearItemData(const QModelIndex &index);
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const override;
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 2362b93bf0..f5527354a2 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -783,7 +783,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, int delta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), qt4D(delta), qt4O(orient), mouseState(buttons),
- ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase)
{
g = QCursor::pos();
if (orient == Qt::Vertical)
@@ -818,7 +818,7 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos, int delta
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers,
Qt::Orientation orient)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), qt4D(delta), qt4O(orient), mouseState(buttons),
- ph(Qt::NoScrollPhase), src(Qt::MouseEventNotSynthesized), invertedScrolling(false)
+ src(Qt::MouseEventNotSynthesized), invertedScrolling(false), ph(Qt::NoScrollPhase)
{
if (orient == Qt::Vertical)
angleD = QPoint(0, delta);
@@ -959,8 +959,8 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QPoint pixelDelta, QPoint angleDelta, int qt4Delta, Qt::Orientation qt4Orientation,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, Qt::MouseEventSource source, bool inverted)
: QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), ph(phase), src(source),
- invertedScrolling(inverted)
+ angleD(angleDelta), qt4D(qt4Delta), qt4O(qt4Orientation), mouseState(buttons), src(source),
+ invertedScrolling(inverted), ph(phase)
{}
/*!
@@ -995,10 +995,12 @@ QWheelEvent::QWheelEvent(const QPointF &pos, const QPointF& globalPos,
QWheelEvent::QWheelEvent(QPointF pos, QPointF globalPos, QPoint pixelDelta, QPoint angleDelta,
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase,
bool inverted, Qt::MouseEventSource source)
- : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta),
- angleD(angleDelta), mouseState(buttons), ph(phase), src(source),
- invertedScrolling(inverted)
-{}
+ : QInputEvent(Wheel, modifiers), p(pos), g(globalPos), pixelD(pixelDelta), angleD(angleDelta),
+ qt4O(qAbs(angleDelta.x()) > qAbs(angleDelta.y()) ? Qt::Horizontal : Qt::Vertical),
+ mouseState(buttons), src(source), invertedScrolling(inverted), ph(phase)
+{
+ qt4D = (qt4O == Qt::Horizontal ? angleDelta.x() : angleDelta.y());
+}
#endif // QT_CONFIG(wheelevent)
@@ -4068,7 +4070,12 @@ QDebug operator<<(QDebug dbg, const QEvent *e)
# if QT_CONFIG(wheelevent)
case QEvent::Wheel: {
const QWheelEvent *we = static_cast<const QWheelEvent *>(e);
- dbg << "QWheelEvent(" << "pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta() << ')';
+ dbg << "QWheelEvent(" << we->phase();
+ if (!we->pixelDelta().isNull() || !we->angleDelta().isNull())
+ dbg << ", pixelDelta=" << we->pixelDelta() << ", angleDelta=" << we->angleDelta();
+ else if (int qt4Delta = we->delta())
+ dbg << ", delta=" << qt4Delta << ", orientation=" << we->orientation();
+ dbg << ')';
}
break;
# endif // QT_CONFIG(wheelevent)
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 8d2f225809..2b1c6a6e31 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -232,10 +232,11 @@ protected:
int qt4D = 0;
Qt::Orientation qt4O = Qt::Vertical;
Qt::MouseButtons mouseState;
- uint ph : 2;
+ uint _unused_ : 2; // Kept for binary compatibility
uint src: 2;
bool invertedScrolling : 1;
- int reserved : 27;
+ uint ph : 3;
+ int reserved : 24;
friend class QApplication;
};
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 9a9677b476..a428da8ca4 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1062,6 +1062,8 @@ int QKeySequence::decodeString(const QString &str)
int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceFormat format)
{
+ Q_ASSERT(!accel.isEmpty());
+
int ret = 0;
accel = std::move(accel).toLower();
bool nativeText = (format == QKeySequence::NativeText);
@@ -1121,7 +1123,10 @@ int QKeySequencePrivate::decodeString(QString accel, QKeySequence::SequenceForma
sl = accel;
}
}
+ if (accel.isEmpty()) // Incomplete, like for "Meta+Shift+"
+ return Qt::Key_unknown;
#endif
+
int i = 0;
int lastI = 0;
while ((i = sl.indexOf(QLatin1Char('+'), i + 1)) != -1) {
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index a49599b4d1..7bf941b9a1 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -945,7 +945,7 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
Avoid calling this function from a different thread than the one the
QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a
- different thread you should first call make sure it's not current in the
+ different thread you should first make sure it's not current in the
current thread, by calling doneCurrent() if necessary. Then call
moveToThread(otherThread) before using it in the other thread.
diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
index 2afb5e6ba5..924266997d 100644
--- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
+++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
@@ -57,24 +57,28 @@
QT_BEGIN_NAMESPACE
/*!
- Convenience function to both lock and bind the buffer to a texture. This
- function will first try and lock with texture read and texture write
+ Convenience function to both lock and bind the \a graphicsBuffer to a texture.
+ This function will first try to lock with texture read and texture write
access. If this succeeds it will use the bindToTexture function to bind the
- content to the currently bound texture. If this fail it will try and lock
- with SWReadAccess and then use the bindSWToTexture convenience function.
+ content to the currently bound texture, and if \a premultiplied is provided,
+ it is set to false.
- \a swizzle is suppose to be used by the caller to figure out if the Red and
+ If it fails, it will try to lock with SWReadAccess and then use the
+ bindSWToTexture convenience function. If \a premultiplied is provided, it is
+ passed to the bindSWToTexture() function.
+
+ \a swizzle is meant to be used by the caller to figure out if the Red and
Blue color channels need to be swizzled when rendering.
\a rect is the subrect which is desired to be bounded to the texture. This
- argument has a no less than semantic, meaning more (if not all) of the buffer
+ argument has a not less than semantic, meaning more (if not all) of the buffer
can be bounded to the texture. An empty QRect is interpreted as entire buffer
should be bound.
The user should use the AccessTypes returned by isLocked to figure out what
lock has been obtained.
- returns true if the buffer has successfully been bound to the currently
+ Returns true if the buffer has successfully been bound to the currently
bound texture, otherwise returns false.
*/
bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer,
@@ -103,26 +107,29 @@ bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer
}
/*!
- Convenience function that uploads the current raster content to the currently bound texture.
+ Convenience function that uploads the current raster content to the currently
+ bound texture.
- \a swizzleRandB is suppose to be used by the caller to figure out if the Red and
+ \a swizzleRandB is meant to be used by the caller to decide if the Red and
Blue color channels need to be swizzled when rendering. This is an
optimization. Qt often renders to software buffers interpreting pixels as
unsigned ints. When these buffers are uploaded to textures and each color
channel per pixel is interpreted as a byte (read sequentially), then the
- Red and Blue channels are swapped. Conveniently the Alpha buffer will be
- correct since Qt historically has had the alpha channel as the first
+ Red and Blue channels are swapped. Conveniently, the Alpha buffer will be
+ correct, since Qt historically has had the alpha channel as the first
channel, while OpenGL typically expects the alpha channel to be the last
channel.
- \a subRect is the subrect which is desired to be bounded to the texture. This
- argument has a no less than semantic, meaning more (if not all) of the buffer
- can be bounded to the texture. An empty QRect is interpreted as entire buffer
- should be bound.
+ \a subRect is the region to be bound to the texture. This argument has a
+ not less than semantic, meaning more (if not all) of the buffer can be
+ bound to the texture. An empty QRect is interpreted as meaning the entire
+ buffer should be bound.
- This function fails for buffers not capable of locking to SWAccess.
+ This function fails if the \a graphicsBuffer is not locked to SWAccess.
- Returns true on success, otherwise false.
+ Returns true on success, otherwise false. If \a premultipliedB is
+ provided, it is set according to what happens, if the function returns
+ true.
*/
bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer,
bool *swizzleRandB, bool *premultipliedB,
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 400888cc21..6486a447ee 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -55,12 +55,16 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG
#define QT_RESET_GLERROR() \
{ \
- while (QOpenGLContext::currentContext()->functions()->glGetError() != GL_NO_ERROR) {} \
+ while (true) {\
+ GLenum error = QOpenGLContext::currentContext()->functions()->glGetError(); \
+ if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) \
+ break; \
+ } \
}
#define QT_CHECK_GLERROR() \
{ \
GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
- if (err != GL_NO_ERROR) { \
+ if (err != GL_NO_ERROR && err != GL_CONTEXT_LOST) { \
qDebug("[%s line %d] OpenGL Error: %d", \
__FILE__, __LINE__, (int)err); \
} \
@@ -134,6 +138,10 @@ QT_BEGIN_NAMESPACE
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
#endif
+#ifndef GL_CONTEXT_LOST
+#define GL_CONTEXT_LOST 0x0507
+#endif
+
/*!
@@ -1327,8 +1335,11 @@ static QImage qt_gl_read_framebuffer(const QSize &size, GLenum internal_format,
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
QOpenGLFunctions *funcs = ctx->functions();
- while (funcs->glGetError());
-
+ while (true) {
+ GLenum error = funcs->glGetError();
+ if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
+ break;
+ }
switch (internal_format) {
case GL_RGB:
case GL_RGB8:
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index f7462b65c8..580a09427c 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2703,18 +2703,6 @@ static const int slow_timeout = 300000; // 5m
const uint QFontCache::min_cost = 4*1024; // 4mb
-#ifdef QT_NO_THREAD
-Q_GLOBAL_STATIC(QFontCache, theFontCache)
-
-QFontCache *QFontCache::instance()
-{
- return theFontCache();
-}
-
-void QFontCache::cleanup()
-{
-}
-#else
Q_GLOBAL_STATIC(QThreadStorage<QFontCache *>, theFontCache)
QFontCache *QFontCache::instance()
@@ -2736,7 +2724,6 @@ void QFontCache::cleanup()
if (cache && cache->hasLocalData())
cache->setLocalData(0);
}
-#endif // QT_NO_THREAD
QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(1);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 2d1f0fa823..6826f62b61 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -597,7 +597,13 @@ struct QBidiAlgorithm {
} else if (current == QChar::DirBN) {
current = last;
} else {
- Q_ASSERT(current != QChar::DirLRE && current != QChar::DirRLE && current != QChar::DirLRO && current != QChar::DirRLO && current != QChar::DirPDF); // there shouldn't be any explicit embedding marks here
+ // there shouldn't be any explicit embedding marks here
+ Q_ASSERT(current != QChar::DirLRE);
+ Q_ASSERT(current != QChar::DirRLE);
+ Q_ASSERT(current != QChar::DirLRO);
+ Q_ASSERT(current != QChar::DirRLO);
+ Q_ASSERT(current != QChar::DirPDF);
+
last = current;
}
@@ -2053,7 +2059,7 @@ void QTextEngine::itemize() const
layoutData->string.detach();
string = reinterpret_cast<const ushort *>(layoutData->string.unicode());
uc = string + offset;
- e = uc + length;
+ e = string + length;
*const_cast<ushort*>(uc) = 0x21B5; // visual line separator
}
break;
diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp
index ae4f56a12e..2237b016e9 100644
--- a/src/gui/util/qvalidator.cpp
+++ b/src/gui/util/qvalidator.cpp
@@ -1079,7 +1079,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr
if (origRe != re) {
usedRe = origRe = re; // copies also the pattern options
- usedRe.setPattern(QLatin1String("\\A(?:") + re.pattern() + QLatin1String(")\\z"));
+ usedRe.setPattern(QRegularExpression::anchoredPattern(re.pattern()));
emit q->regularExpressionChanged(re);
emit q->changed();
}