Dock widget minor style issues

This commit is contained in:
Klaus Basan
2020-02-09 15:14:59 +01:00
committed by Mat Sutcliffe
parent 62e74092ba
commit 4183a67e1f
2 changed files with 11 additions and 8 deletions

View File

@@ -266,6 +266,7 @@ namespace BlackGui
this->setAllowedAreas(Qt::NoDockWidgetArea); this->setAllowedAreas(Qt::NoDockWidgetArea);
} }
// with shift ALWAYS reset
if (shift && floating) { this->resetPosition(); } if (shift && floating) { this->resetPosition(); }
if (floating) if (floating)
{ {
@@ -559,7 +560,7 @@ namespace BlackGui
void CDockWidget::showContextMenu(const QPoint &pos) void CDockWidget::showContextMenu(const QPoint &pos)
{ {
QPoint globalPos = this->mapToGlobal(pos); const QPoint globalPos = this->mapToGlobal(pos);
QScopedPointer<QMenu> contextMenu(new QMenu(this)); QScopedPointer<QMenu> contextMenu(new QMenu(this));
this->addToContextMenu(contextMenu.data()); this->addToContextMenu(contextMenu.data());
QAction *selectedItem = contextMenu.data()->exec(globalPos); QAction *selectedItem = contextMenu.data()->exec(globalPos);
@@ -695,15 +696,17 @@ namespace BlackGui
if (!sGui) { return; } if (!sGui) { return; }
// pos can be null during init // pos can be null during init
QWidget *mw = CGuiUtility::mainApplicationWidget(); const QWidget *mw = CGuiUtility::mainApplicationWidget();
QPoint pos = mw && mw->isVisible() ? CGuiUtility::mainWidgetGlobalPosition() : QPoint(); QPoint pos = mw && mw->isVisible() ? CGuiUtility::mainWidgetGlobalPosition() : QPoint();
if (pos.isNull()) if (pos.isNull())
{ {
pos = CGuiApplication::currentScreen()->geometry().center() - this->rect().center(); pos = CGuiApplication::currentScreen()->geometry().center() - this->rect().center();
} }
const int x = pos.x() + m_offsetWhenFloating.x(); const int osFloatingX = m_offsetWhenFloating.x();
const int y = pos.y() + m_offsetWhenFloating.y(); const int osFloatingY = m_offsetWhenFloating.y();
const int x = pos.x() + osFloatingX;
const int y = pos.y() + osFloatingY;
this->move(x, y); this->move(x, y);
} }
} // namespace } // namespace

View File

@@ -167,7 +167,7 @@ namespace BlackGui
// tab bar position // tab bar position
menu->addAction(CIcons::dockBottom16(), "Toggle tabbar position", this, &CInfoArea::toggleTabBarPosition); menu->addAction(CIcons::dockBottom16(), "Toggle tabbar position", this, &CInfoArea::toggleTabBarPosition);
Q_UNUSED(c); Q_UNUSED(c)
} }
} }
@@ -309,7 +309,7 @@ namespace BlackGui
void CInfoArea::paintEvent(QPaintEvent *event) void CInfoArea::paintEvent(QPaintEvent *event)
{ {
CStyleSheetUtility::useStyleSheetInDerivedWidget(this, QStyle::PE_FrameWindow); CStyleSheetUtility::useStyleSheetInDerivedWidget(this, QStyle::PE_FrameWindow);
Q_UNUSED(event); Q_UNUSED(event)
} }
void CInfoArea::keyPressEvent(QKeyEvent *event) void CInfoArea::keyPressEvent(QKeyEvent *event)
@@ -805,7 +805,7 @@ namespace BlackGui
void CInfoArea::onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel) void CInfoArea::onWidgetTopLevelChanged(CDockWidget *dockWidget, bool topLevel)
{ {
Q_ASSERT(dockWidget); Q_ASSERT(dockWidget);
Q_UNUSED(topLevel); Q_UNUSED(topLevel)
if (!dockWidget) { return; } if (!dockWidget) { return; }
// fix pixmaps // fix pixmaps
@@ -841,7 +841,7 @@ namespace BlackGui
this->addToContextMenu(contextMenu.data()); this->addToContextMenu(contextMenu.data());
QAction *selectedItem = contextMenu.data()->exec(globalPos); QAction *selectedItem = contextMenu.data()->exec(globalPos);
Q_UNUSED(selectedItem); Q_UNUSED(selectedItem)
} }
void CInfoArea::showTabTexts(bool show) void CInfoArea::showTabTexts(bool show)