mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #883, shortcuts for dock widgets
This commit is contained in:
committed by
Mathew Sutcliffe
parent
c460505d2e
commit
abbcd18d82
@@ -105,7 +105,7 @@ namespace BlackGui
|
||||
subMenuRestore->setIcon(CIcons::load16());
|
||||
subMenuResetPositions->setIcon(CIcons::refresh16());
|
||||
subMenuRestore->addActions(this->getInfoAreaRestoreActions(subMenuRestore));
|
||||
subMenuDisplay->addActions(this->getInfoAreaSelectActions(subMenuDisplay));
|
||||
subMenuDisplay->addActions(this->getInfoAreaSelectActions(false, subMenuDisplay));
|
||||
subMenuResetPositions->addActions(this->getInfoAreaResetPositionActions(subMenuResetPositions));
|
||||
|
||||
QSignalMapper *signalMapperToggleFloating = new QSignalMapper(menu);
|
||||
@@ -205,7 +205,7 @@ namespace BlackGui
|
||||
return constDockWidgets;
|
||||
}
|
||||
|
||||
QList<QAction *> CInfoArea::getInfoAreaSelectActions(QWidget *parent) const
|
||||
QList<QAction *> CInfoArea::getInfoAreaSelectActions(bool withShortcut, QWidget *parent) const
|
||||
{
|
||||
Q_ASSERT(parent);
|
||||
int i = 0;
|
||||
@@ -214,9 +214,16 @@ namespace BlackGui
|
||||
{
|
||||
const QPixmap pm = this->indexToPixmap(i);
|
||||
const QString wt(dockWidgetInfoArea->windowTitleBackup());
|
||||
static const QString keys("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
QAction *action = new QAction(QIcon(pm), wt, parent);
|
||||
action->setData(i);
|
||||
action->setObjectName(this->objectName().append(":getInfoAreaSelectActions:").append(wt));
|
||||
if (withShortcut && i < keys.length())
|
||||
{
|
||||
static const QString ks("Ctrl+%1");
|
||||
action->setShortcut(QKeySequence(ks.arg(keys.at(i))));
|
||||
}
|
||||
|
||||
connect(action, &QAction::triggered, this, &CInfoArea::selectAreaByAction);
|
||||
actions.append(action);
|
||||
i++;
|
||||
|
||||
@@ -71,8 +71,9 @@ namespace BlackGui
|
||||
|
||||
//! Create a list of actions to select the info areas.
|
||||
//! This could be used in a menu or somewhere else.
|
||||
//! \param withShortcut automatically add a shortcut
|
||||
//! \param parent which will own the action (deletion)
|
||||
QList<QAction *> getInfoAreaSelectActions(QWidget *parent) const;
|
||||
QList<QAction *> getInfoAreaSelectActions(bool withShortcut, QWidget *parent) const;
|
||||
|
||||
//! Create a list of actions to select the info areas and toogle its floating state.
|
||||
//! This could be used in a menu or somewhere else.
|
||||
@@ -272,7 +273,6 @@ namespace BlackGui
|
||||
|
||||
//! Tab bar index changed
|
||||
void ps_onTabBarIndexChanged(int tabBarIndex);
|
||||
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -89,12 +89,12 @@
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_InfoAreas">
|
||||
<property name="title">
|
||||
<string>Info areas</string>
|
||||
<string>&Info areas</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Mapping">
|
||||
<property name="title">
|
||||
<string>Mapping</string>
|
||||
<string>&Mapping</string>
|
||||
</property>
|
||||
<addaction name="menu_MappingMaxData"/>
|
||||
<addaction name="menu_MappingMaxMapping"/>
|
||||
|
||||
@@ -54,7 +54,7 @@ void CSwiftData::initDynamicMenus()
|
||||
{
|
||||
Q_ASSERT_X(ui->menu_InfoAreas, Q_FUNC_INFO, "missing info areas");
|
||||
Q_ASSERT_X(ui->comp_MainInfoArea, Q_FUNC_INFO, "missing main area");
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(ui->menu_InfoAreas));
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
|
||||
|
||||
QString resourceDir(CBuildConfig::getSwiftShareDir());
|
||||
if (!resourceDir.isEmpty() && QDir(resourceDir).exists())
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_InfoAreas">
|
||||
<property name="title">
|
||||
<string>Info areas</string>
|
||||
<string>&Info areas</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_Window">
|
||||
|
||||
@@ -71,7 +71,7 @@ void SwiftGuiStd::initMenus()
|
||||
sGui->addMenuInternals(*ui->menu_Internals);
|
||||
sGui->addMenuWindow(*ui->menu_Window);
|
||||
sGui->addMenuHelp(*ui->menu_Help);
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(ui->menu_InfoAreas));
|
||||
ui->menu_InfoAreas->addActions(ui->comp_MainInfoArea->getInfoAreaSelectActions(true, ui->menu_InfoAreas));
|
||||
|
||||
// for hotkeys
|
||||
const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
|
||||
|
||||
Reference in New Issue
Block a user