Allow auto ajdust for floating widgets (via menu)

refs #299
This commit is contained in:
Klaus Basan
2014-08-03 14:40:32 +02:00
parent 34c9c5b7df
commit a78422bf3e
6 changed files with 44 additions and 6 deletions

View File

@@ -11,7 +11,11 @@
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
<string>Info status bar</string>
</property>
<property name="windowIcon">
<iconset resource="../../blackmisc/blackmisc.qrc">
<normaloff>:/own/icons/own/swift/swift24.png</normaloff>:/own/icons/own/swift/swift24.png</iconset>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
@@ -164,6 +168,8 @@
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="../../blackmisc/blackmisc.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -124,6 +124,17 @@ namespace BlackGui
menu->addAction(showMenuText);
connect(showMenuText, &QAction::toggled, this, &CMainInfoAreaComponent::ps_showTabTexts);
// auto adjust floating widgets
QAction *autoAdjustFloatingWidget = new QAction(menu);
autoAdjustFloatingWidget->setObjectName("AutoAdjustFloatingWidgets");
autoAdjustFloatingWidget->setIconText("Auto adjust floating widgets");
autoAdjustFloatingWidget->setIcon(CIcons::resize16());
autoAdjustFloatingWidget->setCheckable(true);
autoAdjustFloatingWidget->setChecked(this->m_autoAdjustFloatingWidgets);
menu->addAction(autoAdjustFloatingWidget);
connect(autoAdjustFloatingWidget, &QAction::toggled, this, &CMainInfoAreaComponent::ps_toggleAutoAdjustFloatingWidget);
// tab bar position
menu->addAction(CIcons::dockBottom16(), "Toogle tabbar position", this, SLOT(ps_toggleTabBarPosition()));
}
}
@@ -506,6 +517,18 @@ namespace BlackGui
}
}
void CMainInfoAreaComponent::ps_toggleAutoAdjustFloatingWidget(bool adjust)
{
if (adjust == this->m_autoAdjustFloatingWidgets) return;
this->m_autoAdjustFloatingWidgets = adjust;
QList<CDockWidgetInfoArea *>::iterator i;
for (i = this->m_dockableWidgets.begin(); i != this->m_dockableWidgets.end(); ++i)
{
CDockWidgetInfoArea *dw = (*i);
dw->setAutoAdjustWhenFloating(adjust);
}
}
void CMainInfoAreaComponent::ps_setTabBarPosition(QTabWidget::TabPosition position)
{
Q_ASSERT(position == QTabWidget::North || position == QTabWidget::South);

View File

@@ -121,7 +121,8 @@ namespace BlackGui
QList<CDockWidgetInfoArea *> m_dockableWidgets ;
QTabBar *m_tabBar = nullptr;
bool m_showTabTexts = true;
bool m_infoAreaFloating = false; //!< whole info area floating
bool m_infoAreaFloating = false; //!< whole info area floating
bool m_autoAdjustFloatingWidgets = true; //!< auto ajdust the floating widgets
//! Tabify the widgets
void tabifyAllWidgets();
@@ -181,6 +182,9 @@ namespace BlackGui
//! Show the tab texts, or just the icons
void ps_showTabTexts(bool show);
//! Toggle checkable setting
void ps_toggleAutoAdjustFloatingWidget(bool adjust);
//! Tab position for docked widgets tab
//! \remarks North or South working, East / West not
void ps_setTabBarPosition(QTabWidget::TabPosition position);