Gui: fix C++20 warning: bitwise operation between different enumeration types [-Wdeprecated-enum-enum-conversion]

This commit is contained in:
wmayer
2021-12-02 09:59:31 +01:00
parent 2e5bcae6b8
commit 4f12416fa0
4 changed files with 14 additions and 16 deletions

View File

@@ -352,17 +352,16 @@ void StdCmdFreezeViews::activated(int iMsg)
getGuiApplication()->sendMsgToActiveView("GetCamera",&ppReturn);
QList<QAction*> acts = pcAction->actions();
int index = 0;
int index = 1;
for (QList<QAction*>::ConstIterator it = acts.begin()+offset; it != acts.end(); ++it, index++) {
if (!(*it)->isVisible()) {
savedViews++;
QString viewnr = QString(QObject::tr("Restore view &%1")).arg(index+1);
QString viewnr = QString(QObject::tr("Restore view &%1")).arg(index);
(*it)->setText(viewnr);
(*it)->setToolTip(QString::fromLatin1(ppReturn));
(*it)->setVisible(true);
if (index < 9) {
int accel = Qt::CTRL+Qt::Key_1;
(*it)->setShortcut(accel+index);
if (index < 10) {
(*it)->setShortcut(QKeySequence(QString::fromLatin1("CTRL+%1").arg(index)));
}
break;
}
@@ -499,9 +498,8 @@ void StdCmdFreezeViews::onRestoreViews()
acts[i+offset]->setText(viewnr);
acts[i+offset]->setToolTip(setting);
acts[i+offset]->setVisible(true);
if ( i < 9 ) {
int accel = Qt::CTRL+Qt::Key_1;
acts[i+offset]->setShortcut(accel+i);
if (i < 9) {
acts[i+offset]->setShortcut(QKeySequence(QString::fromLatin1("CTRL+%1").arg(i+1)));
}
}

View File

@@ -1255,7 +1255,7 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
ParameterGrp::handle hGrp = App::GetApplication().GetUserParameter().
GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("General");
a = menu.addAction(tr("&Copy"), this, SLOT(copy()), Qt::CTRL+Qt::Key_C);
a = menu.addAction(tr("&Copy"), this, SLOT(copy()), QKeySequence(QString::fromLatin1("CTRL+C")));
a->setEnabled(textCursor().hasSelection());
a = menu.addAction(tr("&Copy command"), this, SLOT(onCopyCommand()));
@@ -1274,11 +1274,11 @@ void PythonConsole::contextMenuEvent ( QContextMenuEvent * e )
menu.addSeparator();
a = menu.addAction(tr("&Paste"), this, SLOT(paste()), Qt::CTRL+Qt::Key_V);
a = menu.addAction(tr("&Paste"), this, SLOT(paste()), QKeySequence(QString::fromLatin1("CTRL+V")));
const QMimeData *md = QApplication::clipboard()->mimeData();
a->setEnabled( mayPasteHere && md && canInsertFromMimeData(md));
a = menu.addAction(tr("Select All"), this, SLOT(selectAll()), Qt::CTRL+Qt::Key_A);
a = menu.addAction(tr("Select All"), this, SLOT(selectAll()), QKeySequence(QString::fromLatin1("CTRL+A")));
a->setEnabled(!document()->isEmpty());
a = menu.addAction(tr("Clear console"), this, SLOT(onClearConsole()));

View File

@@ -77,10 +77,10 @@ PythonEditor::PythonEditor(QWidget* parent)
// set acelerators
QShortcut* comment = new QShortcut(this);
comment->setKey(Qt::ALT + Qt::Key_C);
comment->setKey(QKeySequence(QString::fromLatin1("ALT+C")));
QShortcut* uncomment = new QShortcut(this);
uncomment->setKey(Qt::ALT + Qt::Key_U);
uncomment->setKey(QKeySequence(QString::fromLatin1("ALT+U")));
connect(comment, SIGNAL(activated()),
this, SLOT(onComment()));
@@ -157,8 +157,8 @@ void PythonEditor::contextMenuEvent ( QContextMenuEvent * e )
QMenu* menu = createStandardContextMenu();
if (!isReadOnly()) {
menu->addSeparator();
menu->addAction( tr("Comment"), this, SLOT( onComment() ), Qt::ALT + Qt::Key_C );
menu->addAction( tr("Uncomment"), this, SLOT( onUncomment() ), Qt::ALT + Qt::Key_U );
menu->addAction( tr("Comment"), this, SLOT( onComment() ), QKeySequence(QString::fromLatin1("ALT+C")));
menu->addAction( tr("Uncomment"), this, SLOT( onUncomment() ), QKeySequence(QString::fromLatin1("ALT+U")));
}
menu->exec(e->globalPos());

View File

@@ -45,7 +45,7 @@ TextEdit::TextEdit(QWidget* parent)
//Note: Set the correct context to this shortcut as we may use several instances of this
//class at a time
QShortcut* shortcut = new QShortcut(this);
shortcut->setKey(Qt::CTRL+Qt::Key_Space);
shortcut->setKey(QKeySequence(QString::fromLatin1("CTRL+Space")));
shortcut->setContext(Qt::WidgetShortcut);
connect(shortcut, SIGNAL(activated()), this, SLOT(complete()));