mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 02:06:08 +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());
|
subMenuRestore->setIcon(CIcons::load16());
|
||||||
subMenuResetPositions->setIcon(CIcons::refresh16());
|
subMenuResetPositions->setIcon(CIcons::refresh16());
|
||||||
subMenuRestore->addActions(this->getInfoAreaRestoreActions(subMenuRestore));
|
subMenuRestore->addActions(this->getInfoAreaRestoreActions(subMenuRestore));
|
||||||
subMenuDisplay->addActions(this->getInfoAreaSelectActions(subMenuDisplay));
|
subMenuDisplay->addActions(this->getInfoAreaSelectActions(false, subMenuDisplay));
|
||||||
subMenuResetPositions->addActions(this->getInfoAreaResetPositionActions(subMenuResetPositions));
|
subMenuResetPositions->addActions(this->getInfoAreaResetPositionActions(subMenuResetPositions));
|
||||||
|
|
||||||
QSignalMapper *signalMapperToggleFloating = new QSignalMapper(menu);
|
QSignalMapper *signalMapperToggleFloating = new QSignalMapper(menu);
|
||||||
@@ -205,7 +205,7 @@ namespace BlackGui
|
|||||||
return constDockWidgets;
|
return constDockWidgets;
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<QAction *> CInfoArea::getInfoAreaSelectActions(QWidget *parent) const
|
QList<QAction *> CInfoArea::getInfoAreaSelectActions(bool withShortcut, QWidget *parent) const
|
||||||
{
|
{
|
||||||
Q_ASSERT(parent);
|
Q_ASSERT(parent);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -214,9 +214,16 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
const QPixmap pm = this->indexToPixmap(i);
|
const QPixmap pm = this->indexToPixmap(i);
|
||||||
const QString wt(dockWidgetInfoArea->windowTitleBackup());
|
const QString wt(dockWidgetInfoArea->windowTitleBackup());
|
||||||
|
static const QString keys("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
QAction *action = new QAction(QIcon(pm), wt, parent);
|
QAction *action = new QAction(QIcon(pm), wt, parent);
|
||||||
action->setData(i);
|
action->setData(i);
|
||||||
action->setObjectName(this->objectName().append(":getInfoAreaSelectActions:").append(wt));
|
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);
|
connect(action, &QAction::triggered, this, &CInfoArea::selectAreaByAction);
|
||||||
actions.append(action);
|
actions.append(action);
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
@@ -71,8 +71,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Create a list of actions to select the info areas.
|
//! Create a list of actions to select the info areas.
|
||||||
//! This could be used in a menu or somewhere else.
|
//! This could be used in a menu or somewhere else.
|
||||||
|
//! \param withShortcut automatically add a shortcut
|
||||||
//! \param parent which will own the action (deletion)
|
//! \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.
|
//! 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.
|
//! This could be used in a menu or somewhere else.
|
||||||
@@ -272,7 +273,6 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Tab bar index changed
|
//! Tab bar index changed
|
||||||
void ps_onTabBarIndexChanged(int tabBarIndex);
|
void ps_onTabBarIndexChanged(int tabBarIndex);
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|||||||
@@ -89,12 +89,12 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_InfoAreas">
|
<widget class="QMenu" name="menu_InfoAreas">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Info areas</string>
|
<string>&Info areas</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Mapping">
|
<widget class="QMenu" name="menu_Mapping">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Mapping</string>
|
<string>&Mapping</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="menu_MappingMaxData"/>
|
<addaction name="menu_MappingMaxData"/>
|
||||||
<addaction name="menu_MappingMaxMapping"/>
|
<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->menu_InfoAreas, Q_FUNC_INFO, "missing info areas");
|
||||||
Q_ASSERT_X(ui->comp_MainInfoArea, Q_FUNC_INFO, "missing main area");
|
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());
|
QString resourceDir(CBuildConfig::getSwiftShareDir());
|
||||||
if (!resourceDir.isEmpty() && QDir(resourceDir).exists())
|
if (!resourceDir.isEmpty() && QDir(resourceDir).exists())
|
||||||
|
|||||||
@@ -269,7 +269,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_InfoAreas">
|
<widget class="QMenu" name="menu_InfoAreas">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Info areas</string>
|
<string>&Info areas</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_Window">
|
<widget class="QMenu" name="menu_Window">
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ void SwiftGuiStd::initMenus()
|
|||||||
sGui->addMenuInternals(*ui->menu_Internals);
|
sGui->addMenuInternals(*ui->menu_Internals);
|
||||||
sGui->addMenuWindow(*ui->menu_Window);
|
sGui->addMenuWindow(*ui->menu_Window);
|
||||||
sGui->addMenuHelp(*ui->menu_Help);
|
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
|
// for hotkeys
|
||||||
const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
|
const QString swift(CGuiActionBindHandler::pathSwiftPilotClient());
|
||||||
|
|||||||
Reference in New Issue
Block a user