mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 13:36:48 +08:00
Ref T30, use font shortcuts with dock widget
(instead of view)
This commit is contained in:
committed by
Mathew Sutcliffe
parent
4acf496aa4
commit
c39b8cd7fd
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "blackgui/components/marginsinput.h"
|
||||
#include "blackgui/menus/fontmenus.h"
|
||||
#include "blackgui/dockwidget.h"
|
||||
#include "blackgui/guiapplication.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
@@ -37,6 +38,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui::Components;
|
||||
using namespace BlackGui::Settings;
|
||||
using namespace BlackGui::Menus;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -54,6 +56,7 @@ namespace BlackGui
|
||||
this->m_input->setMaximumWidth(150);
|
||||
this->m_marginMenuAction = new QWidgetAction(this);
|
||||
this->m_marginMenuAction->setDefaultWidget(this->m_input);
|
||||
this->m_fontMenu = new CFontMenu(this, true, Qt::WidgetWithChildrenShortcut);
|
||||
|
||||
this->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(this, &CDockWidget::customContextMenuRequested, this, &CDockWidget::ps_showContextMenu);
|
||||
@@ -341,6 +344,13 @@ namespace BlackGui
|
||||
contextMenu->addAction(BlackMisc::CIcons::floatOne16(), "Float", this, &CDockWidget::toggleFloating);
|
||||
}
|
||||
|
||||
// Font actions
|
||||
Q_ASSERT_X(m_fontMenu, Q_FUNC_INFO, "Missing menu object");
|
||||
if (m_fontMenu)
|
||||
{
|
||||
contextMenu->addActions(m_fontMenu->getActions());
|
||||
}
|
||||
|
||||
// State actions (windows state)
|
||||
contextMenu->addAction(BlackMisc::CIcons::load16(), "Restore", this, &CDockWidget::restoreFromSettings);
|
||||
contextMenu->addAction(BlackMisc::CIcons::save16(), "Save state", this, &CDockWidget::saveCurrentStateToSettings);
|
||||
|
||||
@@ -36,6 +36,7 @@ class QWidgetAction;
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Components { class CMarginsInput; }
|
||||
namespace Menus { class CFontMenu; }
|
||||
|
||||
//! \brief Our base class for dockable widgets containing some specialized functionality on top of QDockWidget.
|
||||
//! \details We currently use dockable widgets either as "info area" or "info bar" dockable widget.
|
||||
@@ -224,6 +225,7 @@ namespace BlackGui
|
||||
QWidget *m_titleBarWidgetOriginal = nullptr; //!< the original title bar
|
||||
QWidgetAction *m_marginMenuAction = nullptr; //!< menu widget(!) action for margin widget
|
||||
Components::CMarginsInput *m_input = nullptr; //!< margins widget
|
||||
Menus::CFontMenu *m_fontMenu = nullptr; //!< Font menu
|
||||
CManagedStatusBar m_statusBar; //!< status bar when floating
|
||||
QString m_windowTitleBackup; //!< original title, even if the widget title is deleted for layout purposes
|
||||
QSize m_preferredSizeWhenFloating; //!< preferred size when floating 1st time
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace BlackGui
|
||||
copy->setObjectName("Copy rows for " + this->objectName());
|
||||
|
||||
// Font menus
|
||||
m_fontMenu = new CFontMenu(this, true);
|
||||
// m_fontMenu = new CFontMenu(this, true);
|
||||
}
|
||||
|
||||
bool CViewBaseNonTemplate::setParentDockWidgetInfoArea(CDockWidgetInfoArea *parentDockableWidget)
|
||||
@@ -356,7 +356,7 @@ namespace BlackGui
|
||||
if (this->m_menus.testFlag(MenuCopy)) { menuActions.addActions(this->initMenuActions(MenuCopy)); }
|
||||
if (this->m_menus.testFlag(MenuCut)) { menuActions.addActions(this->initMenuActions(MenuCut)); }
|
||||
if (this->m_menus.testFlag(MenuPaste)) { menuActions.addActions(this->initMenuActions(MenuPaste)); }
|
||||
if (this->m_menus.testFlag(MenuFont))
|
||||
if (this->m_menus.testFlag(MenuFont) && m_fontMenu)
|
||||
{
|
||||
menuActions.addActions(m_fontMenu->getActions(), CMenuAction::pathFont());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user