Ref T184, private/protected slots -> private/protected

This commit is contained in:
Klaus Basan
2017-11-08 04:17:45 +01:00
parent 72d3756605
commit 67711ba55e
5 changed files with 68 additions and 70 deletions

View File

@@ -27,8 +27,8 @@ namespace BlackGui
{ {
ui->setupUi(this); ui->setupUi(this);
this->initInfoArea(); this->initInfoArea();
this->ps_setTabBarPosition(QTabWidget::North); this->setTabBarPosition(QTabWidget::North);
this->ps_toggleTabBarLocked(true); this->toggleTabBarLocked(true);
} }
CCockpitInfoAreaComponent::~CCockpitInfoAreaComponent() CCockpitInfoAreaComponent::~CCockpitInfoAreaComponent()

View File

@@ -25,7 +25,7 @@ namespace BlackGui
{ {
ui->setupUi(this); ui->setupUi(this);
initInfoArea(); initInfoArea();
ps_toggleTabBarLocked(true); toggleTabBarLocked(true);
} }
CCoreInfoAreaComponent::~CCoreInfoAreaComponent() CCoreInfoAreaComponent::~CCoreInfoAreaComponent()

View File

@@ -45,7 +45,7 @@ namespace BlackGui
ui->setupUi(this); ui->setupUi(this);
this->initInfoArea(); // init base class this->initInfoArea(); // init base class
this->setWindowIcon(CIcons::swiftDatabase24()); this->setWindowIcon(CIcons::swiftDatabase24());
this->ps_setTabBarPosition(QTabWidget::North); this->setTabBarPosition(QTabWidget::North);
} }
CDataInfoAreaComponent::~CDataInfoAreaComponent() CDataInfoAreaComponent::~CDataInfoAreaComponent()

View File

@@ -43,7 +43,7 @@ namespace BlackGui
QMainWindow(parent), QMainWindow(parent),
CEnableForFramelessWindow(CEnableForFramelessWindow::WindowTool, false, "framelessInfoArea", this) CEnableForFramelessWindow(CEnableForFramelessWindow::WindowTool, false, "framelessInfoArea", this)
{ {
this->ps_setWholeInfoAreaFloating(m_infoAreaFloating); this->setWholeInfoAreaFloating(m_infoAreaFloating);
} }
CInfoArea::~CInfoArea() CInfoArea::~CInfoArea()
@@ -63,18 +63,18 @@ namespace BlackGui
Q_ASSERT(!m_dockWidgetInfoAreas.isEmpty()); Q_ASSERT(!m_dockWidgetInfoAreas.isEmpty());
} }
this->ps_setDockArea(Qt::TopDockWidgetArea); this->setDockArea(Qt::TopDockWidgetArea);
this->connectTopLevelChanged(); this->connectTopLevelChanged();
this->setFeaturesForDockableWidgets(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable); this->setFeaturesForDockableWidgets(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable);
this->tabifyAllWidgets(); this->tabifyAllWidgets();
// context menu // context menu
this->setContextMenuPolicy(Qt::CustomContextMenu); this->setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &CInfoArea::customContextMenuRequested, this, &CInfoArea::ps_showContextMenu); connect(this, &CInfoArea::customContextMenuRequested, this, &CInfoArea::showContextMenu);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CInfoArea::ps_onStyleSheetChanged); connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CInfoArea::onStyleSheetChanged);
// initial style sheet setting // initial style sheet setting
this->ps_onStyleSheetChanged(); this->onStyleSheetChanged();
// status bar // status bar
if (this->statusBar()) if (this->statusBar())
@@ -100,7 +100,7 @@ namespace BlackGui
lockTabBarMenuAction->setCheckable(true); lockTabBarMenuAction->setCheckable(true);
lockTabBarMenuAction->setChecked(m_lockTabBar); lockTabBarMenuAction->setChecked(m_lockTabBar);
menu->addAction(lockTabBarMenuAction); menu->addAction(lockTabBarMenuAction);
connect(lockTabBarMenuAction, &QAction::toggled, this, &CInfoArea::ps_toggleTabBarLocked); connect(lockTabBarMenuAction, &QAction::toggled, this, &CInfoArea::toggleTabBarLocked);
menu->addSeparator(); menu->addSeparator();
QMenu *subMenuToggleFloat = new QMenu("Toggle Float/Dock", menu); QMenu *subMenuToggleFloat = new QMenu("Toggle Float/Dock", menu);
@@ -152,7 +152,7 @@ namespace BlackGui
showMenuText->setCheckable(true); showMenuText->setCheckable(true);
showMenuText->setChecked(m_showTabTexts); showMenuText->setChecked(m_showTabTexts);
menu->addAction(showMenuText); menu->addAction(showMenuText);
connect(showMenuText, &QAction::toggled, this, &CInfoArea::ps_showTabTexts); connect(showMenuText, &QAction::toggled, this, &CInfoArea::showTabTexts);
// auto adjust floating widgets // auto adjust floating widgets
QAction *showTabbar = new QAction(menu); QAction *showTabbar = new QAction(menu);
@@ -162,10 +162,10 @@ namespace BlackGui
showTabbar->setCheckable(true); showTabbar->setCheckable(true);
showTabbar->setChecked(m_showTabBar); showTabbar->setChecked(m_showTabBar);
menu->addAction(showTabbar); menu->addAction(showTabbar);
connect(showTabbar, &QAction::toggled, this, &CInfoArea::ps_showTabBar); connect(showTabbar, &QAction::toggled, this, &CInfoArea::showTabBar);
// tab bar position // tab bar position
menu->addAction(CIcons::dockBottom16(), "Toogle tabbar position", this, SLOT(ps_toggleTabBarPosition())); menu->addAction(CIcons::dockBottom16(), "Toogle tabbar position", this, SLOT(toggleTabBarPosition()));
Q_UNUSED(c); Q_UNUSED(c);
} }
} }
@@ -354,7 +354,7 @@ namespace BlackGui
void CInfoArea::toggleFloatingWholeInfoArea() void CInfoArea::toggleFloatingWholeInfoArea()
{ {
this->ps_setWholeInfoAreaFloating(!m_infoAreaFloating); this->setWholeInfoAreaFloating(!m_infoAreaFloating);
} }
void CInfoArea::toggleFloatingByIndex(int areaIndex) void CInfoArea::toggleFloatingByIndex(int areaIndex)
@@ -499,7 +499,7 @@ namespace BlackGui
} }
} }
void CInfoArea::ps_setDockArea(Qt::DockWidgetArea area) void CInfoArea::setDockArea(Qt::DockWidgetArea area)
{ {
for (CDockWidgetInfoArea *dw : m_dockWidgetInfoAreas) for (CDockWidgetInfoArea *dw : m_dockWidgetInfoAreas)
{ {
@@ -511,7 +511,7 @@ namespace BlackGui
} }
} }
void CInfoArea::ps_setWholeInfoAreaFloating(bool floating) void CInfoArea::setWholeInfoAreaFloating(bool floating)
{ {
// float whole info area // float whole info area
m_infoAreaFloating = floating; m_infoAreaFloating = floating;
@@ -599,8 +599,8 @@ namespace BlackGui
m_tabBar->setShape(QTabBar::TriangularSouth); m_tabBar->setShape(QTabBar::TriangularSouth);
// signals // signals
connect(m_tabBar, &QTabBar::tabBarDoubleClicked, this, &CInfoArea::ps_tabBarDoubleClicked); connect(m_tabBar, &QTabBar::tabBarDoubleClicked, this, &CInfoArea::onTabBarDoubleClicked);
connect(m_tabBar, &QTabBar::currentChanged, this, &CInfoArea::ps_onTabBarIndexChanged); connect(m_tabBar, &QTabBar::currentChanged, this, &CInfoArea::onTabBarIndexChanged);
} }
else else
{ {
@@ -637,7 +637,7 @@ namespace BlackGui
{ {
for (CDockWidgetInfoArea *dw : m_dockWidgetInfoAreas) for (CDockWidgetInfoArea *dw : m_dockWidgetInfoAreas)
{ {
connect(dw, &CDockWidgetInfoArea::widgetTopLevelChanged, this, &CInfoArea::ps_onWidgetTopLevelChanged); connect(dw, &CDockWidgetInfoArea::widgetTopLevelChanged, this, &CInfoArea::onWidgetTopLevelChanged);
} }
} }
@@ -664,7 +664,7 @@ namespace BlackGui
return infoAreas; return infoAreas;
} }
void CInfoArea::ps_emitInfoAreaStatus() void CInfoArea::emitInfoAreaStatus()
{ {
int sia = this->getSelectedDockInfoAreaIndex(); int sia = this->getSelectedDockInfoAreaIndex();
QList<int> floating = this->getAreaIndexesDockedOrFloating(true); QList<int> floating = this->getAreaIndexesDockedOrFloating(true);
@@ -672,10 +672,10 @@ namespace BlackGui
emit changedInfoAreaStatus(sia, docked, floating); emit changedInfoAreaStatus(sia, docked, floating);
} }
void CInfoArea::ps_onTabBarIndexChanged(int tabBarIndex) void CInfoArea::onTabBarIndexChanged(int tabBarIndex)
{ {
emit changedInfoAreaTabBarIndex(tabBarIndex); emit changedInfoAreaTabBarIndex(tabBarIndex);
ps_emitInfoAreaStatus(); emitInfoAreaStatus();
} }
int CInfoArea::countDockedWidgetInfoAreas() const int CInfoArea::countDockedWidgetInfoAreas() const
@@ -776,7 +776,7 @@ namespace BlackGui
} }
} }
void CInfoArea::ps_tabBarDoubleClicked(int tabBarIndex) void CInfoArea::onTabBarDoubleClicked(int tabBarIndex)
{ {
if (m_lockTabBar) if (m_lockTabBar)
{ {
@@ -788,7 +788,7 @@ namespace BlackGui
dw->toggleFloating(); dw->toggleFloating();
} }
void CInfoArea::ps_onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel) void CInfoArea::onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel)
{ {
Q_ASSERT(dockWidget); Q_ASSERT(dockWidget);
Q_UNUSED(topLevel); Q_UNUSED(topLevel);
@@ -806,10 +806,10 @@ namespace BlackGui
// when toplevel is changed, I need a round in the event loop until // when toplevel is changed, I need a round in the event loop until
// current tab bar widget is visible // current tab bar widget is visible
QTimer::singleShot(250, this, &CInfoArea::ps_emitInfoAreaStatus); QTimer::singleShot(250, this, &CInfoArea::emitInfoAreaStatus);
} }
void CInfoArea::ps_onStyleSheetChanged() void CInfoArea::onStyleSheetChanged()
{ {
if (m_tabBar) if (m_tabBar)
{ {
@@ -818,7 +818,7 @@ namespace BlackGui
} }
} }
void CInfoArea::ps_showContextMenu(const QPoint &pos) void CInfoArea::showContextMenu(const QPoint &pos)
{ {
QPoint globalPos = this->mapToGlobal(pos); QPoint globalPos = this->mapToGlobal(pos);
QScopedPointer<QMenu> contextMenu(new QMenu(this)); QScopedPointer<QMenu> contextMenu(new QMenu(this));
@@ -828,7 +828,7 @@ namespace BlackGui
Q_UNUSED(selectedItem); Q_UNUSED(selectedItem);
} }
void CInfoArea::ps_showTabTexts(bool show) void CInfoArea::showTabTexts(bool show)
{ {
if (show == m_showTabTexts) { return; } if (show == m_showTabTexts) { return; }
m_showTabTexts = show; m_showTabTexts = show;
@@ -838,7 +838,7 @@ namespace BlackGui
} }
} }
void CInfoArea::ps_showTabBar(bool show) void CInfoArea::showTabBar(bool show)
{ {
if (show == m_showTabBar) return; if (show == m_showTabBar) return;
m_showTabBar = show; m_showTabBar = show;
@@ -848,22 +848,22 @@ namespace BlackGui
this->adjustSizeForAllDockWidgets(); this->adjustSizeForAllDockWidgets();
} }
void CInfoArea::ps_toggleTabBarLocked(bool locked) void CInfoArea::toggleTabBarLocked(bool locked)
{ {
m_lockTabBar = locked; m_lockTabBar = locked;
} }
void CInfoArea::ps_setTabBarPosition(QTabWidget::TabPosition position) void CInfoArea::setTabBarPosition(QTabWidget::TabPosition position)
{ {
Q_ASSERT_X(position == QTabWidget::North || position == QTabWidget::South, Q_FUNC_INFO, "Wrong tabbar position"); Q_ASSERT_X(position == QTabWidget::North || position == QTabWidget::South, Q_FUNC_INFO, "Wrong tabbar position");
this->setTabPosition(Qt::TopDockWidgetArea, position); this->setTabPosition(Qt::TopDockWidgetArea, position);
} }
void CInfoArea::ps_toggleTabBarPosition() void CInfoArea::toggleTabBarPosition()
{ {
QTabWidget::TabPosition p = (this->tabPosition(Qt::TopDockWidgetArea) == QTabWidget::North) ? QTabWidget::TabPosition p = (this->tabPosition(Qt::TopDockWidgetArea) == QTabWidget::North) ?
QTabWidget::South : QTabWidget::North; QTabWidget::South : QTabWidget::North;
this->ps_setTabBarPosition(p); this->setTabBarPosition(p);
} }
void CInfoArea::closeEvent(QCloseEvent *event) void CInfoArea::closeEvent(QCloseEvent *event)

View File

@@ -181,13 +181,12 @@ namespace BlackGui
//! Init area after(!) GUI is initialized //! Init area after(!) GUI is initialized
void initInfoArea(); void initInfoArea();
protected slots:
//! 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 setTabBarPosition(QTabWidget::TabPosition position);
//! Toogle lock tabbar //! Toogle lock tabbar
void ps_toggleTabBarLocked(bool locked); void toggleTabBarLocked(bool locked);
private: private:
QList<CDockWidgetInfoArea *> m_dockWidgetInfoAreas; QList<CDockWidgetInfoArea *> m_dockWidgetInfoAreas;
@@ -234,6 +233,39 @@ namespace BlackGui
//! Connect all widgets //! Connect all widgets
void connectTopLevelChanged(); void connectTopLevelChanged();
//! Tab bar has been double clicked
void onTabBarDoubleClicked(int tabBarIndex);
//! A widget has changed its top level
void onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel);
//! Style sheet has been changed
void onStyleSheetChanged();
//! Context menu
void showContextMenu(const QPoint &pos);
//! Show the tab texts, or just the icons
void showTabTexts(bool show);
//! Show tab bar
void showTabBar(bool show);
//! Toggle tab position North - South
void toggleTabBarPosition();
//! Set dock area used
void setDockArea(Qt::DockWidgetArea area);
//! Dock / floating of the whole info area
void setWholeInfoAreaFloating(bool floating);
//! Emit current status, \sa changedInfoAreaStatus
void emitInfoAreaStatus();
//! Tab bar index changed
void onTabBarIndexChanged(int tabBarIndex);
//! Nested info areas //! Nested info areas
//! \remark weak performance as discussed in T184 //! \remark weak performance as discussed in T184
//! \remark result stored in m_childInfoAreas //! \remark result stored in m_childInfoAreas
@@ -242,40 +274,6 @@ namespace BlackGui
//! Direct dock widget areas, not the nested dock widget areas //! Direct dock widget areas, not the nested dock widget areas
//! \remark result stored in m_dockableWidgets //! \remark result stored in m_dockableWidgets
QList<CDockWidgetInfoArea *> findOwnDockWidgetInfoAreas() const; QList<CDockWidgetInfoArea *> findOwnDockWidgetInfoAreas() const;
private slots:
//! Tab bar has been double clicked
void ps_tabBarDoubleClicked(int tabBarIndex);
//! A widget has changed its top level
void ps_onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel);
//! Style sheet has been changed
void ps_onStyleSheetChanged();
//! Context menu
void ps_showContextMenu(const QPoint &pos);
//! Show the tab texts, or just the icons
void ps_showTabTexts(bool show);
//! Show tab bar
void ps_showTabBar(bool show);
//! Toggle tab position North - South
void ps_toggleTabBarPosition();
//! Set dock area used
void ps_setDockArea(Qt::DockWidgetArea area);
//! Dock / floating of the whole info area
void ps_setWholeInfoAreaFloating(bool floating);
//! Emit current status, \sa changedInfoAreaStatus
void ps_emitInfoAreaStatus();
//! Tab bar index changed
void ps_onTabBarIndexChanged(int tabBarIndex);
}; };
} // namespace } // namespace