diff options
Diffstat (limited to 'examples')
20 files changed, 102 insertions, 97 deletions
diff --git a/examples/embedded/raycasting/raycasting.cpp b/examples/embedded/raycasting/raycasting.cpp index d37b9f5d2e..7213811213 100644 --- a/examples/embedded/raycasting/raycasting.cpp +++ b/examples/embedded/raycasting/raycasting.cpp @@ -255,11 +255,7 @@ public: protected: void resizeEvent(QResizeEvent*) { -#if defined(Q_OS_WINCE_WM) - touchDevice = true; -#else touchDevice = false; -#endif if (touchDevice) { if (width() < height()) { trackPad = QRect(0, height() / 2, width(), height() / 2); diff --git a/examples/network/http/httpwindow.cpp b/examples/network/http/httpwindow.cpp index 39ffb3cc87..c7bf0c0dff 100644 --- a/examples/network/http/httpwindow.cpp +++ b/examples/network/http/httpwindow.cpp @@ -48,13 +48,14 @@ ** ****************************************************************************/ +#include "httpwindow.h" + +#include "ui_authenticationdialog.h" + #include <QtWidgets> #include <QtNetwork> #include <QUrl> -#include "httpwindow.h" -#include "ui_authenticationdialog.h" - #if QT_CONFIG(ssl) const char defaultUrl[] = "https://www.qt.io/"; #else @@ -74,6 +75,10 @@ ProgressDialog::ProgressDialog(const QUrl &url, QWidget *parent) setMinimumSize(QSize(400, 75)); } +ProgressDialog::~ProgressDialog() +{ +} + void ProgressDialog::networkReplyProgress(qint64 bytesRead, qint64 totalBytes) { setMaximum(totalBytes); @@ -137,6 +142,10 @@ HttpWindow::HttpWindow(QWidget *parent) urlLineEdit->setFocus(); } +HttpWindow::~HttpWindow() +{ +} + void HttpWindow::startRequest(const QUrl &requestedUrl) { url = requestedUrl; @@ -204,9 +213,9 @@ void HttpWindow::downloadFile() startRequest(newUrl); } -QFile *HttpWindow::openFileForWrite(const QString &fileName) +std::unique_ptr<QFile> HttpWindow::openFileForWrite(const QString &fileName) { - QScopedPointer<QFile> file(new QFile(fileName)); + std::unique_ptr<QFile> file(new QFile(fileName)); if (!file->open(QIODevice::WriteOnly)) { QMessageBox::information(this, tr("Error"), tr("Unable to save the file %1: %2.") @@ -214,7 +223,7 @@ QFile *HttpWindow::openFileForWrite(const QString &fileName) file->errorString())); return nullptr; } - return file.take(); + return file; } void HttpWindow::cancelDownload() @@ -231,8 +240,7 @@ void HttpWindow::httpFinished() if (file) { fi.setFile(file->fileName()); file->close(); - delete file; - file = nullptr; + file.reset(); } if (httpRequestAborted) { diff --git a/examples/network/http/httpwindow.h b/examples/network/http/httpwindow.h index 20ad2bb4da..f7bd0047de 100644 --- a/examples/network/http/httpwindow.h +++ b/examples/network/http/httpwindow.h @@ -55,6 +55,8 @@ #include <QNetworkAccessManager> #include <QUrl> +#include <memory> + QT_BEGIN_NAMESPACE class QFile; class QLabel; @@ -72,6 +74,7 @@ class ProgressDialog : public QProgressDialog { public: explicit ProgressDialog(const QUrl &url, QWidget *parent = nullptr); + ~ProgressDialog(); public slots: void networkReplyProgress(qint64 bytesRead, qint64 totalBytes); @@ -83,6 +86,7 @@ class HttpWindow : public QDialog public: explicit HttpWindow(QWidget *parent = nullptr); + ~HttpWindow(); void startRequest(const QUrl &requestedUrl); @@ -98,7 +102,7 @@ private slots: #endif private: - QFile *openFileForWrite(const QString &fileName); + std::unique_ptr<QFile> openFileForWrite(const QString &fileName); QLabel *statusLabel; QLineEdit *urlLineEdit; @@ -110,7 +114,7 @@ private: QUrl url; QNetworkAccessManager qnam; QNetworkReply *reply; - QFile *file; + std::unique_ptr<QFile> file; bool httpRequestAborted; }; diff --git a/examples/network/torrent/ratecontroller.cpp b/examples/network/torrent/ratecontroller.cpp index 47b49dba30..87c65096b6 100644 --- a/examples/network/torrent/ratecontroller.cpp +++ b/examples/network/torrent/ratecontroller.cpp @@ -123,11 +123,11 @@ void RateController::transfer() qint64 writeChunk = qMax<qint64>(1, bytesToWrite / pendingSockets.size()); qint64 readChunk = qMax<qint64>(1, bytesToRead / pendingSockets.size()); - QSetIterator<PeerWireClient *> it(pendingSockets); - while (it.hasNext() && (bytesToWrite > 0 || bytesToRead > 0)) { - PeerWireClient *socket = it.next(); + for (auto it = pendingSockets.begin(), end = pendingSockets.end(); it != end && (bytesToWrite > 0 || bytesToRead > 0); /*erasing*/) { + auto current = it++; + PeerWireClient *socket = *current; if (socket->state() != QAbstractSocket::ConnectedState) { - pendingSockets.remove(socket); + pendingSockets.erase(current); continue; } @@ -156,7 +156,7 @@ void RateController::transfer() if (dataTransferred && socket->canTransferMore()) canTransferMore = true; else - pendingSockets.remove(socket); + pendingSockets.erase(current); } } while (canTransferMore && (bytesToWrite > 0 || bytesToRead > 0) && !pendingSockets.isEmpty()); diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp index d01a5f3d9e..bddf3caa1a 100644 --- a/examples/network/torrent/torrentclient.cpp +++ b/examples/network/torrent/torrentclient.cpp @@ -720,9 +720,9 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const qint64 now = QDateTime::currentSecsSinceEpoch(); QList<TorrentPeer *> freePeers; QMap<QString, int> connectionsPerPeer; - for (TorrentPeer *peer : d->peers) { + for (TorrentPeer *peer : qAsConst(d->peers)) { bool busy = false; - for (PeerWireClient *client : d->connections) { + for (PeerWireClient *client : qAsConst(d->connections)) { if (client->state() == PeerWireClient::ConnectedState && client->peerAddress() == peer->address && client->peerPort() == peer->port) { @@ -874,8 +874,7 @@ void TorrentClient::removeClient() // Remove the client from RateController and all structures. RateController::instance()->removeSocket(client); d->connections.removeAll(client); - QMultiMap<PeerWireClient *, TorrentPiece *>::Iterator it = d->payloads.find(client); - while (it != d->payloads.end() && it.key() == client) { + for (auto it = d->payloads.find(client); it != d->payloads.end() && it.key() == client; /*erasing*/) { TorrentPiece *piece = it.value(); piece->inProgress = false; piece->requestedBlocks.fill(false); @@ -883,9 +882,12 @@ void TorrentClient::removeClient() } // Remove pending read requests. - QMapIterator<int, PeerWireClient *> it2(d->readIds); - while (it2.findNext(client)) - d->readIds.remove(it2.key()); + for (auto it = d->readIds.begin(), end = d->readIds.end(); it != end; /*erasing*/) { + if (it.value() == client) + it = d->readIds.erase(it); + else + ++it; + } // Delete the client later. disconnect(client, SIGNAL(disconnected()), this, SLOT(removeClient())); @@ -1084,25 +1086,25 @@ void TorrentClient::scheduleUploads() // seeding, we sort by upload speed. Seeds are left out; there's // no use in unchoking them. QList<PeerWireClient *> allClients = d->connections; - QMultiMap<int, PeerWireClient *> transferSpeeds; + QVector<QPair<qint64, PeerWireClient *>> transferSpeeds; for (PeerWireClient *client : qAsConst(allClients)) { if (client->state() == QAbstractSocket::ConnectedState && client->availablePieces().count(true) != d->pieceCount) { if (d->state == Seeding) { - transferSpeeds.insert(client->uploadSpeed(), client); + transferSpeeds.push_back({client->uploadSpeed(), client}); } else { - transferSpeeds.insert(client->downloadSpeed(), client); + transferSpeeds.push_back({client->downloadSpeed(), client}); } } } + std::sort(transferSpeeds.begin(), transferSpeeds.end()); + // Unchoke the top 'MaxUploads' downloaders (peers that we are // uploading to) and choke all others. int maxUploaders = MaxUploads; - QMapIterator<int, PeerWireClient *> it(transferSpeeds); - it.toBack(); - while (it.hasPrevious()) { - PeerWireClient *client = it.previous().value(); + for (auto rit = transferSpeeds.crbegin(), rend = transferSpeeds.crend(); rit != rend; ++rit) { + PeerWireClient *client = rit->second; bool interested = (client->peerWireState() & PeerWireClient::PeerIsInterested); if (maxUploaders) { @@ -1484,30 +1486,26 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList) // of the peers that have no (or low) activity. int maxPeers = ConnectionManager::instance()->maxConnections() * 3; if (d->peers.size() > maxPeers) { + auto tooMany = d->peers.size() - maxPeers; + // Find what peers are currently connected & active - QSet<TorrentPeer *> activePeers; - for (TorrentPeer *peer : qAsConst(d->peers)) { + const auto firstNInactivePeers = [&tooMany, this] (TorrentPeer *peer) { + if (!tooMany) + return false; for (const PeerWireClient *client : qAsConst(d->connections)) { if (client->peer() == peer && (client->downloadSpeed() + client->uploadSpeed()) > 1024) - activePeers << peer; + return false; } - } - + --tooMany; + return true; + }; // Remove inactive peers from the peer list until we're below // the max connections count. - QList<int> toRemove; - for (int i = 0; i < d->peers.size() && (d->peers.size() - toRemove.size()) > maxPeers; ++i) { - if (!activePeers.contains(d->peers.at(i))) - toRemove << i; - } - QListIterator<int> toRemoveIterator(toRemove); - toRemoveIterator.toBack(); - while (toRemoveIterator.hasPrevious()) - d->peers.removeAt(toRemoveIterator.previous()); - + d->peers.erase(std::remove_if(d->peers.begin(), d->peers.end(), + firstNInactivePeers), + d->peers.end()); // If we still have too many peers, remove the oldest ones. - while (d->peers.size() > maxPeers) - d->peers.takeFirst(); + d->peers.erase(d->peers.begin(), d->peers.begin() + tooMany); } if (d->state != Paused && d->state != Stopping && d->state != Idle) { diff --git a/examples/opengl/hellogles3/main.cpp b/examples/opengl/hellogles3/main.cpp index 29b3b9617a..9451b2882f 100644 --- a/examples/opengl/hellogles3/main.cpp +++ b/examples/opengl/hellogles3/main.cpp @@ -69,11 +69,11 @@ int main(int argc, char *argv[]) QSurfaceFormat fmt; fmt.setDepthBufferSize(24); - // Request OpenGL 3.3 compatibility or OpenGL ES 3.0. + // Request OpenGL 3.3 core or OpenGL ES 3.0. if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) { - qDebug("Requesting 3.3 compatibility context"); + qDebug("Requesting 3.3 core context"); fmt.setVersion(3, 3); - fmt.setProfile(QSurfaceFormat::CompatibilityProfile); + fmt.setProfile(QSurfaceFormat::CoreProfile); } else { qDebug("Requesting 3.0 context"); fmt.setVersion(3, 0); diff --git a/examples/opengl/legacy/overpainting/glwidget.cpp b/examples/opengl/legacy/overpainting/glwidget.cpp index f98d043c5c..0094f8ead7 100644 --- a/examples/opengl/legacy/overpainting/glwidget.cpp +++ b/examples/opengl/legacy/overpainting/glwidget.cpp @@ -247,12 +247,8 @@ void GLWidget::createBubbles(int number) //! [13] void GLWidget::animate() { - QMutableListIterator<Bubble*> iter(bubbles); - - while (iter.hasNext()) { - Bubble *bubble = iter.next(); + for (Bubble *bubble : qAsConst(bubbles)) bubble->move(rect()); - } update(); } //! [13] diff --git a/examples/opengl/qopenglwidget/glwidget.cpp b/examples/opengl/qopenglwidget/glwidget.cpp index 946b2bec67..5057291f12 100644 --- a/examples/opengl/qopenglwidget/glwidget.cpp +++ b/examples/opengl/qopenglwidget/glwidget.cpp @@ -399,12 +399,9 @@ void GLWidget::paintGL() painter.end(); - QMutableListIterator<Bubble*> iter(m_bubbles); - - while (iter.hasNext()) { - Bubble *bubble = iter.next(); + for (Bubble *bubble : qAsConst(m_bubbles)) bubble->move(rect()); - } + if (!(m_frames % 100)) { m_time.start(); m_frames = 0; diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp index b9e491040f..983f608543 100644 --- a/examples/opengl/threadedqopenglwidget/main.cpp +++ b/examples/opengl/threadedqopenglwidget/main.cpp @@ -58,6 +58,8 @@ #include "mainwindow.h" #include "glwidget.h" +#include <memory> + static QString getGlString(QOpenGLFunctions *functions, GLenum name) { if (const GLubyte *p = functions->glGetString(name)) @@ -104,8 +106,8 @@ int main( int argc, char ** argv ) const QString toolTip = supportsThreading ? glInfo : glInfo + QStringLiteral("\ndoes not support threaded OpenGL."); topLevelGlWidget.setToolTip(toolTip); - QScopedPointer<MainWindow> mw1; - QScopedPointer<MainWindow> mw2; + std::unique_ptr<MainWindow> mw1; + std::unique_ptr<MainWindow> mw2; if (!parser.isSet(singleOption)) { if (supportsThreading) { pos += QPoint(100, 100); diff --git a/examples/qtconcurrent/wordcount/main.cpp b/examples/qtconcurrent/wordcount/main.cpp index ff7ea24ee7..32cb4d0e08 100644 --- a/examples/qtconcurrent/wordcount/main.cpp +++ b/examples/qtconcurrent/wordcount/main.cpp @@ -126,11 +126,8 @@ WordCount countWords(const QString &file) // at a time. void reduce(WordCount &result, const WordCount &w) { - QMapIterator<QString, int> i(w); - while (i.hasNext()) { - i.next(); + for (auto i = w.begin(), end = w.end(); i != end; ++i) result[i.key()] += i.value(); - } } int main(int argc, char** argv) diff --git a/examples/sql/relationaltablemodel/relationaltablemodel.cpp b/examples/sql/relationaltablemodel/relationaltablemodel.cpp index c3c7d48d70..df4eae6e6e 100644 --- a/examples/sql/relationaltablemodel/relationaltablemodel.cpp +++ b/examples/sql/relationaltablemodel/relationaltablemodel.cpp @@ -53,6 +53,8 @@ #include "../connection.h" +#include <memory> + void initializeModel(QSqlRelationalTableModel *model) { //! [0] @@ -76,12 +78,12 @@ void initializeModel(QSqlRelationalTableModel *model) model->select(); } -QTableView *createView(const QString &title, QSqlTableModel *model) +std::unique_ptr<QTableView> createView(const QString &title, QSqlTableModel *model) { //! [4] - QTableView *view = new QTableView; + std::unique_ptr<QTableView> view{new QTableView}; view->setModel(model); - view->setItemDelegate(new QSqlRelationalDelegate(view)); + view->setItemDelegate(new QSqlRelationalDelegate(view.get())); //! [4] view->setWindowTitle(title); return view; @@ -118,7 +120,7 @@ int main(int argc, char *argv[]) initializeModel(&model); - QScopedPointer<QTableView> view(createView(QObject::tr("Relational Table Model"), &model)); + std::unique_ptr<QTableView> view = createView(QObject::tr("Relational Table Model"), &model); view->show(); return app.exec(); diff --git a/examples/widgets/dialogs/standarddialogs/dialog.cpp b/examples/widgets/dialogs/standarddialogs/dialog.cpp index 1830b21e8f..c91a594490 100644 --- a/examples/widgets/dialogs/standarddialogs/dialog.cpp +++ b/examples/widgets/dialogs/standarddialogs/dialog.cpp @@ -287,7 +287,6 @@ Dialog::Dialog(QWidget *parent) fileDialogOptionsWidget->addCheckBox(tr("Show directories only"), QFileDialog::ShowDirsOnly); fileDialogOptionsWidget->addCheckBox(tr("Do not resolve symlinks"), QFileDialog::DontResolveSymlinks); fileDialogOptionsWidget->addCheckBox(tr("Do not confirm overwrite"), QFileDialog::DontConfirmOverwrite); - fileDialogOptionsWidget->addCheckBox(tr("Do not use sheet"), QFileDialog::DontUseSheet); fileDialogOptionsWidget->addCheckBox(tr("Readonly"), QFileDialog::ReadOnly); fileDialogOptionsWidget->addCheckBox(tr("Hide name filter details"), QFileDialog::HideNameFilterDetails); fileDialogOptionsWidget->addCheckBox(tr("Do not use custom directory icons (Windows)"), QFileDialog::DontUseCustomDirectoryIcons); diff --git a/examples/widgets/doc/src/icons.qdoc b/examples/widgets/doc/src/icons.qdoc index 60cb9062c2..7aae0491d6 100644 --- a/examples/widgets/doc/src/icons.qdoc +++ b/examples/widgets/doc/src/icons.qdoc @@ -262,12 +262,7 @@ provides arrays allowing to map from enumeration value to row/column (by using QVector::indexOf()) and back by using the array index and lists of the matching strings. Qt's containers can be easily populated by - using C++ 11 initializer lists. If the compiler does not provide that feature, - a pattern like - - \snippet widgets/icons/iconpreviewarea.cpp 43 - - can be used. + using C++ 11 initializer lists. We need two public functions to set the current icon and the icon's size. In addition the class has three private functions: We diff --git a/examples/widgets/painting/composition/composition.cpp b/examples/widgets/painting/composition/composition.cpp index 9bd71735a0..a220fb42fa 100644 --- a/examples/widgets/painting/composition/composition.cpp +++ b/examples/widgets/painting/composition/composition.cpp @@ -224,6 +224,10 @@ CompositionWidget::CompositionWidget(QWidget *parent) setWindowTitle(tr("Composition Modes")); } +CompositionWidget::~CompositionWidget() +{ +} + void CompositionWidget::nextMode() { @@ -265,6 +269,10 @@ CompositionRenderer::CompositionRenderer(QWidget *parent) #endif } +CompositionRenderer::~CompositionRenderer() +{ +} + QRectF rectangle_around(const QPointF &p, const QSizeF &size = QSize(250, 200)) { QRectF rect(p, size); @@ -371,7 +379,7 @@ void CompositionRenderer::paint(QPainter *painter) if (size() != m_previous_size) { m_previous_size = size(); - QPainter p(m_fbo.data()); + QPainter p(m_fbo.get()); p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(QRect(QPoint(0, 0), size()), Qt::transparent); p.setCompositionMode(QPainter::CompositionMode_SourceOver); @@ -382,7 +390,7 @@ void CompositionRenderer::paint(QPainter *painter) painter->beginNativePainting(); { - QPainter p(m_fbo.data()); + QPainter p(m_fbo.get()); p.beginNativePainting(); m_blitter.bind(); const QRect targetRect(QPoint(0, 0), m_fbo->size()); diff --git a/examples/widgets/painting/composition/composition.h b/examples/widgets/painting/composition/composition.h index 19150e2024..52ca7919b0 100644 --- a/examples/widgets/painting/composition/composition.h +++ b/examples/widgets/painting/composition/composition.h @@ -61,6 +61,8 @@ #include <QPainter> #include <QEvent> +#include <memory> + QT_BEGIN_NAMESPACE class QPushButton; class QRadioButton; @@ -71,7 +73,8 @@ class CompositionWidget : public QWidget Q_OBJECT public: - CompositionWidget(QWidget *parent); + explicit CompositionWidget(QWidget *parent = nullptr); + ~CompositionWidget(); public slots: void nextMode(); @@ -117,7 +120,8 @@ class CompositionRenderer : public ArthurFrame Q_PROPERTY(bool animation READ animationEnabled WRITE setAnimationEnabled) public: - CompositionRenderer(QWidget *parent); + explicit CompositionRenderer(QWidget *parent = nullptr); + ~CompositionRenderer(); void paint(QPainter *) override; @@ -188,7 +192,7 @@ private: int m_animationTimer; #if QT_CONFIG(opengl) - QScopedPointer<QFboPaintDevice> m_fbo; + std::unique_ptr<QFboPaintDevice> m_fbo; int m_pbuffer_size; // width==height==size of pbuffer uint m_base_tex; uint m_compositing_tex; diff --git a/examples/widgets/painting/composition/main.cpp b/examples/widgets/painting/composition/main.cpp index 2eaeaba2c5..1ffa29dddc 100644 --- a/examples/widgets/painting/composition/main.cpp +++ b/examples/widgets/painting/composition/main.cpp @@ -56,13 +56,13 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); + QScopedPointer<QStyle> arthurStyle(new ArthurStyle()); CompositionWidget compWidget(nullptr); - QStyle *arthurStyle = new ArthurStyle(); - compWidget.setStyle(arthurStyle); + compWidget.setStyle(arthurStyle.data()); const QList<QWidget *> widgets = compWidget.findChildren<QWidget *>(); for (QWidget *w : widgets) - w->setStyle(arthurStyle); + w->setStyle(arthurStyle.data()); compWidget.show(); return app.exec(); diff --git a/examples/widgets/painting/gradients/gradients.cpp b/examples/widgets/painting/gradients/gradients.cpp index 8df45be8d9..a4528ce06f 100644 --- a/examples/widgets/painting/gradients/gradients.cpp +++ b/examples/widgets/painting/gradients/gradients.cpp @@ -72,7 +72,7 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent) setPalette(pal); } else { - setAttribute(Qt::WA_NoBackground); + setAttribute(Qt::WA_OpaquePaintEvent); } QPolygonF points; diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp index f07d0ddee3..963165ff81 100644 --- a/examples/widgets/tools/i18n/languagechooser.cpp +++ b/examples/widgets/tools/i18n/languagechooser.cpp @@ -163,11 +163,8 @@ QStringList LanguageChooser::findQmFiles() QDir dir(":/translations"); QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files, QDir::Name); - QMutableStringListIterator i(fileNames); - while (i.hasNext()) { - i.next(); - i.setValue(dir.filePath(i.value())); - } + for (QString &fileName : fileNames) + fileName = dir.filePath(fileName); return fileNames; } diff --git a/examples/widgets/tools/plugandpaint/app/paintarea.cpp b/examples/widgets/tools/plugandpaint/app/paintarea.cpp index 4295e04cc0..e225d78398 100644 --- a/examples/widgets/tools/plugandpaint/app/paintarea.cpp +++ b/examples/widgets/tools/plugandpaint/app/paintarea.cpp @@ -59,7 +59,7 @@ PaintArea::PaintArea(QWidget *parent) : QWidget(parent) { setAttribute(Qt::WA_StaticContents); - setAttribute(Qt::WA_NoBackground); + setAttribute(Qt::WA_OpaquePaintEvent); theImage.fill(qRgb(255, 255, 255)); } diff --git a/examples/widgets/widgets/icons/mainwindow.cpp b/examples/widgets/widgets/icons/mainwindow.cpp index 0cf11c978d..91e98ff896 100644 --- a/examples/widgets/widgets/icons/mainwindow.cpp +++ b/examples/widgets/widgets/icons/mainwindow.cpp @@ -55,6 +55,8 @@ #include "imagedelegate.h" #include "mainwindow.h" +#include <memory> + //! [40] enum { OtherSize = QStyle::PM_CustomBase }; //! [40] @@ -514,8 +516,8 @@ void MainWindow::checkCurrentStyle() const QList<QAction *> actions = styleActionGroup->actions(); for (QAction *action : actions) { const QString styleName = action->data().toString(); - QScopedPointer<QStyle> candidate(QStyleFactory::create(styleName)); - Q_ASSERT(!candidate.isNull()); + const std::unique_ptr<QStyle> candidate{QStyleFactory::create(styleName)}; + Q_ASSERT(candidate); if (candidate->metaObject()->className() == QApplication::style()->metaObject()->className()) { action->trigger(); |