mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-23 15:25:35 +08:00
Some CDockWidget improvements
* save original dock areas * init dw_InfoBarStatus as it is not part of an info area (which does that)
This commit is contained in:
committed by
Mat Sutcliffe
parent
2f1e3f47f9
commit
e8786f9794
@@ -53,6 +53,7 @@ namespace BlackGui
|
||||
// init settings
|
||||
this->onStyleSheetsChanged();
|
||||
this->initTitleBarWidgets();
|
||||
m_originalAreas = this->allowedAreas();
|
||||
|
||||
// context menu
|
||||
m_input = new CMarginsInput(this);
|
||||
@@ -257,24 +258,29 @@ namespace BlackGui
|
||||
|
||||
void CDockWidget::toggleFloating()
|
||||
{
|
||||
const bool floating = !this->isFloating();
|
||||
if (!floating) { this->setFrameless(false); } // remove frameless if not floating
|
||||
const bool changeToFloating = !this->isFloating();
|
||||
if (!changeToFloating) { this->setFrameless(false); } // remove frameless if not floating
|
||||
|
||||
// disable the interactive docking
|
||||
if (changeToFloating)
|
||||
{
|
||||
m_originalAreas = this->allowedAreas();
|
||||
this->setAllowedAreas(Qt::NoDockWidgetArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setAllowedAreas(m_originalAreas);
|
||||
}
|
||||
|
||||
this->setAlwaysOnTop(m_alwaysOnTop && changeToFloating);
|
||||
this->setFloating(changeToFloating);
|
||||
|
||||
const Qt::KeyboardModifiers km = QGuiApplication::queryKeyboardModifiers();
|
||||
const bool shift = km.testFlag(Qt::ShiftModifier);
|
||||
|
||||
this->setFloating(floating);
|
||||
this->setAlwaysOnTop(m_alwaysOnTop && floating);
|
||||
|
||||
// disable the interactive docking
|
||||
if (floating)
|
||||
{
|
||||
this->setAllowedAreas(Qt::NoDockWidgetArea);
|
||||
}
|
||||
|
||||
// with shift ALWAYS reset
|
||||
if (shift && floating) { this->resetPosition(); }
|
||||
if (floating)
|
||||
if (shift && changeToFloating) { this->resetPosition(); }
|
||||
if (changeToFloating)
|
||||
{
|
||||
// check where we are, otherwise reset if NOT appropriate
|
||||
const QPoint p = this->rect().topLeft();
|
||||
@@ -392,7 +398,7 @@ namespace BlackGui
|
||||
});
|
||||
**/
|
||||
|
||||
event->setAccepted(false); // refuse -> do not close
|
||||
event->setAccepted(false); // refuse -> do not close (otherwise crash)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace BlackGui
|
||||
|
||||
signals:
|
||||
//! Top level has changed for given widget
|
||||
void widgetTopLevelChanged(BlackGui::CDockWidget *, bool topLevel);
|
||||
void widgetTopLevelChanged(CDockWidget *, bool topLevel);
|
||||
|
||||
//! Font size signals @{
|
||||
void fontSizePlus();
|
||||
@@ -242,6 +242,7 @@ namespace BlackGui
|
||||
QSize m_lastFloatingSize; //!< last floating position
|
||||
QPoint m_offsetWhenFloating; //!< initial offset to main window when floating first time
|
||||
QPoint m_lastFloatingPosition; //!< last floating position
|
||||
Qt::DockWidgetAreas m_originalAreas; //!< areas before floating
|
||||
|
||||
BlackMisc::CSetting<BlackGui::Settings::TDockWidget> m_settings { this, &CDockWidget::settingsChanged };
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ using namespace BlackGui::Components;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(parent)
|
||||
CDockWidgetInfoBar::CDockWidgetInfoBar(QWidget *parent) : CDockWidget(false, parent)
|
||||
{
|
||||
this->setWindowTitle("Info status bar");
|
||||
this->setWindowIcon(CIcons::swift24());
|
||||
|
||||
@@ -34,6 +34,10 @@ namespace BlackGui
|
||||
//! Force an reload
|
||||
void reloadStyleSheet() { this->onStyleSheetsChanged(); }
|
||||
|
||||
//! \copydoc CDockWidget::initialFloating
|
||||
//! \remark special case to allow init
|
||||
virtual void initialFloating() override { CDockWidget::initialFloating(); }
|
||||
|
||||
protected:
|
||||
//! Contribute to menu
|
||||
virtual void addToContextMenu(QMenu *contextMenu) const override;
|
||||
|
||||
@@ -69,6 +69,8 @@ void SwiftGuiStd::init()
|
||||
|
||||
if (m_init) { return; }
|
||||
|
||||
ui->dw_InfoBarStatus->initialFloating();
|
||||
|
||||
this->setVisible(false); // hide all, so no flashing windows during init
|
||||
m_mwaStatusBar = &m_statusBar;
|
||||
m_mwaOverlayFrame = ui->fr_CentralFrameInside;
|
||||
|
||||
Reference in New Issue
Block a user