mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 04:25:35 +08:00
refs #325, improved info area
* signal when tab bar is changed (goal: reload in components when info area changes) * tab bar locking (avoid unintended floating)
This commit is contained in:
@@ -57,6 +57,14 @@ namespace BlackGui
|
|||||||
menu->addAction(CIcons::dockTop16(), "Dock all", this, SLOT(dockAllWidgets()));
|
menu->addAction(CIcons::dockTop16(), "Dock all", this, SLOT(dockAllWidgets()));
|
||||||
menu->addAction(CIcons::floatAll16(), "Float all", this, SLOT(floatAllWidgets()));
|
menu->addAction(CIcons::floatAll16(), "Float all", this, SLOT(floatAllWidgets()));
|
||||||
menu->addAction(CIcons::floatOne16(), "Dock / float info area", this, SLOT(toggleFloating()));
|
menu->addAction(CIcons::floatOne16(), "Dock / float info area", this, SLOT(toggleFloating()));
|
||||||
|
QAction *lockTabBarMenuAction = new QAction(menu);
|
||||||
|
lockTabBarMenuAction->setObjectName(this->objectName().append("LockTabBar"));
|
||||||
|
lockTabBarMenuAction->setIconText("Lock tab bar");
|
||||||
|
lockTabBarMenuAction->setIcon(CIcons::lockClosed16());
|
||||||
|
lockTabBarMenuAction->setCheckable(true);
|
||||||
|
lockTabBarMenuAction->setChecked(this->m_lockTabBar);
|
||||||
|
menu->addAction(lockTabBarMenuAction);
|
||||||
|
connect(lockTabBarMenuAction, &QAction::toggled, this, &CInfoArea::ps_toggleTabBarLocked);
|
||||||
|
|
||||||
bool c = false;
|
bool c = false;
|
||||||
if (!this->m_dockableWidgets.isEmpty())
|
if (!this->m_dockableWidgets.isEmpty())
|
||||||
@@ -143,9 +151,9 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
if (!infoArea) return false;
|
if (!infoArea) return false;
|
||||||
if (infoArea->isFloating()) return false;
|
if (infoArea->isFloating()) return false;
|
||||||
int i = getSelectedInfoAreaIndex();
|
int tabBarIndex = getSelectedTabBarIndex();
|
||||||
if (i < 0 || i >= this->m_dockableWidgets.size()) return false;
|
if (tabBarIndex < 0 || tabBarIndex >= this->m_dockableWidgets.size()) return false;
|
||||||
return this->m_dockableWidgets.at(i) == infoArea;
|
return this->getDockableWidgetByTabBarIndex(tabBarIndex) == infoArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInfoArea::dockAllWidgets()
|
void CInfoArea::dockAllWidgets()
|
||||||
@@ -294,7 +302,10 @@ namespace BlackGui
|
|||||||
// East / West does not work (shown, but area itself empty)
|
// East / West does not work (shown, but area itself empty)
|
||||||
// South does not have any effect
|
// South does not have any effect
|
||||||
this->m_tabBar->setShape(QTabBar::TriangularSouth);
|
this->m_tabBar->setShape(QTabBar::TriangularSouth);
|
||||||
|
|
||||||
|
// signals
|
||||||
connect(this->m_tabBar, &QTabBar::tabBarDoubleClicked, this, &CInfoArea::ps_tabBarDoubleClicked);
|
connect(this->m_tabBar, &QTabBar::tabBarDoubleClicked, this, &CInfoArea::ps_tabBarDoubleClicked);
|
||||||
|
connect(this->m_tabBar, &QTabBar::currentChanged, this, &CInfoArea::tabBarCurrentChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->countDockedWidgets() > 0)
|
if (this->countDockedWidgets() > 0)
|
||||||
@@ -393,7 +404,8 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CInfoArea::ps_tabBarDoubleClicked(int tabBarIndex)
|
void CInfoArea::ps_tabBarDoubleClicked(int tabBarIndex)
|
||||||
{
|
{
|
||||||
CDockWidgetInfoArea *dw = this->getDockableWidgetByTabIndex(tabBarIndex);
|
if (this->m_lockTabBar) return;
|
||||||
|
CDockWidgetInfoArea *dw = this->getDockableWidgetByTabBarIndex(tabBarIndex);
|
||||||
if (!dw) return;
|
if (!dw) return;
|
||||||
dw->toggleFloating();
|
dw->toggleFloating();
|
||||||
}
|
}
|
||||||
@@ -449,6 +461,11 @@ namespace BlackGui
|
|||||||
this->adjustSizeForAllDockWidgets();
|
this->adjustSizeForAllDockWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CInfoArea::ps_toggleTabBarLocked(bool locked)
|
||||||
|
{
|
||||||
|
this->m_lockTabBar = locked;
|
||||||
|
}
|
||||||
|
|
||||||
void CInfoArea::ps_setTabBarPosition(QTabWidget::TabPosition position)
|
void CInfoArea::ps_setTabBarPosition(QTabWidget::TabPosition position)
|
||||||
{
|
{
|
||||||
Q_ASSERT(position == QTabWidget::North || position == QTabWidget::South);
|
Q_ASSERT(position == QTabWidget::North || position == QTabWidget::South);
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ namespace BlackGui
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~CInfoArea() {}
|
virtual ~CInfoArea() {}
|
||||||
|
|
||||||
@@ -46,6 +45,10 @@ namespace BlackGui
|
|||||||
//! Is given widget selected. Means it is not floating, and the one selected
|
//! Is given widget selected. Means it is not floating, and the one selected
|
||||||
bool isSelectedInfoArea(const CDockWidgetInfoArea *infoArea) const;
|
bool isSelectedInfoArea(const CDockWidgetInfoArea *infoArea) const;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
//! Tab bar changed
|
||||||
|
void tabBarCurrentChanged(int index);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
//! Dock all widgets
|
//! Dock all widgets
|
||||||
void dockAllWidgets();
|
void dockAllWidgets();
|
||||||
@@ -88,6 +91,7 @@ namespace BlackGui
|
|||||||
bool m_showTabTexts = true;
|
bool m_showTabTexts = true;
|
||||||
bool m_infoAreaFloating = false; //!< whole info area floating
|
bool m_infoAreaFloating = false; //!< whole info area floating
|
||||||
bool m_showTabBar = true; //!< auto ajdust the floating widgets
|
bool m_showTabBar = true; //!< auto ajdust the floating widgets
|
||||||
|
bool m_lockTabBar = false; //!< locked means no double clicks possible
|
||||||
|
|
||||||
//! Tabify the widgets
|
//! Tabify the widgets
|
||||||
void tabifyAllWidgets();
|
void tabifyAllWidgets();
|
||||||
@@ -144,6 +148,9 @@ namespace BlackGui
|
|||||||
//! Show tab bar
|
//! Show tab bar
|
||||||
void ps_showTabBar(bool show);
|
void ps_showTabBar(bool show);
|
||||||
|
|
||||||
|
//! Toogle lock tabbar
|
||||||
|
void ps_toggleTabBarLocked(bool locked);
|
||||||
|
|
||||||
//! Tab position for docked widgets tab
|
//! Tab position for docked widgets tab
|
||||||
//! \remarks North or South working, East / West not
|
//! \remarks North or South working, East / West not
|
||||||
void ps_setTabBarPosition(QTabWidget::TabPosition position);
|
void ps_setTabBarPosition(QTabWidget::TabPosition position);
|
||||||
|
|||||||
Reference in New Issue
Block a user