diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-05-25 17:34:15 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-05-25 19:53:27 +0000 |
commit | f49dedadfca3474b18478ca74ec774110768682f (patch) | |
tree | 9d5d66e8d8e28a85259cfe58dbfa414b85f00cdf | |
parent | fb4fbc21c4b5ff6ce1719add142e96d567918940 (diff) | |
download | qttools-f49dedadfca3474b18478ca74ec774110768682f.tar.gz |
Qt Designer: Fix remaining warnings about QString from ASCII conversion
Rewrite the message handler to take a QString and fix occurrences in
actions code, fixing:
src\designer\qdesigner.cpp(107): warning C4996: 'QString::QString': Use fromUtf8, QStringLiteral, or QLatin1String
src\designer\qdesigner_actions.cpp(325): warning C4996: 'QString::QString': Use fromUtf8, QStringLiteral, or QLatin1String
src\designer\qdesigner_actions.cpp(509): warning C4996: 'QString::QString': Use fromUtf8, QStringLiteral, or QLatin1String
src\designer\qdesigner_actions.cpp(515): warning C4996: 'QString::QString': Use fromUtf8, QStringLiteral, or QLatin1String
Change-Id: I9841cfff7fc7ab125168cd771eac55bfa7efe433
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 687b8d957a2288ce27ca6d3dd2a267aa6b85212e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/designer/src/designer/qdesigner.cpp | 7 | ||||
-rw-r--r-- | src/designer/src/designer/qdesigner.h | 2 | ||||
-rw-r--r-- | src/designer/src/designer/qdesigner_actions.cpp | 9 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/designer/src/designer/qdesigner.cpp b/src/designer/src/designer/qdesigner.cpp index 75ab2b01b..1e62ed504 100644 --- a/src/designer/src/designer/qdesigner.cpp +++ b/src/designer/src/designer/qdesigner.cpp @@ -68,7 +68,7 @@ static void designerMessageHandler(QtMsgType type, const QMessageLogContext &con previousMessageHandler(type, context, msg); return; } - designerApp->showErrorMessage(qPrintable(msg)); + designerApp->showErrorMessage(msg); } QDesigner::QDesigner(int &argc, char **argv) @@ -94,10 +94,11 @@ QDesigner::~QDesigner() delete m_client; } -void QDesigner::showErrorMessage(const char *message) +void QDesigner::showErrorMessage(const QString &message) { // strip the prefix - const QString qMessage = QString::fromUtf8(message + qstrlen(designerWarningPrefix)); + const QString qMessage = + message.right(message.size() - int(qstrlen(designerWarningPrefix))); // If there is no main window yet, just store the message. // The QErrorMessage would otherwise be hidden by the main window. if (m_mainWindow) { diff --git a/src/designer/src/designer/qdesigner.h b/src/designer/src/designer/qdesigner.h index 7d58db26b..91f36c538 100644 --- a/src/designer/src/designer/qdesigner.h +++ b/src/designer/src/designer/qdesigner.h @@ -73,7 +73,7 @@ signals: void initialized(); public slots: - void showErrorMessage(const char *message); + void showErrorMessage(const QString &message); private slots: void callCreateForm(); diff --git a/src/designer/src/designer/qdesigner_actions.cpp b/src/designer/src/designer/qdesigner_actions.cpp index ea296fc27..ff11079b5 100644 --- a/src/designer/src/designer/qdesigner_actions.cpp +++ b/src/designer/src/designer/qdesigner_actions.cpp @@ -320,7 +320,8 @@ QDesignerActions::QDesignerActions(QDesignerWorkbench *workbench) shortcuts.append(QKeySequence(Qt::Key_Escape)); m_editWidgetsAction->setShortcuts(shortcuts); QIcon fallback(m_core->resourceLocation() + QStringLiteral("/widgettool.png")); - m_editWidgetsAction->setIcon(QIcon::fromTheme("designer-edit-widget", fallback)); + m_editWidgetsAction->setIcon(QIcon::fromTheme(QStringLiteral("designer-edit-widget"), + fallback)); connect(m_editWidgetsAction, &QAction::triggered, this, &QDesignerActions::editWidgetsSlot); m_editWidgetsAction->setChecked(true); m_editWidgetsAction->setEnabled(false); @@ -504,13 +505,15 @@ QAction *QDesignerActions::createRecentFilesMenu() } updateRecentFileActions(); menu->addSeparator(); - act = new QAction(QIcon::fromTheme("edit-clear"), tr("Clear &Menu"), this); + act = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear")), + tr("Clear &Menu"), this); act->setObjectName(QStringLiteral("__qt_action_clear_menu_")); connect(act, &QAction::triggered, this, &QDesignerActions::clearRecentFiles); m_recentFilesActions->addAction(act); menu->addAction(act); - act = new QAction(QIcon::fromTheme("document-open-recent"), tr("&Recent Forms"), this); + act = new QAction(QIcon::fromTheme(QStringLiteral("document-open-recent")), + tr("&Recent Forms"), this); act->setMenu(menu); return act; } |