Helper function to get preferred delete key depending on platform

This commit is contained in:
wmayer
2025-04-28 09:57:15 +02:00
committed by Benjamin Nauck
parent e850cc9824
commit 2a7498c930
13 changed files with 40 additions and 71 deletions

View File

@@ -63,6 +63,7 @@
#include "MergeDocuments.h"
#include "Navigation/NavigationStyle.h"
#include "Placement.h"
#include "Tools.h"
#include "Transform.h"
#include "View3DInventor.h"
#include "View3DInventorViewer.h"
@@ -1320,11 +1321,7 @@ StdCmdDelete::StdCmdDelete()
sWhatsThis = "Std_Delete";
sStatusTip = QT_TR_NOOP("Deletes the selected objects");
sPixmap = "edit-delete";
#ifdef FC_OS_MACOSX
sAccel = "Backspace";
#else
sAccel = keySequenceToAccel(QKeySequence::Delete);
#endif
sAccel = keySequenceToAccel(QtTools::deleteKeySequence());
eType = ForEdit;
}

View File

@@ -47,6 +47,13 @@ public:
uint searchkey = (ke->modifiers() | ke->key()) & ~(Qt::KeypadModifier | Qt::GroupSwitchModifier);
return ks == QKeySequence(searchkey);
}
static QKeySequence::StandardKey deleteKeySequence() {
#ifdef FC_OS_MACOSX
return QKeySequence::Backspace;
#else
return QKeySequence::Delete;
#endif
}
};
} // namespace Gui