From b08481763219dba6181aa455408b29a728585ee1 Mon Sep 17 00:00:00 2001 From: Geoff Hutchison Date: Sat, 13 Aug 2022 16:24:42 -0400 Subject: [PATCH] Fix some Edit and Build menu priorities Signed-off-by: Geoff Hutchison --- avogadro/qtplugins/bonding/bonding.cpp | 3 +++ avogadro/qtplugins/centroid/centroid.cpp | 9 ++++++--- .../qtplugins/coordinateeditor/coordinateeditor.cpp | 1 + avogadro/qtplugins/copypaste/copypaste.cpp | 12 ++++++++---- avogadro/qtplugins/hydrogens/hydrogens.cpp | 4 ++++ avogadro/qtplugins/insertdna/insertdna.cpp | 1 + avogadro/qtplugins/insertfragment/insertfragment.cpp | 1 + .../qtplugins/lineformatinput/lineformatinput.cpp | 2 ++ 8 files changed, 26 insertions(+), 7 deletions(-) diff --git a/avogadro/qtplugins/bonding/bonding.cpp b/avogadro/qtplugins/bonding/bonding.cpp index 15c2fd0138..fabc098782 100644 --- a/avogadro/qtplugins/bonding/bonding.cpp +++ b/avogadro/qtplugins/bonding/bonding.cpp @@ -35,6 +35,9 @@ Bonding::Bonding(QObject* parent_) m_minDistance = settings.value("bonding/minDistance", 0.32).toDouble(); m_action->setShortcut(QKeySequence("Ctrl+B")); + m_action->setProperty("menu priority", 750); + m_clearAction->setProperty("menu priority", 740); + connect(m_action, SIGNAL(triggered()), SLOT(bond())); connect(m_clearAction, SIGNAL(triggered()), SLOT(clearBonds())); connect(m_configAction, SIGNAL(triggered()), SLOT(configure())); diff --git a/avogadro/qtplugins/centroid/centroid.cpp b/avogadro/qtplugins/centroid/centroid.cpp index c0c2e1db2e..ded45a1959 100644 --- a/avogadro/qtplugins/centroid/centroid.cpp +++ b/avogadro/qtplugins/centroid/centroid.cpp @@ -20,9 +20,13 @@ Centroid::Centroid(QObject* parent_) m_centroidAction(new QAction(tr("Add Centroid"), this)), m_comAction(new QAction(tr("Add Center of Mass"), this)), m_normalAction(new QAction( - tr("Add Normal", "add a point normal to the plane of the molecule"), + tr("Add Perpendicular", "add a point normal to the plane of the molecule"), this)) { + m_centroidAction->setProperty("menu priority", 190); + m_comAction->setProperty("menu priority", 180); + m_normalAction->setProperty("menu priority", 170); + connect(m_centroidAction, SIGNAL(triggered()), SLOT(addCentroid())); connect(m_comAction, SIGNAL(triggered()), SLOT(addCenterOfMass())); connect(m_normalAction, SIGNAL(triggered()), SLOT(normal())); @@ -33,8 +37,7 @@ Centroid::~Centroid() {} QList Centroid::actions() const { QList result; - return result << m_centroidAction << m_comAction; - // << m_normal; + return result << m_centroidAction << m_comAction << m_normalAction; } QStringList Centroid::menuPath(QAction*) const diff --git a/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp b/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp index 4732ef16a0..31770ba23f 100644 --- a/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp +++ b/avogadro/qtplugins/coordinateeditor/coordinateeditor.cpp @@ -16,6 +16,7 @@ CoordinateEditor::CoordinateEditor(QObject* parent_) m_molecule(nullptr), m_action(new QAction(tr("Atomic &Coordinate Editor…"), this)) { + m_action->setProperty("menu priority", 900); connect(m_action, SIGNAL(triggered()), SLOT(triggered())); } diff --git a/avogadro/qtplugins/copypaste/copypaste.cpp b/avogadro/qtplugins/copypaste/copypaste.cpp index a3ba36845f..370341450f 100644 --- a/avogadro/qtplugins/copypaste/copypaste.cpp +++ b/avogadro/qtplugins/copypaste/copypaste.cpp @@ -34,20 +34,24 @@ CopyPaste::CopyPaste(QObject* parent_) m_clearAction(new QAction(tr("Clear"), this)), m_pasteAction(new QAction(tr("Paste"), this)) { - m_copyAction->setShortcut(QKeySequence::Copy); - m_copyAction->setIcon(QIcon::fromTheme("edit-copy")); - connect(m_copyAction, SIGNAL(triggered()), SLOT(copy())); - m_cutAction->setShortcut(QKeySequence::Cut); m_cutAction->setIcon(QIcon::fromTheme("edit-cut")); + m_cutAction->setProperty("menu priority", 550); connect(m_cutAction, SIGNAL(triggered()), SLOT(cut())); + m_copyAction->setShortcut(QKeySequence::Copy); + m_copyAction->setIcon(QIcon::fromTheme("edit-copy")); + m_copyAction->setProperty("menu priority", 540); + connect(m_copyAction, SIGNAL(triggered()), SLOT(copy())); + m_pasteAction->setShortcut(QKeySequence::Paste); m_pasteAction->setIcon(QIcon::fromTheme("edit-paste")); + m_pasteAction->setProperty("menu priority", 510); connect(m_pasteAction, SIGNAL(triggered()), SLOT(paste())); m_clearAction->setShortcut(QKeySequence::Delete); m_clearAction->setIcon(QIcon::fromTheme("edit-clear")); + m_clearAction->setProperty("menu priority", 500); connect(m_clearAction, SIGNAL(triggered()), SLOT(clear())); } diff --git a/avogadro/qtplugins/hydrogens/hydrogens.cpp b/avogadro/qtplugins/hydrogens/hydrogens.cpp index 716f5adb57..222386ecd3 100644 --- a/avogadro/qtplugins/hydrogens/hydrogens.cpp +++ b/avogadro/qtplugins/hydrogens/hydrogens.cpp @@ -20,18 +20,22 @@ Hydrogens::Hydrogens(QObject* parent_) { auto* action = new QAction(tr("&Adjust Hydrogens"), this); action->setShortcut(QKeySequence("Ctrl+Alt+H")); + action->setProperty("menu priority", 760); connect(action, SIGNAL(triggered()), SLOT(adjustHydrogens())); m_actions.append(action); action = new QAction(tr("Add Hydrogens"), this); + action->setProperty("menu priority", 750); connect(action, SIGNAL(triggered()), SLOT(addHydrogens())); m_actions.append(action); action = new QAction(tr("Remove E&xtra Hydrogens"), this); + action->setProperty("menu priority", 740); connect(action, SIGNAL(triggered()), SLOT(removeHydrogens())); m_actions.append(action); action = new QAction(tr("&Remove All Hydrogens"), this); + action->setProperty("menu priority", 730); connect(action, SIGNAL(triggered()), SLOT(removeAllHydrogens())); m_actions.append(action); } diff --git a/avogadro/qtplugins/insertdna/insertdna.cpp b/avogadro/qtplugins/insertdna/insertdna.cpp index 9e879f1b18..4e95006080 100644 --- a/avogadro/qtplugins/insertdna/insertdna.cpp +++ b/avogadro/qtplugins/insertdna/insertdna.cpp @@ -41,6 +41,7 @@ InsertDna::InsertDna(QObject* parent_) m_molecule(nullptr), m_dialog(nullptr) { auto* action = new QAction(tr("DNA/RNA…"), this); + action->setProperty("menu priority", 870); connect(action, SIGNAL(triggered()), SLOT(showDialog())); m_actions.append(action); diff --git a/avogadro/qtplugins/insertfragment/insertfragment.cpp b/avogadro/qtplugins/insertfragment/insertfragment.cpp index 663e18c2a2..a8b1e4041f 100644 --- a/avogadro/qtplugins/insertfragment/insertfragment.cpp +++ b/avogadro/qtplugins/insertfragment/insertfragment.cpp @@ -30,6 +30,7 @@ InsertFragment::InsertFragment(QObject* parent_) m_moleculeDialog(nullptr), m_reader(nullptr), m_molecule(nullptr) { auto* action = new QAction(tr("Fragment…"), this); + action->setProperty("menu priority", 890); action->setData("molecules"); // will also work for crystals connect(action, SIGNAL(triggered()), SLOT(showDialog())); m_actions.append(action); diff --git a/avogadro/qtplugins/lineformatinput/lineformatinput.cpp b/avogadro/qtplugins/lineformatinput/lineformatinput.cpp index 1065f8e7de..50decb8e99 100644 --- a/avogadro/qtplugins/lineformatinput/lineformatinput.cpp +++ b/avogadro/qtplugins/lineformatinput/lineformatinput.cpp @@ -29,11 +29,13 @@ LineFormatInput::LineFormatInput(QObject* parent_) m_molecule(nullptr) { auto* action = new QAction(tr("SMILES…"), this); + action->setProperty("menu priority", 800); action->setData("SMILES"); connect(action, SIGNAL(triggered()), SLOT(showDialog())); m_actions.append(action); action = new QAction(tr("InChI…"), this); + action->setProperty("menu priority", 810); action->setData("InChI"); connect(action, SIGNAL(triggered()), SLOT(showDialog())); m_actions.append(action);