From b1ef104866f78ae5bbc1214ae524bad4120ef0e2 Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Wed, 31 Oct 2018 09:18:14 +0200 Subject: [PATCH 01/17] Blacklist tst_QWindow::exposeEventOnShrink_QTBUG54040 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ib87d2820c4dbdf93778997b6df11cc7d8e63cf04 Reviewed-by: Tony Sarajärvi --- tests/auto/gui/kernel/qwindow/BLACKLIST | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/auto/gui/kernel/qwindow/BLACKLIST b/tests/auto/gui/kernel/qwindow/BLACKLIST index e9a0d44ba7..f54865b841 100644 --- a/tests/auto/gui/kernel/qwindow/BLACKLIST +++ b/tests/auto/gui/kernel/qwindow/BLACKLIST @@ -40,6 +40,7 @@ android [exposeEventOnShrink_QTBUG54040] # QTBUG-69155 android +opensuse [initialSize] # QTBUG-69159 android From 7aad54262927da7f0223ed9ba970e8bba9f4900d Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Wed, 31 Oct 2018 19:50:29 +0300 Subject: [PATCH 02/17] Notepad example: Get rid of auto-connection slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Their correctness is not checked at compile time and even object renames can break code. Change-Id: I99273a28743a79a76c00e6db0ed4cd6d7eba8bf2 Reviewed-by: Topi Reiniö --- .../widgets/tutorials/gettingstartedqt.qdoc | 14 ++--- .../widgets/tutorials/notepad/notepad.cpp | 57 ++++++++++++------- examples/widgets/tutorials/notepad/notepad.h | 32 +++++------ 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/examples/widgets/tutorials/gettingstartedqt.qdoc b/examples/widgets/tutorials/gettingstartedqt.qdoc index bbe1dd1a8d..32e8845c05 100644 --- a/examples/widgets/tutorials/gettingstartedqt.qdoc +++ b/examples/widgets/tutorials/gettingstartedqt.qdoc @@ -390,10 +390,10 @@ action concerned. When the QAction has been dragged to the toolbar, clicking the icon will launch the associated slot. - Complete the method \c on_actionNew_triggered(): + Complete the method \c newDocument(): \quotefromfile tutorials/notepad/notepad.cpp - \skipto on_actionNew_triggered() + \skipto newDocument() \printuntil } \c current_file is a global variable containing the file presently @@ -411,10 +411,10 @@ In \c notepad.ui, right click on \c actionOpen and select \c {Go to slot} - Complete method \c on_actionOpen_triggered(). + Complete method \c open(). \quotefromfile tutorials/notepad/notepad.cpp - \skipto on_actionOpen_triggered() + \skipto open() \printuntil file.close \printuntil } @@ -436,7 +436,7 @@ \l {Opening a file}, by right clicking on \c actionSave, and selecting \c {Go to Slot}. - \skipto Notepad::on_actionSave_triggered + \skipto Notepad::save \printuntil file.close \printuntil } @@ -449,7 +449,7 @@ \section2 Saving a file with \c {Save as} - \skipto Notepad::on_actionSave_as_triggered + \skipto Notepad::saveAs \printuntil file.close \printuntil } @@ -475,7 +475,7 @@ \section2 Select a Font - \skipto Notepad::on_actionFont_triggered + \skipto Notepad::selectFont \printuntil ui->textEdit->setFont \printline } diff --git a/examples/widgets/tutorials/notepad/notepad.cpp b/examples/widgets/tutorials/notepad/notepad.cpp index d0e600e852..2ccd6501a1 100644 --- a/examples/widgets/tutorials/notepad/notepad.cpp +++ b/examples/widgets/tutorials/notepad/notepad.cpp @@ -74,6 +74,23 @@ Notepad::Notepad(QWidget *parent) : ui->setupUi(this); this->setCentralWidget(ui->textEdit); + connect(ui->actionNew, &QAction::triggered, this, &Notepad::newDocument); + connect(ui->actionOpen, &QAction::triggered, this, &Notepad::open); + connect(ui->actionSave, &QAction::triggered, this, &Notepad::save); + connect(ui->actionSave_as, &QAction::triggered, this, &Notepad::saveAs); + connect(ui->actionPrint, &QAction::triggered, this, &Notepad::print); + connect(ui->actionExit, &QAction::triggered, this, &Notepad::exit); + connect(ui->actionCopy, &QAction::triggered, this, &Notepad::copy); + connect(ui->actionCut, &QAction::triggered, this, &Notepad::cut); + connect(ui->actionPaste, &QAction::triggered, this, &Notepad::paste); + connect(ui->actionUndo, &QAction::triggered, this, &Notepad::undo); + connect(ui->actionRedo, &QAction::triggered, this, &Notepad::redo); + connect(ui->actionFont, &QAction::triggered, this, &Notepad::selectFont); + connect(ui->actionBold, &QAction::triggered, this, &Notepad::setFontBold); + connect(ui->actionUnderline, &QAction::triggered, this, &Notepad::setFontUnderline); + connect(ui->actionItalic, &QAction::triggered, this, &Notepad::setFontItalic); + connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about); + // Disable menu actions for unavailable features #if !QT_CONFIG(printer) ui->actionPrint->setEnabled(false); @@ -91,13 +108,13 @@ Notepad::~Notepad() delete ui; } -void Notepad::on_actionNew_triggered() +void Notepad::newDocument() { currentFile.clear(); ui->textEdit->setText(QString()); } -void Notepad::on_actionOpen_triggered() +void Notepad::open() { QString fileName = QFileDialog::getOpenFileName(this, "Open the file"); QFile file(fileName); @@ -113,7 +130,7 @@ void Notepad::on_actionOpen_triggered() file.close(); } -void Notepad::on_actionSave_triggered() +void Notepad::save() { QString fileName; // If we don't have a filename from before, get one. @@ -135,7 +152,7 @@ void Notepad::on_actionSave_triggered() file.close(); } -void Notepad::on_actionSave_as_triggered() +void Notepad::saveAs() { QString fileName = QFileDialog::getSaveFileName(this, "Save as"); QFile file(fileName); @@ -152,7 +169,7 @@ void Notepad::on_actionSave_as_triggered() file.close(); } -void Notepad::on_actionPrint_triggered() +void Notepad::print() { #if QT_CONFIG(printer) QPrinter printDev; @@ -165,43 +182,43 @@ void Notepad::on_actionPrint_triggered() #endif // QT_CONFIG(printer) } -void Notepad::on_actionExit_triggered() +void Notepad::exit() { QCoreApplication::quit(); } -void Notepad::on_actionCopy_triggered() +void Notepad::copy() { #if QT_CONFIG(clipboard) ui->textEdit->copy(); #endif } -void Notepad::on_actionCut_triggered() +void Notepad::cut() { #if QT_CONFIG(clipboard) ui->textEdit->cut(); #endif } -void Notepad::on_actionPaste_triggered() +void Notepad::paste() { #if QT_CONFIG(clipboard) ui->textEdit->paste(); #endif } -void Notepad::on_actionUndo_triggered() +void Notepad::undo() { ui->textEdit->undo(); } -void Notepad::on_actionRedo_triggered() +void Notepad::redo() { ui->textEdit->redo(); } -void Notepad::on_actionFont_triggered() +void Notepad::selectFont() { bool fontSelected; QFont font = QFontDialog::getFont(&fontSelected, this); @@ -209,23 +226,23 @@ void Notepad::on_actionFont_triggered() ui->textEdit->setFont(font); } -void Notepad::on_actionUnderline_triggered() +void Notepad::setFontUnderline(bool underline) { - ui->textEdit->setFontUnderline(ui->actionUnderline->isChecked()); + ui->textEdit->setFontUnderline(underline); } -void Notepad::on_actionItalic_triggered() +void Notepad::setFontItalic(bool italic) { - ui->textEdit->setFontItalic(ui->actionItalic->isChecked()); + ui->textEdit->setFontItalic(italic); } -void Notepad::on_actionBold_triggered() +void Notepad::setFontBold(bool bold) { - ui->actionBold->isChecked() ? ui->textEdit->setFontWeight(QFont::Bold) : - ui->textEdit->setFontWeight(QFont::Normal); + bold ? ui->textEdit->setFontWeight(QFont::Bold) : + ui->textEdit->setFontWeight(QFont::Normal); } -void Notepad::on_actionAbout_triggered() +void Notepad::about() { QMessageBox::about(this, tr("About MDI"), tr("The Notepad example demonstrates how to code a basic " diff --git a/examples/widgets/tutorials/notepad/notepad.h b/examples/widgets/tutorials/notepad/notepad.h index 288ab4e373..9580ab8071 100644 --- a/examples/widgets/tutorials/notepad/notepad.h +++ b/examples/widgets/tutorials/notepad/notepad.h @@ -79,37 +79,37 @@ public: //! [5] private slots: - void on_actionNew_triggered(); + void newDocument(); - void on_actionOpen_triggered(); + void open(); - void on_actionSave_triggered(); + void save(); - void on_actionSave_as_triggered(); + void saveAs(); - void on_actionPrint_triggered(); + void print(); - void on_actionExit_triggered(); + void exit(); - void on_actionCopy_triggered(); + void copy(); - void on_actionCut_triggered(); + void cut(); - void on_actionPaste_triggered(); + void paste(); - void on_actionUndo_triggered(); + void undo(); - void on_actionRedo_triggered(); + void redo(); - void on_actionFont_triggered(); + void selectFont(); - void on_actionBold_triggered(); + void setFontBold(bool bold); - void on_actionUnderline_triggered(); + void setFontUnderline(bool underline); - void on_actionItalic_triggered(); + void setFontItalic(bool italic); - void on_actionAbout_triggered(); + void about(); //! [6] private: From ae0843eca0e7102390ceec43236cfe8c5724d278 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 25 Oct 2018 13:48:34 +0200 Subject: [PATCH 03/17] Tablet example: Fix warning about switch/fallthrough Add Q_FALLTHROUGH(), fixing: tabletcanvas.cpp:222:55: warning: this statement may fall through [-Wimplicit-fallthrough=] Change-Id: I573f4add56774218e28a7c5f1dac09c5402333c0 Reviewed-by: Shawn Rutledge --- examples/widgets/widgets/tablet/tabletcanvas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/widgets/widgets/tablet/tabletcanvas.cpp b/examples/widgets/widgets/tablet/tabletcanvas.cpp index bfcc84e182..dc56702142 100644 --- a/examples/widgets/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/widgets/tablet/tabletcanvas.cpp @@ -224,7 +224,7 @@ void TabletCanvas::paintPixmap(QPainter &painter, QTabletEvent *event) qWarning() << error; #endif } - // FALL-THROUGH + Q_FALLTHROUGH(); case QTabletEvent::Stylus: painter.setPen(m_pen); painter.drawLine(lastPoint.pos, event->posF()); From d28c241ca1451812fafc0c761587abfa44405914 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Thu, 9 Aug 2018 14:08:04 +0200 Subject: [PATCH 04/17] xcb: cleanup _NET_WM_STATE handling Use function name overloading for all of _NET_WM_STATE setters for a mapped window, instead of few similar sounding functions, where all do the same thing. For an unmapped window rename updateNetWmStateBeforeMap() -> setNetWmStateOnUnmappedWindow(). Merge setNetWmStates(NetWmStates) into setNetWmStateOnUnmappedWindow() and add a comment explaining why it does what it does, as it was not obvious. Internally there are 2 variants: a) When a window is already mapped, to change the window state we send XCB_CLIENT_MESSAGE(_NET_WM_STATE) messages to the root window as per EWMH spec. The Window Manager MUST keep this property updated to reflect the current state of the window. If this variant of the overload is called while a window is not mapped yet, it does nothing. WM would ignore this message anyway. The state change is not lost, it will be set later and that is where the second variant comes in. b) On an unmapped window we can set _NET_WM_STATE by using setNetWmStateOnUnmappedWindow(). This function will read QWindow properties and set all of them via one xcb_change_property(_NET_WM_STATE) call. We do this inside QXcbWindow::show(), where we know that QWindow state properties won't change anymore until it gets mapped. Once it is mapped, we use the other variant. This patch doesn't change any functionality, just makes the code easier to follow. Change-Id: I4f4703a35de083fcfd398112eabd0a5aec358e51 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/xcb/qxcbwindow.cpp | 182 ++++++++++++----------- src/plugins/platforms/xcb/qxcbwindow.h | 11 +- 2 files changed, 100 insertions(+), 93 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e56f6b13d8..f553c286f9 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -755,7 +755,7 @@ void QXcbWindow::show() xcb_delete_property(xcb_connection(), m_window, XCB_ATOM_WM_TRANSIENT_FOR); // update _NET_WM_STATE - updateNetWmStateBeforeMap(); + setNetWmStateOnUnmappedWindow(); } // QWidget-attribute Qt::WA_ShowWithoutActivating. @@ -961,46 +961,6 @@ QXcbWindow::NetWmStates QXcbWindow::netWmStates() return result; } -void QXcbWindow::setNetWmStates(NetWmStates states) -{ - QVector atoms; - - auto reply = Q_XCB_REPLY_UNCHECKED(xcb_get_property, xcb_connection(), - 0, m_window, atom(QXcbAtom::_NET_WM_STATE), - XCB_ATOM_ATOM, 0, 1024); - if (reply && reply->format == 32 && reply->type == XCB_ATOM_ATOM && reply->value_len > 0) { - const xcb_atom_t *data = static_cast(xcb_get_property_value(reply.get())); - atoms.resize(reply->value_len); - memcpy((void *)&atoms.first(), (void *)data, reply->value_len * sizeof(xcb_atom_t)); - } - - if (states & NetWmStateAbove && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_ABOVE))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_ABOVE)); - if (states & NetWmStateBelow && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_BELOW))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_BELOW)); - if (states & NetWmStateFullScreen && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); - if (states & NetWmStateMaximizedHorz && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (states & NetWmStateMaximizedVert && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); - if (states & NetWmStateModal && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MODAL))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MODAL)); - if (states & NetWmStateStaysOnTop && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); - if (states & NetWmStateDemandsAttention && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION))) - atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)); - - if (atoms.isEmpty()) { - xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_STATE)); - } else { - xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, - atom(QXcbAtom::_NET_WM_STATE), XCB_ATOM_ATOM, 32, - atoms.count(), atoms.constData()); - } - xcb_flush(xcb_connection()); -} - void QXcbWindow::setWindowFlags(Qt::WindowFlags flags) { Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); @@ -1027,7 +987,7 @@ void QXcbWindow::setWindowFlags(Qt::WindowFlags flags) } setWmWindowType(wmWindowTypes, flags); - setNetWmStateWindowFlags(flags); + setNetWmState(flags); setMotifWmHints(flags); setTransparentForMouseEvents(flags & Qt::WindowTransparentForInput); @@ -1111,7 +1071,7 @@ void QXcbWindow::setMotifWmHints(Qt::WindowFlags flags) } } -void QXcbWindow::changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two) +void QXcbWindow::setNetWmState(bool set, xcb_atom_t one, xcb_atom_t two) { xcb_client_message_event_t event; @@ -1131,6 +1091,96 @@ void QXcbWindow::changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two) (const char *)&event); } +void QXcbWindow::setNetWmState(Qt::WindowStates state) +{ + if ((m_windowState ^ state) & Qt::WindowMaximized) { + setNetWmState(state & Qt::WindowMaximized, + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ), + atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); + } + + if ((m_windowState ^ state) & Qt::WindowFullScreen) + setNetWmState(state & Qt::WindowFullScreen, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); +} + +void QXcbWindow::setNetWmState(Qt::WindowFlags flags) +{ + setNetWmState(flags & Qt::WindowStaysOnTopHint, + atom(QXcbAtom::_NET_WM_STATE_ABOVE), + atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); + setNetWmState(flags & Qt::WindowStaysOnBottomHint, atom(QXcbAtom::_NET_WM_STATE_BELOW)); +} + +void QXcbWindow::setNetWmStateOnUnmappedWindow() +{ + if (Q_UNLIKELY(m_mapped)) + qCWarning(lcQpaXcb()) << "internal error: " << Q_FUNC_INFO << "called on mapped window"; + + NetWmStates states(0); + const Qt::WindowFlags flags = window()->flags(); + if (flags & Qt::WindowStaysOnTopHint) { + states |= NetWmStateAbove; + states |= NetWmStateStaysOnTop; + } else if (flags & Qt::WindowStaysOnBottomHint) { + states |= NetWmStateBelow; + } + + if (window()->windowStates() & Qt::WindowFullScreen) + states |= NetWmStateFullScreen; + + if (window()->windowStates() & Qt::WindowMaximized) { + states |= NetWmStateMaximizedHorz; + states |= NetWmStateMaximizedVert; + } + + if (window()->modality() != Qt::NonModal) + states |= NetWmStateModal; + + // According to EWMH: + // "The Window Manager should remove _NET_WM_STATE whenever a window is withdrawn". + // Which means that we don't have to read this property before changing it on a withdrawn + // window. But there are situations where users want to adjust this property as well + // (e4cea305ed2ba3c9f580bf9d16c59a1048af0e8a), so instead of overwriting the property + // we first read it and then merge our hints with the existing values, allowing a user + // to set custom hints. + + QVector atoms; + auto reply = Q_XCB_REPLY_UNCHECKED(xcb_get_property, xcb_connection(), + 0, m_window, atom(QXcbAtom::_NET_WM_STATE), + XCB_ATOM_ATOM, 0, 1024); + if (reply && reply->format == 32 && reply->type == XCB_ATOM_ATOM && reply->value_len > 0) { + const xcb_atom_t *data = static_cast(xcb_get_property_value(reply.get())); + atoms.resize(reply->value_len); + memcpy((void *)&atoms.first(), (void *)data, reply->value_len * sizeof(xcb_atom_t)); + } + + if (states & NetWmStateAbove && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_ABOVE))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_ABOVE)); + if (states & NetWmStateBelow && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_BELOW))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_BELOW)); + if (states & NetWmStateFullScreen && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); + if (states & NetWmStateMaximizedHorz && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (states & NetWmStateMaximizedVert && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); + if (states & NetWmStateModal && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_MODAL))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_MODAL)); + if (states & NetWmStateStaysOnTop && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); + if (states & NetWmStateDemandsAttention && !atoms.contains(atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION))) + atoms.push_back(atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)); + + if (atoms.isEmpty()) { + xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_NET_WM_STATE)); + } else { + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + atom(QXcbAtom::_NET_WM_STATE), XCB_ATOM_ATOM, 32, + atoms.count(), atoms.constData()); + } + xcb_flush(xcb_connection()); +} + void QXcbWindow::setWindowState(Qt::WindowStates state) { if (state == m_windowState) @@ -1158,14 +1208,7 @@ void QXcbWindow::setWindowState(Qt::WindowStates state) m_minimized = true; } - if ((m_windowState ^ state) & Qt::WindowMaximized) { - changeNetWmState(state & Qt::WindowMaximized, atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_HORZ), - atom(QXcbAtom::_NET_WM_STATE_MAXIMIZED_VERT)); - } - - if ((m_windowState ^ state) & Qt::WindowFullScreen) { - changeNetWmState(state & Qt::WindowFullScreen, atom(QXcbAtom::_NET_WM_STATE_FULLSCREEN)); - } + setNetWmState(state); xcb_get_property_cookie_t cookie = xcb_get_wm_hints_unchecked(xcb_connection(), m_window); xcb_wm_hints_t hints; @@ -1181,41 +1224,6 @@ void QXcbWindow::setWindowState(Qt::WindowStates state) m_windowState = state; } -void QXcbWindow::updateNetWmStateBeforeMap() -{ - NetWmStates states(0); - - const Qt::WindowFlags flags = window()->flags(); - if (flags & Qt::WindowStaysOnTopHint) { - states |= NetWmStateAbove; - states |= NetWmStateStaysOnTop; - } else if (flags & Qt::WindowStaysOnBottomHint) { - states |= NetWmStateBelow; - } - - if (window()->windowStates() & Qt::WindowFullScreen) - states |= NetWmStateFullScreen; - - if (window()->windowStates() & Qt::WindowMaximized) { - states |= NetWmStateMaximizedHorz; - states |= NetWmStateMaximizedVert; - } - - if (window()->modality() != Qt::NonModal) - states |= NetWmStateModal; - - setNetWmStates(states); -} - -void QXcbWindow::setNetWmStateWindowFlags(Qt::WindowFlags flags) -{ - changeNetWmState(flags & Qt::WindowStaysOnTopHint, - atom(QXcbAtom::_NET_WM_STATE_ABOVE), - atom(QXcbAtom::_NET_WM_STATE_STAYS_ON_TOP)); - changeNetWmState(flags & Qt::WindowStaysOnBottomHint, - atom(QXcbAtom::_NET_WM_STATE_BELOW)); -} - void QXcbWindow::updateNetWmUserTime(xcb_timestamp_t timestamp) { xcb_window_t wid = m_window; @@ -2588,7 +2596,7 @@ void QXcbWindow::setAlertState(bool enabled) m_alertState = enabled; - changeNetWmState(enabled, atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)); + setNetWmState(enabled, atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)); } uint QXcbWindow::visualId() const diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d2ca9fe0b9..f98cd8a74d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -193,17 +193,16 @@ protected: void setImageFormatForVisual(const xcb_visualtype_t *visual); QXcbScreen *parentScreen(); - QXcbScreen *initialScreen() const; - void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); + + void setNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); + void setNetWmState(Qt::WindowFlags flags); + void setNetWmState(Qt::WindowStates state); + void setNetWmStateOnUnmappedWindow(); NetWmStates netWmStates(); - void setNetWmStates(NetWmStates); void setMotifWmHints(Qt::WindowFlags flags); - void setNetWmStateWindowFlags(Qt::WindowFlags flags); - void updateNetWmStateBeforeMap(); - void setTransparentForMouseEvents(bool transparent); void updateDoesNotAcceptFocus(bool doesNotAcceptFocus); From 00674a1643422de2e56ac23c89174c0ead83eb18 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 25 Sep 2018 15:02:58 +0200 Subject: [PATCH 05/17] Treat shorts as int in QVariant::canConvert() Follow the pattern of char and float, and treat shorts as a more generic type in QVariant::canConvert() Task-number: QTBUG-60914 Change-Id: Ib1cc7941ee47cb0fc0098f22f98a03cd6f6b63fe Reviewed-by: Thiago Macieira --- src/corelib/kernel/qvariant.cpp | 12 +++++++++--- tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp | 8 ++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 0b4c3f387f..6541b97595 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -3523,13 +3523,19 @@ bool QVariant::canConvert(int targetTypeId) const } // TODO Reimplement this function, currently it works but it is a historical mess. - uint currentType = ((d.type == QMetaType::Float) ? QVariant::Double : d.type); + uint currentType = d.type; if (currentType == QMetaType::SChar || currentType == QMetaType::Char) currentType = QMetaType::UInt; if (targetTypeId == QMetaType::SChar || currentType == QMetaType::Char) targetTypeId = QMetaType::UInt; - if (uint(targetTypeId) == uint(QMetaType::Float)) targetTypeId = QVariant::Double; - + if (currentType == QMetaType::Short || currentType == QMetaType::UShort) + currentType = QMetaType::Int; + if (targetTypeId == QMetaType::Short || currentType == QMetaType::UShort) + targetTypeId = QMetaType::Int; + if (currentType == QMetaType::Float) + currentType = QMetaType::Double; + if (targetTypeId == QMetaType::Float) + targetTypeId = QMetaType::Double; if (currentType == uint(targetTypeId)) return true; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index 0780fb9172..4da34c407e 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -525,6 +525,12 @@ void tst_QVariant::canConvert_data() var = QVariant::fromValue(-1); QTest::newRow("SChar") << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << N << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; + var = QVariant((short)-3); + QTest::newRow("Short") + << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << Y << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; + var = QVariant((ushort)7); + QTest::newRow("UShort") + << var << N << N << Y << N << Y << N << N << N << N << Y << N << N << Y << N << Y << N << Y << N << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; var = QVariant::fromValue(QJsonValue(QStringLiteral("hello"))); QTest::newRow("JsonValue") << var << N << N << Y << N << N << N << N << N << N << Y << N << N << Y << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << Y << N << N << Y << Y; @@ -563,6 +569,8 @@ void tst_QVariant::toInt_data() QTest::newRow( "char" ) << QVariant::fromValue('a') << int('a') << true; signed char signedChar = -13; QTest::newRow( "signed char" ) << QVariant::fromValue(signedChar) << -13 << true; + QTest::newRow( "short" ) << QVariant::fromValue(short(-7)) << int(-7) << true; + QTest::newRow( "ushort" ) << QVariant::fromValue(ushort(30000)) << 30000 << true; QTest::newRow( "double" ) << QVariant( 3.1415927 ) << 3 << true; QTest::newRow( "float" ) << QVariant( 3.1415927f ) << 3 << true; QTest::newRow( "uint" ) << QVariant( 123u ) << 123 << true; From c6af950bfd79182eb21438fa63096d4509f90404 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 23 Oct 2018 16:11:10 +0200 Subject: [PATCH 06/17] QtCore/Windows: Output unknown messages in hex in the debug operator for MSG Task-number: QTBUG-71257 Change-Id: I89335799529e8c518113925d402571a8f7ada244 Reviewed-by: Andre de la Rocha --- src/corelib/kernel/qcoreapplication_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 0c57ad34b9..b373267fcb 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -717,7 +717,7 @@ QString decodeMSG(const MSG& msg) else if (const char *wmmsgC = findWMstr(msg.message)) message = QString::fromLatin1(wmmsgC); else - message = QString::fromLatin1("WM_(%1)").arg(msg.message); // Unknown WM_, so use number + message = QString::fromLatin1("WM_(0x%1)").arg(msg.message, 0, 16); // Unknown WM_, so use number // Yes, we want to give the WM_ names 20 chars of space before showing the // decoded message, since some of the common messages are quite long, and From 235ea594ad80b3ebb019b536b19dd041706b937e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 22 Oct 2018 14:06:33 +0200 Subject: [PATCH 07/17] uic: Remove remains of old Java generator Preparing the use of the option for Python. Task-number: PYSIDE-797 Change-Id: Ia1267b227ceac7f9dcbcfde6ed7c1480ef790f2a Reviewed-by: Jarek Kobus --- src/tools/uic/cpp/cpp.pri | 2 - src/tools/uic/driver.cpp | 11 +---- src/tools/uic/main.cpp | 1 - src/tools/uic/option.h | 12 ----- src/tools/uic/uic.cpp | 92 +++++---------------------------------- src/tools/uic/uic.h | 8 ---- 6 files changed, 13 insertions(+), 113 deletions(-) diff --git a/src/tools/uic/cpp/cpp.pri b/src/tools/uic/cpp/cpp.pri index a6b6188117..786b0e97a5 100644 --- a/src/tools/uic/cpp/cpp.pri +++ b/src/tools/uic/cpp/cpp.pri @@ -1,7 +1,5 @@ INCLUDEPATH += $$PWD $$QT_BUILD_TREE/src/tools/uic -DEFINES += QT_UIC_CPP_GENERATOR - # Input HEADERS += $$PWD/cppwritedeclaration.h \ $$PWD/cppwriteincludes.h \ diff --git a/src/tools/uic/driver.cpp b/src/tools/uic/driver.cpp index 6b3a6f8f69..91a48815fd 100644 --- a/src/tools/uic/driver.cpp +++ b/src/tools/uic/driver.cpp @@ -256,18 +256,11 @@ bool Driver::uic(const QString &fileName, DomUI *ui, QTextStream *out) m_output = out != 0 ? out : &m_stdout; Uic tool(this); - bool rtn = false; -#ifdef QT_UIC_CPP_GENERATOR - rtn = tool.write(ui); -#else - Q_UNUSED(ui); - fprintf(stderr, "uic: option to generate cpp code not compiled in [%s:%d]\n", - __FILE__, __LINE__); -#endif + const bool result = tool.write(ui); m_output = oldOutput; - return rtn; + return result; } bool Driver::uic(const QString &fileName, QTextStream *out) diff --git a/src/tools/uic/main.cpp b/src/tools/uic/main.cpp index 0e30bac28e..ec7ed63af7 100644 --- a/src/tools/uic/main.cpp +++ b/src/tools/uic/main.cpp @@ -115,7 +115,6 @@ int runUic(int argc, char *argv[]) driver.option().postfix = parser.value(postfixOption); driver.option().translateFunction = parser.value(translateOption); driver.option().includeFile = parser.value(includeOption); - driver.option().generator = (parser.value(generatorOption).toLower() == QLatin1String("java")) ? Option::JavaGenerator : Option::CppGenerator; if (parser.isSet(noStringLiteralOption)) fprintf(stderr, "The -s, --no-stringliteral option is deprecated and it won't take any effect.\n"); diff --git a/src/tools/uic/option.h b/src/tools/uic/option.h index a5b14abc5f..4fc442e94a 100644 --- a/src/tools/uic/option.h +++ b/src/tools/uic/option.h @@ -36,12 +36,6 @@ QT_BEGIN_NAMESPACE struct Option { - enum Generator - { - CppGenerator, - JavaGenerator - }; - unsigned int headerProtection : 1; unsigned int copyrightHeader : 1; unsigned int generateImplemetation : 1; @@ -51,7 +45,6 @@ struct Option unsigned int limitXPM_LineLength : 1; unsigned int implicitIncludes: 1; unsigned int idBased: 1; - Generator generator; QString inputFile; QString outputFile; @@ -61,10 +54,6 @@ struct Option QString postfix; QString translateFunction; QString includeFile; -#ifdef QT_UIC_JAVA_GENERATOR - QString javaPackage; - QString javaOutputDirectory; -#endif Option() : headerProtection(1), @@ -76,7 +65,6 @@ struct Option limitXPM_LineLength(0), implicitIncludes(1), idBased(0), - generator(CppGenerator), prefix(QLatin1String("Ui_")) { indent.fill(QLatin1Char(' '), 4); } diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index f275aaeb29..a5b331192f 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -33,18 +33,12 @@ #include "treewalker.h" #include "validator.h" -#ifdef QT_UIC_CPP_GENERATOR #include "cppwriteincludes.h" #include "cppwritedeclaration.h" -#endif - -#ifdef QT_UIC_JAVA_GENERATOR -#include "javawriteincludes.h" -#include "javawritedeclaration.h" -#endif #include #include +#include #include QT_BEGIN_NAMESPACE @@ -172,65 +166,33 @@ DomUI *Uic::parseUiFile(QXmlStreamReader &reader) bool Uic::write(QIODevice *in) { - if (option().generator == Option::JavaGenerator) { - // the Java generator ignores header protection - opt.headerProtection = false; - } - - DomUI *ui = 0; + QScopedPointer ui; { QXmlStreamReader reader; reader.setDevice(in); - ui = parseUiFile(reader); - - if (!ui) - return false; + ui.reset(parseUiFile(reader)); } + if (ui.isNull()) + return false; + double version = ui->attributeVersion().toDouble(); if (version < 4.0) { - delete ui; - fprintf(stderr, "uic: File generated with too old version of Qt Designer\n"); return false; } - QString language = ui->attributeLanguage(); + const QString &language = ui->attributeLanguage(); driver()->setUseIdBasedTranslations(ui->attributeIdbasedtr()); - bool rtn = false; - - if (option().generator == Option::JavaGenerator) { -#ifdef QT_UIC_JAVA_GENERATOR - if (language.toLower() != QLatin1String("jambi")) { - fprintf(stderr, "uic: File is not a 'jambi' form\n"); - delete ui; - return false; - } - rtn = jwrite (ui); -#else - fprintf(stderr, "uic: option to generate java code not compiled in\n"); -#endif - } else { -#ifdef QT_UIC_CPP_GENERATOR - if (!language.isEmpty() && language.toLower() != QLatin1String("c++")) { - fprintf(stderr, "uic: File is not a 'c++' ui file, language=%s\n", qPrintable(language)); - delete ui; - return false; - } - - rtn = write (ui); -#else - fprintf(stderr, "uic: option to generate cpp code not compiled in\n"); -#endif + if (!language.isEmpty() && language.compare(QLatin1String("c++"), Qt::CaseInsensitive) != 0) { + fprintf(stderr, "uic: File is not a \"c++\" ui file, language=%s\n", qPrintable(language)); + return false; } - delete ui; - - return rtn; + return write(ui.data()); } -#ifdef QT_UIC_CPP_GENERATOR bool Uic::write(DomUI *ui) { using namespace CPP; @@ -267,37 +229,6 @@ bool Uic::write(DomUI *ui) return true; } -#endif - -#ifdef QT_UIC_JAVA_GENERATOR -bool Uic::jwrite(DomUI *ui) -{ - using namespace Java; - - if (!ui || !ui->elementWidget()) - return false; - - if (opt.copyrightHeader) - writeCopyrightHeader(ui); - - pixFunction = ui->elementPixmapFunction(); - if (pixFunction == QLatin1String("QPixmap::fromMimeSource")) - pixFunction = QLatin1String("qPixmapFromMimeSource"); - - externalPix = ui->elementImages() == 0; - - info.acceptUI(ui); - cWidgetsInfo.acceptUI(ui); - WriteIncludes(this).acceptUI(ui); - - Validator(this).acceptUI(ui); - WriteDeclaration(this).acceptUI(ui); - - return true; -} -#endif - -#ifdef QT_UIC_CPP_GENERATOR void Uic::writeHeaderProtectionStart() { @@ -311,7 +242,6 @@ void Uic::writeHeaderProtectionEnd() QString h = drv->headerFileName(); out << "#endif // " << h << "\n"; } -#endif bool Uic::isMainWindow(const QString &className) const { diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h index 1c229bc516..4c961aa0a5 100644 --- a/src/tools/uic/uic.h +++ b/src/tools/uic/uic.h @@ -83,13 +83,7 @@ public: bool write(QIODevice *in); -#ifdef QT_UIC_JAVA_GENERATOR - bool jwrite(DomUI *ui); -#endif - -#ifdef QT_UIC_CPP_GENERATOR bool write(DomUI *ui); -#endif bool isMainWindow(const QString &className) const; bool isToolBar(const QString &className) const; @@ -105,11 +99,9 @@ private: void writeCopyrightHeader(DomUI *ui); DomUI *parseUiFile(QXmlStreamReader &reader); -#ifdef QT_UIC_CPP_GENERATOR // header protection void writeHeaderProtectionStart(); void writeHeaderProtectionEnd(); -#endif private: Driver *drv; From e3a552a130fc09725c8adda3548d297fc96e058a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 17 Oct 2018 14:59:08 +0200 Subject: [PATCH 08/17] QtPlatformSupport/macOS: Remove superfluous freetype inclusion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit freetype is included depending on configuration by the top level .pro file. Fix build warning: Makefile:1361: warning: ignoring old commands for target `.obj/qfontengine_ft.o' Change-Id: I0a0f111a841b368196633bbc0f9c698197f64bb2 Reviewed-by: Tor Arne Vestbø --- src/platformsupport/fontdatabases/mac/coretext.pri | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/platformsupport/fontdatabases/mac/coretext.pri b/src/platformsupport/fontdatabases/mac/coretext.pri index af75aa3281..95b9926e65 100644 --- a/src/platformsupport/fontdatabases/mac/coretext.pri +++ b/src/platformsupport/fontdatabases/mac/coretext.pri @@ -1,12 +1,6 @@ HEADERS += $$PWD/qcoretextfontdatabase_p.h $$PWD/qfontengine_coretext_p.h OBJECTIVE_SOURCES += $$PWD/qfontengine_coretext.mm $$PWD/qcoretextfontdatabase.mm -qtConfig(freetype) { - QMAKE_USE_PRIVATE += freetype - HEADERS += freetype/qfontengine_ft_p.h - SOURCES += freetype/qfontengine_ft.cpp -} - LIBS_PRIVATE += \ -framework CoreFoundation \ -framework CoreGraphics \ From 611423099667d2dc18e6fb63967cbbfd8a65829c Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Tue, 30 Oct 2018 10:43:51 +0100 Subject: [PATCH 09/17] Fix supportsSsl() to make it more consistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attempts to use QSslSocket and its OpenSSL 1.1 back-end with OpenSSL 1.1.1 in a very peculiar way (for some reason the reporter calls OPENSSL_no_config()) combined with a bug in OpenSSL 1.1.1 resulted in a QSslSocket dead-locking in initialization. This was happening because supportsSsl() first reported false (OpenSSL internally fails to initialize after OPENSSL_no_config()), but we have s_libraryLoaded set to true too early, thus the first supportsSsl() returns false, the second - true. Move setting of s_libraryLoaded later so that we don't claim to support OpenSSL when an earlier ensureLibraryLoaded() attempt failed. Task-number: QTBUG-70956 Task-number: QTBUG-71446 Change-Id: I8ad8763d357c84fc38c62e2ce914366367c2b445 Reviewed-by: Edward Welbourne Reviewed-by: Mårten Nordheim --- src/network/ssl/qsslsocket_openssl.cpp | 5 +++++ src/network/ssl/qsslsocket_openssl11.cpp | 4 ++-- src/network/ssl/qsslsocket_opensslpre11.cpp | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 64501a75e8..37bb3e4933 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -474,7 +474,12 @@ void QSslSocketPrivate::resetDefaultCiphers() #else SSL_CTX *myCtx = q_SSL_CTX_new(q_SSLv23_client_method()); #endif + // Note, we assert, not just silently return/bail out early: + // this should never happen and problems with OpenSSL's initialization + // must be caught before this (see supportsSsl()). + Q_ASSERT(myCtx); SSL *mySsl = q_SSL_new(myCtx); + Q_ASSERT(mySsl); QList ciphers; QList defaultCiphers; diff --git a/src/network/ssl/qsslsocket_openssl11.cpp b/src/network/ssl/qsslsocket_openssl11.cpp index cbbf403672..2a2667bd48 100644 --- a/src/network/ssl/qsslsocket_openssl11.cpp +++ b/src/network/ssl/qsslsocket_openssl11.cpp @@ -88,8 +88,6 @@ bool QSslSocketPrivate::ensureLibraryLoaded() const QMutexLocker locker(qt_opensslInitMutex); if (!s_libraryLoaded) { - s_libraryLoaded = true; - // Initialize OpenSSL. if (q_OPENSSL_init_ssl(0, nullptr) != 1) return false; @@ -105,6 +103,8 @@ bool QSslSocketPrivate::ensureLibraryLoaded() qWarning("Random number generator not seeded, disabling SSL support"); return false; } + + s_libraryLoaded = true; } return true; } diff --git a/src/network/ssl/qsslsocket_opensslpre11.cpp b/src/network/ssl/qsslsocket_opensslpre11.cpp index 062e03f4e6..bc4fd9dc85 100644 --- a/src/network/ssl/qsslsocket_opensslpre11.cpp +++ b/src/network/ssl/qsslsocket_opensslpre11.cpp @@ -215,8 +215,6 @@ bool QSslSocketPrivate::ensureLibraryLoaded() QMutexLocker locker(openssl_locks()->initLock()); if (!s_libraryLoaded) { - s_libraryLoaded = true; - // Initialize OpenSSL. q_CRYPTO_set_id_callback(id_function); q_CRYPTO_set_locking_callback(locking_function); @@ -235,6 +233,8 @@ bool QSslSocketPrivate::ensureLibraryLoaded() qWarning("Random number generator not seeded, disabling SSL support"); return false; } + + s_libraryLoaded = true; } return true; } From 8637235e855ef9ad88aa56404a1d16387610e227 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sat, 20 Oct 2018 20:25:06 +0200 Subject: [PATCH 10/17] QColorDialog: use customColorCount() instead hardcoded value A hardcoded value of 16 was used in QColorDialogPrivate::_q_addCustom() instead QColorDialogOptions::customColorCount() Fixes: QTBUG-58425 Change-Id: I7ae9881abd5926e0c6b118d5c84c3f259c545d35 Reviewed-by: Samuel Gaist Reviewed-by: Richard Moe Gustavsen --- src/widgets/dialogs/qcolordialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 4aa680af61..be60ea60b0 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1851,7 +1851,7 @@ void QColorDialogPrivate::_q_addCustom() QColorDialogOptions::setCustomColor(nextCust, cs->currentColor()); if (custom) custom->update(); - nextCust = (nextCust+1) % 16; + nextCust = (nextCust+1) % QColorDialogOptions::customColorCount(); } void QColorDialogPrivate::retranslateStrings() From e3c84b6da1cbef7ed779ba5eec6ae3ed8e4e5d59 Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Tue, 23 Oct 2018 14:17:29 +0800 Subject: [PATCH 11/17] QMimeType: Use default key as fallback for comment() property When QMimeProvider parses the shared mime database xml files, it will read the element for mime comment and treat the `xml:lang` attribute as locale language string. When no `xml:lang` attr is provided, QMimeProvider will read the value and treat it as a en_US locale string as the default key. When we call QMimeType::comment(), it will try to get the locale comment string with the default language (QLocale().name()), once it can't find a matched result, it should return the default key (which QMimeProvider set it as en_US locale before) as fallback. Task-number: QTBUG-71314 Change-Id: I444f8159d6f19dfef6338cd79312f608d8f13394 Reviewed-by: David Faure --- src/corelib/mimetypes/qmimeprovider.cpp | 2 +- src/corelib/mimetypes/qmimetype.cpp | 1 + src/corelib/mimetypes/qmimetypeparser.cpp | 4 ++-- .../mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 14 ++++++++++++++ 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index c4a8458243..aac51184a4 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -502,7 +502,7 @@ void QMimeBinaryProvider::loadMimeTypePrivate(QMimeTypePrivate &data) QString lang = xml.attributes().value(QLatin1String("xml:lang")).toString(); const QString text = xml.readElementText(); if (lang.isEmpty()) { - lang = QLatin1String("en_US"); + lang = QLatin1String("default"); // no locale attribute provided, treat it as default. } data.localeComments.insert(lang, text); continue; // we called readElementText, so we're at the EndElement already. diff --git a/src/corelib/mimetypes/qmimetype.cpp b/src/corelib/mimetypes/qmimetype.cpp index 50b8eae5c3..55c7de0c87 100644 --- a/src/corelib/mimetypes/qmimetype.cpp +++ b/src/corelib/mimetypes/qmimetype.cpp @@ -258,6 +258,7 @@ QString QMimeType::comment() const QStringList languageList; languageList << QLocale().name(); languageList << QLocale().uiLanguages(); + languageList << QLatin1String("default"); // use the default locale if possible. for (const QString &language : qAsConst(languageList)) { const QString lang = language == QLatin1String("C") ? QLatin1String("en_US") : language; const QString comm = d->localeComments.value(lang); diff --git a/src/corelib/mimetypes/qmimetypeparser.cpp b/src/corelib/mimetypes/qmimetypeparser.cpp index 7ff695bbc3..d10575cfe9 100644 --- a/src/corelib/mimetypes/qmimetypeparser.cpp +++ b/src/corelib/mimetypes/qmimetypeparser.cpp @@ -248,11 +248,11 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString } break; case ParseComment: { - // comments have locale attributes. We want the default, English one + // comments have locale attributes. QString locale = atts.value(QLatin1String(localeAttributeC)).toString(); const QString comment = reader.readElementText(); if (locale.isEmpty()) - locale = QString::fromLatin1("en_US"); + locale = QString::fromLatin1("default"); data.localeComments.insert(locale, comment); } break; diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 597d51e7e0..9df52887f7 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -992,6 +992,20 @@ void tst_QMimeDatabase::installNewGlobalMimeType() const QString fooTestFile2 = QLatin1String(RESOURCE_PREFIX "magic-and-hierarchy2.foo"); QCOMPARE(db.mimeTypeForFile(fooTestFile2).name(), QString::fromLatin1("application/vnd.qnx.bar-descriptor")); + // Test if we can use the default comment + { + struct RestoreLocale + { + ~RestoreLocale() { QLocale::setDefault(QLocale::c()); } + } restoreLocale; + + QLocale::setDefault(QLocale("zh_CN")); + QMimeType suseymp = db.mimeTypeForName("text/x-suse-ymp"); + QVERIFY(suseymp.isValid()); + QCOMPARE(suseymp.comment(), + QString::fromLatin1("YaST Meta Package")); + } + // Now test removing the mimetype definitions again for (int i = 0; i < m_additionalMimeFileNames.size(); ++i) QFile::remove(destDir + m_additionalMimeFileNames.at(i)); From 2b682972c2266e52b1510080a56b574e9ffd4db0 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 23 Sep 2018 17:21:21 +0200 Subject: [PATCH 12/17] QSqlQuery: add another testcase for bindBool() tst_QSqlQuery::bindBool() did not check if the bool is correctly bound as part of the WHERE statement. Add a new test to query for the bool column and check if there is exactly one row returned. Fixes: QTBUG-38891 Change-Id: I0bd1ceb1b30e50f67f44f5b06d68683195b78b29 Reviewed-by: Andy Shaw --- tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp index 4ce1009c90..c4cf2e752f 100644 --- a/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/sql/kernel/qsqlquery/tst_qsqlquery.cpp @@ -633,13 +633,20 @@ void tst_QSqlQuery::bindBool() QVERIFY_SQL(q, exec()); } - QVERIFY_SQL(q, exec("SELECT id, flag FROM " + tableName)); + QVERIFY_SQL(q, exec("SELECT id, flag FROM " + tableName + " ORDER BY id")); for (int i = 0; i < 2; ++i) { bool flag = i; QVERIFY_SQL(q, next()); QCOMPARE(q.value(0).toInt(), i); QCOMPARE(q.value(1).toBool(), flag); } + QVERIFY_SQL(q, prepare("SELECT flag FROM " + tableName + " WHERE flag = :filter")); + const bool filter = true; + q.bindValue(":filter", filter); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toBool(), filter); + QFAIL_SQL(q, next()); QVERIFY_SQL(q, exec("DROP TABLE " + tableName)); } From daf9ba91ae19054b5860f87f8f39b518d60cda38 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 18 Oct 2018 15:55:43 +0200 Subject: [PATCH 13/17] Stabilize tst_QAccessibilityLinux::testFocus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The tests would rely on the window manager giving it focus a bit too much. Change-Id: I1b28def2c95a4f0a9665a7cf6e0c14db03df98d5 Reviewed-by: Jędrzej Nowacki --- .../auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp index 47d24ce171..48594b2fa1 100644 --- a/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp +++ b/tests/auto/other/qaccessibilitylinux/tst_qaccessibilitylinux.cpp @@ -502,6 +502,8 @@ void tst_QAccessibilityLinux::testSlider() void tst_QAccessibilityLinux::testFocus() { + m_window->activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(m_window)); QLineEdit *lineEdit1 = new QLineEdit(m_window); lineEdit1->setText("lineEdit 1"); QLineEdit *lineEdit2 = new QLineEdit(m_window); From ceeecbae510af6e2d1ebbf865761e4761d404033 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Mon, 22 Oct 2018 15:53:35 +0200 Subject: [PATCH 14/17] Update various qt_attribution.json files Marking various as final because no upstream is known or available. Listing versions of others, where I was able to discover them. Updated a stale link (that helpfully redirected). Task-number: QTBUG-70008 Change-Id: Id00f34827133c560735c68793b4f1353f2b2ca85 Reviewed-by: Tobias Koenig Reviewed-by: Lars Knoll Reviewed-by: Jani Heikkinen Reviewed-by: Volker Hilsheimer --- src/3rdparty/easing/qt_attribution.json | 3 +++ src/3rdparty/forkfd/qt_attribution.json | 2 ++ src/3rdparty/freebsd/qt_attribution.json | 5 +++++ src/3rdparty/iaccessible2/qt_attribution.json | 2 +- src/3rdparty/icc/qt_attribution.json | 2 ++ src/3rdparty/md4/qt_attribution.json | 1 + src/3rdparty/md5/qt_attribution.json | 1 + src/3rdparty/rfc6234/qt_attribution.json | 1 + src/3rdparty/tinycbor/qt_attribution.json | 1 + src/3rdparty/wintab/qt_attribution.json | 1 + src/corelib/codecs/qt_attribution.json | 7 +++++++ src/corelib/kernel/qt_attribution.json | 1 + 12 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/easing/qt_attribution.json b/src/3rdparty/easing/qt_attribution.json index b6240c61c8..bccc67b6d4 100644 --- a/src/3rdparty/easing/qt_attribution.json +++ b/src/3rdparty/easing/qt_attribution.json @@ -3,7 +3,10 @@ "Name": "Easing Equations by Robert Penner", "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QEasingCurve).", + "Files": "easing.cpp", + "Homepage": "treat as final", + "Homepage": "http://robertpenner.com/easing/", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/forkfd/qt_attribution.json b/src/3rdparty/forkfd/qt_attribution.json index f004116753..ebbb19c718 100644 --- a/src/3rdparty/forkfd/qt_attribution.json +++ b/src/3rdparty/forkfd/qt_attribution.json @@ -3,6 +3,8 @@ "Name": "forkfd", "QDocModule": "qtcore", "QtUsage": "Used on most Unix platforms in Qt Core.", + "Files": "No upstream; treat as final", + "Files": "forkfd.c forkfd.h forkfd_gcc.h", "License": "MIT License", "LicenseId": "MIT", diff --git a/src/3rdparty/freebsd/qt_attribution.json b/src/3rdparty/freebsd/qt_attribution.json index 57f425cdbc..6a4a9ca1af 100644 --- a/src/3rdparty/freebsd/qt_attribution.json +++ b/src/3rdparty/freebsd/qt_attribution.json @@ -3,8 +3,13 @@ "Name": "FreeBSD strtoll and strtoull", "QDocModule": "qtcore", "QtUsage": "Used in Qt Core.", + "Files": "strtoll.c strtoull.c", "Description": "strtoll() and strtoull() are functions for converting a string to (unsigned) long long integer.", + "Homepage": "https://github.com/freebsd/freebsd/", + "Upstream": "https://raw.githubusercontent.com/freebsd/freebsd/raw/tree/master/lib/libc/stdlib/$file", + "Version": "upstream has complicated with std locales; do not update", + "Version": "18b29f3fb8abee5d57ed8f4a44f806bec7e0eeff", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/iaccessible2/qt_attribution.json b/src/3rdparty/iaccessible2/qt_attribution.json index 290d0d4b7d..eea8314f1a 100644 --- a/src/3rdparty/iaccessible2/qt_attribution.json +++ b/src/3rdparty/iaccessible2/qt_attribution.json @@ -5,7 +5,7 @@ "QtUsage": "Optionally used in the Windows platform plugin. Configure with -no-accessibility to avoid.", "Description": "IAccessible2 is a new accessibility API which complements Microsoft's earlier work on MSAA", - "Homepage": "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2", + "Homepage": "https://wiki.linuxfoundation.org/accessibility/iaccessible2/", "Version": "1.3.0", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", diff --git a/src/3rdparty/icc/qt_attribution.json b/src/3rdparty/icc/qt_attribution.json index 7a1c813522..06049954e3 100644 --- a/src/3rdparty/icc/qt_attribution.json +++ b/src/3rdparty/icc/qt_attribution.json @@ -4,9 +4,11 @@ "Name": "sRGB color profile icc file", "QDocModule": "qtgui", "QtUsage": "Used in Qt Gui (Embedded into PDF/A-1b files generated by QPrinter/QPdfWriter).", + "Files": "No upstream: treat as final", "Files": "sRGB2014.icc", "Description": "An ICC color profile for PDF/A-1b compatible PDF files.", + "Homepage": "http://www.color.org/", "LicenseId": "ICC License", "License": "International Color Consortium License", "LicenseFile": "LICENSE.txt", diff --git a/src/3rdparty/md4/qt_attribution.json b/src/3rdparty/md4/qt_attribution.json index f1bca24660..ea7e22705f 100644 --- a/src/3rdparty/md4/qt_attribution.json +++ b/src/3rdparty/md4/qt_attribution.json @@ -4,6 +4,7 @@ "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.", + "Description": "Treat as final version; no upstream known", "Description": "An OpenSSL-compatible implementation of the RSA Data Security, Inc. MD4 Message-Digest Algorithm.", "License": "Public Domain", "Copyright": "Written by Alexander Peslyak - better known as Solar Designer - in 2001, and placed in the public domain. There's absolutely no warranty." diff --git a/src/3rdparty/md5/qt_attribution.json b/src/3rdparty/md5/qt_attribution.json index 52b613cf6c..e9783f9e49 100644 --- a/src/3rdparty/md5/qt_attribution.json +++ b/src/3rdparty/md5/qt_attribution.json @@ -4,6 +4,7 @@ "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash). Configure with -DQT_CRYPTOGRAPHICHASH_ONLY_SHA1 to avoid.", + "Description": "Treat as final version; no upstream known", "Description": "MD5 message-digest algorithm.", "License": "Public Domain", "Copyright": "Written by Colin Plumb in 1993, no copyright is claimed. diff --git a/src/3rdparty/rfc6234/qt_attribution.json b/src/3rdparty/rfc6234/qt_attribution.json index 9fc427b4a6..1cce430cf6 100644 --- a/src/3rdparty/rfc6234/qt_attribution.json +++ b/src/3rdparty/rfc6234/qt_attribution.json @@ -4,6 +4,7 @@ "QDocModule": "qtcore", "QtUsage": "Used in Qt Core (QCryptographicHash and QMessageAuthenticationCode)", + "Description": "The RFC actually contains the code, embedded in RFC-boilerplate; presumably we extracted it; treat as final", "Description": "Implements the Secure Hash Algorithms SHA 384 and SHA-521", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseFile": "LICENSE", diff --git a/src/3rdparty/tinycbor/qt_attribution.json b/src/3rdparty/tinycbor/qt_attribution.json index 1d61534861..5b6355d013 100644 --- a/src/3rdparty/tinycbor/qt_attribution.json +++ b/src/3rdparty/tinycbor/qt_attribution.json @@ -5,6 +5,7 @@ "QtUsage": "Used for QCborStreamReader and QCborStreamWriter.", "Description": "Concise Binary Object Representation (CBOR) Library", + "Version": "0.6.0", "Homepage": "https://github.com/intel/tinycbor", "License": "MIT License", "LicenseId": "MIT", diff --git a/src/3rdparty/wintab/qt_attribution.json b/src/3rdparty/wintab/qt_attribution.json index ac06e8da5a..f0c9b49841 100644 --- a/src/3rdparty/wintab/qt_attribution.json +++ b/src/3rdparty/wintab/qt_attribution.json @@ -5,6 +5,7 @@ "QtUsage": "Used in the Qt platform plugin for Windows. Configure with -no-feature-tabletevent to avoid.", "Description": "Wintab is a de facto API for pointing devices on Windows.", + "Version": "Upstream no longer offers updates; treat as final", "Homepage": "http://www.pointing.com/Wintab.html", "License": "Public Domain", "LicenseId": "NONE", diff --git a/src/corelib/codecs/qt_attribution.json b/src/corelib/codecs/qt_attribution.json index 41f644a030..0815074675 100644 --- a/src/corelib/codecs/qt_attribution.json +++ b/src/corelib/codecs/qt_attribution.json @@ -6,6 +6,7 @@ "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qbig5codec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The Big5 codecs (QBig5Codec, QBig5hkscsCodec) provide conversion to and from the Big5 encodings.", "License": "BSD 2-clause \"Simplified\" License", @@ -23,6 +24,7 @@ Copyright (C) 2001, 2002 Anthony Fok, ThizLinux Laboratory Ltd." "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qeucjpcodec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The EUC-JP text codec provides conversion to and from EUC-JP, the main legacy encoding for Unix machines in Japan.", "License": "BSD 2-clause \"Simplified\" License", @@ -37,6 +39,7 @@ the main legacy encoding for Unix machines in Japan.", "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qeuckrcodec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The EUC-KR text codec provides conversion to and from EUC-KR, KR, the main legacy encoding for Unix machines in Korea.", "License": "BSD 2-clause \"Simplified\" License", @@ -51,6 +54,7 @@ the main legacy encoding for Unix machines in Korea.", "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qjiscodec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The ISO 2022-JP (JIS) text codec provides conversion to and from ISO 2022-JP.", "License": "BSD 2-clause \"Simplified\" License", "LicenseId": "BSD-2-Clause", @@ -64,6 +68,7 @@ the main legacy encoding for Unix machines in Korea.", "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qsjiscodec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The Shift-JIS text codec provides conversion to and from Shift-JIS.", "License": "BSD 2-clause \"Simplified\" License", "LicenseId": "BSD-2-Clause", @@ -77,6 +82,7 @@ the main legacy encoding for Unix machines in Korea.", "QtUsage": "Used in Qt Core.", "Path": "qtsciicodec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The TSCII text codec provides conversion to and from the Tamil TSCII encoding.", "License": "BSD 2-clause \"Simplified\" License", @@ -91,6 +97,7 @@ encoding.", "QtUsage": "Used in Qt Core if ICU is not used. Configure with -icu to avoid.", "Path": "qgb18030codec.cpp", + "Description": "Treat as final version; no upstream known", "Description": "The GBK codec provides conversion to and from the Chinese GB18030/GBK/GB2312 encoding.", "License": "BSD 2-clause \"Simplified\" License", diff --git a/src/corelib/kernel/qt_attribution.json b/src/corelib/kernel/qt_attribution.json index 37764a5330..6d8f4f2abc 100644 --- a/src/corelib/kernel/qt_attribution.json +++ b/src/corelib/kernel/qt_attribution.json @@ -5,6 +5,7 @@ "QtUsage": "Used in Qt Core on macOS.", "Path": "qeventdispatcher_cf_p.h", + "Description": "Treat as final version; no upstream known", "Description": "Implementation of QAbstractEventDispatcher for macOS.", "License": "BSD 3-clause \"New\" or \"Revised\" License", "LicenseId": "BSD-3-Clause", From dc2aead842f4cdf74f9259d3606c53c8bdae2c6b Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 1 Nov 2018 17:40:27 +0100 Subject: [PATCH 15/17] Fix build with -qt-libpng on powerpc It appears we are missing some setups for SIMD optimization, and already have a workaround for that for NEON, so do the same for VSX. Fixes: QTBUG-66388 Change-Id: I1cc1d0fe9c5a9df97acb589d29dec4dceb8fc576 Reviewed-by: Eirik Aavitsland --- src/3rdparty/libpng/libpng.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rdparty/libpng/libpng.pro b/src/3rdparty/libpng/libpng.pro index 577b61d833..a2f56669b4 100644 --- a/src/3rdparty/libpng/libpng.pro +++ b/src/3rdparty/libpng/libpng.pro @@ -10,7 +10,7 @@ MODULE_INCLUDEPATH = $$PWD load(qt_helper_lib) -DEFINES += PNG_ARM_NEON_OPT=0 +DEFINES += PNG_ARM_NEON_OPT=0 PNG_POWERPC_VSX_OPT=0 SOURCES += \ png.c \ pngerror.c \ From 98365711a0c06673b8f55d43ba227a640dc798a6 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 28 Oct 2018 15:30:51 +0100 Subject: [PATCH 16/17] Remove unused variable Change-Id: I241969d10502e944f7a73971771730d43dd2784f Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbeventdispatcher.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbeventdispatcher.h b/src/plugins/platforms/xcb/qxcbeventdispatcher.h index 6aadd63a70..ddf448cf87 100644 --- a/src/plugins/platforms/xcb/qxcbeventdispatcher.h +++ b/src/plugins/platforms/xcb/qxcbeventdispatcher.h @@ -107,9 +107,6 @@ class QXcbEventDispatcher { public: static QAbstractEventDispatcher *createEventDispatcher(QXcbConnection *connection); - -private: - QXcbConnection *m_connection; }; QT_END_NAMESPACE From 73e7eb785fbf984e2b964be8c3acad788479dfa6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 5 Nov 2018 16:03:29 +0100 Subject: [PATCH 17/17] Enable swizzling This part was accidently left disabling after testing the fallback still worked. Change-Id: Ic2df939753641a9771e68bc8857c570d356cff44 Reviewed-by: Laszlo Agocs --- src/gui/opengl/qopengltextureuploader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/opengl/qopengltextureuploader.cpp b/src/gui/opengl/qopengltextureuploader.cpp index 2428baed93..42e309b733 100644 --- a/src/gui/opengl/qopengltextureuploader.cpp +++ b/src/gui/opengl/qopengltextureuploader.cpp @@ -114,7 +114,7 @@ qsizetype QOpenGLTextureUploader::textureImage(GLenum target, const QImage &imag externalFormat = GL_BGRA; internalFormat = GL_RGBA; pixelType = GL_UNSIGNED_INT_8_8_8_8_REV; - } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle) && false) { + } else if (funcs->hasOpenGLExtension(QOpenGLExtensions::TextureSwizzle)) { #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN GLint swizzle[4] = { GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA }; funcs->glTexParameteriv(target, GL_TEXTURE_SWIZZLE_RGBA, swizzle);