Replaced configFlags().testFlag() with testConfigFlag() to improve code readibility

This commit is contained in:
Uwe Kindler 2020-06-11 08:06:37 +02:00
parent d04c386948
commit e71884b23d
11 changed files with 29 additions and 27 deletions

View File

@ -424,7 +424,7 @@ void MainWindowPrivate::createContent()
DockWidget->connect(Action, SIGNAL(triggered()), SLOT(raise()));
#ifdef Q_OS_WIN
if (!DockManager->configFlags().testFlag(ads::CDockManager::OpaqueUndocking))
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
{
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(ViewMenu), RighDockArea);
}

View File

@ -103,10 +103,11 @@ struct DockAreaTitleBarPrivate
/**
* Returns true if the given config flag is set
* Convenience function to ease config flag testing
*/
static bool testConfigFlag(CDockManager::eConfigFlag Flag)
{
return CDockManager::configFlags().testFlag(Flag);
return CDockManager::testConfigFlag(Flag);
}
/**
@ -212,7 +213,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
{
QSize Size = DockArea->size();
this->DragState = DragState;
bool OpaqueUndocking = CDockManager::configFlags().testFlag(CDockManager::OpaqueUndocking) ||
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DragState);
CFloatingDockContainer* FloatingDockContainer = nullptr;
IFloatingWidget* FloatingWidget;
@ -466,7 +467,7 @@ void CDockAreaTitleBar::mousePressEvent(QMouseEvent* ev)
d->DragStartMousePos = ev->pos();
d->DragState = DraggingMousePressed;
if (CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->TabBar->currentTab()->setFocus(Qt::OtherFocusReason);
}
@ -600,9 +601,10 @@ int CDockAreaTitleBar::indexOf(QWidget *widget) const
}
//============================================================================
CTitleBarButton::CTitleBarButton(bool visible /*= true*/, QWidget* parent /*= nullptr*/) : tTitleBarButton(parent),
Visible(visible),
HideWhenDisabled(DockAreaTitleBarPrivate::testConfigFlag(CDockManager::DockAreaHideDisabledButtons))
CTitleBarButton::CTitleBarButton(bool visible, QWidget* parent)
: tTitleBarButton(parent),
Visible(visible),
HideWhenDisabled(CDockManager::testConfigFlag(CDockManager::DockAreaHideDisabledButtons))
{
}

View File

@ -731,7 +731,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
return;
}
if (CDockManager::configFlags().testFlag(CDockManager::AlwaysShowTabs))
if (CDockManager::testConfigFlag(CDockManager::AlwaysShowTabs))
{
return;
}
@ -739,7 +739,7 @@ void CDockAreaWidget::updateTitleBarVisibility()
if (d->TitleBar)
{
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|| CDockManager::configFlags().testFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|| CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar));
d->TitleBar->setVisible(!Hidden);
}
}

View File

@ -299,7 +299,7 @@ public:
CDockSplitter* newSplitter(Qt::Orientation orientation, QWidget* parent = nullptr)
{
CDockSplitter* s = new CDockSplitter(orientation, parent);
s->setOpaqueResize(CDockManager::configFlags().testFlag(CDockManager::OpaqueSplitterResize));
s->setOpaqueResize(CDockManager::testConfigFlag(CDockManager::OpaqueSplitterResize));
s->setChildrenCollapsible(false);
return s;
}

View File

@ -54,7 +54,7 @@ public:
template <class QWidgetPtr>
static void setWidgetFocus(QWidgetPtr widget)
{
if (!CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (!CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
return;
}

View File

@ -470,7 +470,7 @@ CDockManager::CDockManager(QWidget *parent) :
d->Containers.append(this);
d->loadStylesheet();
if (CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
d->FocusController = new CDockFocusController(this);
}

View File

@ -434,7 +434,7 @@ public:
template <class QWidgetPtr>
static void setWidgetFocus(QWidgetPtr widget)
{
if (!CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (!CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
return;
}

View File

@ -237,7 +237,7 @@ CDockWidget::CDockWidget(const QString &title, QWidget *parent) :
SLOT(toggleView(bool)));
setToolbarFloatingStyle(false);
if (CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
setFocusPolicy(Qt::ClickFocus);
}

View File

@ -114,7 +114,7 @@ struct DockWidgetTabPrivate
*/
bool testConfigFlag(CDockManager::eConfigFlag Flag) const
{
return CDockManager::configFlags().testFlag(Flag);
return CDockManager::testConfigFlag(Flag);
}
/**
@ -243,7 +243,7 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
ADS_PRINT("startFloating");
DragState = DraggingState;
IFloatingWidget* FloatingWidget = nullptr;
bool OpaqueUndocking = CDockManager::configFlags().testFlag(CDockManager::OpaqueUndocking) ||
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DraggingState);
// If section widget has multiple tabs, we take only one tab
@ -285,7 +285,7 @@ CDockWidgetTab::CDockWidgetTab(CDockWidget* DockWidget, QWidget *parent) :
setAttribute(Qt::WA_NoMousePropagation, true);
d->DockWidget = DockWidget;
d->createLayout();
if (CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting))
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting))
{
setFocusPolicy(Qt::ClickFocus);
}
@ -399,7 +399,7 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
{
// If we undock, we need to restore the initial position of this
// tab because it looks strange if it remains on its dragged position
if (d->isDraggingState(DraggingTab) && !CDockManager::configFlags().testFlag(CDockManager::OpaqueUndocking))
if (d->isDraggingState(DraggingTab) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
parentWidget()->layout()->update();
}
@ -468,7 +468,7 @@ void CDockWidgetTab::setActiveTab(bool active)
d->CloseButton->setVisible(DockWidgetClosable && TabHasCloseButton);
// Focus related stuff
if (CDockManager::configFlags().testFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
if (CDockManager::testConfigFlag(CDockManager::FocusHighlighting) && !d->DockWidget->dockManager()->isRestoringState())
{
bool UpdateFocusStyle = false;
if (active && !hasFocus())

View File

@ -391,7 +391,7 @@ struct FloatingDockContainerPrivate
*/
static bool testConfigFlag(CDockManager::eConfigFlag Flag)
{
return CDockManager::configFlags().testFlag(Flag);
return CDockManager::testConfigFlag(Flag);
}
/**

View File

@ -112,7 +112,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
{
ContainerOverlay->hideOverlay();
DockAreaOverlay->hideOverlay();
if (CDockManager::configFlags().testFlag(CDockManager::DragPreviewIsDynamic))
if (CDockManager::testConfigFlag(CDockManager::DragPreviewIsDynamic))
{
setHidden(false);
}
@ -167,7 +167,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
}
}
if (CDockManager::configFlags().testFlag(CDockManager::DragPreviewIsDynamic))
if (CDockManager::testConfigFlag(CDockManager::DragPreviewIsDynamic))
{
setHidden(DockDropArea != InvalidDockWidgetArea || ContainerDropArea != InvalidDockWidgetArea);
}
@ -203,7 +203,7 @@ void FloatingDragPreviewPrivate::createFloatingWidget()
{
FloatingWidget->setGeometry(_this->geometry());
FloatingWidget->show();
if (!CDockManager::configFlags().testFlag(CDockManager::DragPreviewHasWindowFrame))
if (!CDockManager::testConfigFlag(CDockManager::DragPreviewHasWindowFrame))
{
QApplication::processEvents();
int FrameHeight = FloatingWidget->frameGeometry().height() - FloatingWidget->geometry().height();
@ -222,7 +222,7 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
{
d->Content = Content;
setAttribute(Qt::WA_DeleteOnClose);
if (CDockManager::configFlags().testFlag(CDockManager::DragPreviewHasWindowFrame))
if (CDockManager::testConfigFlag(CDockManager::DragPreviewHasWindowFrame))
{
setWindowFlags(
Qt::Window | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint);
@ -245,7 +245,7 @@ CFloatingDragPreview::CFloatingDragPreview(QWidget* Content, QWidget* parent) :
// Create a static image of the widget that should get undocked
// This is like some kind preview image like it is uses in drag and drop
// operations
if (CDockManager::configFlags().testFlag(CDockManager::DragPreviewShowsContentPixmap))
if (CDockManager::testConfigFlag(CDockManager::DragPreviewShowsContentPixmap))
{
d->ContentPreviewPixmap = QPixmap(Content->size());
Content->render(&d->ContentPreviewPixmap);
@ -363,14 +363,14 @@ void CFloatingDragPreview::paintEvent(QPaintEvent* event)
}
QPainter painter(this);
if (CDockManager::configFlags().testFlag(CDockManager::DragPreviewShowsContentPixmap))
if (CDockManager::testConfigFlag(CDockManager::DragPreviewShowsContentPixmap))
{
painter.drawPixmap(QPoint(0, 0), d->ContentPreviewPixmap);
}
// If we do not have a window frame then we paint a QRubberBand like
// frameless window
if (!CDockManager::configFlags().testFlag(CDockManager::DragPreviewHasWindowFrame))
if (!CDockManager::testConfigFlag(CDockManager::DragPreviewHasWindowFrame))
{
QColor Color = palette().color(QPalette::Active, QPalette::Highlight);
QPen Pen = painter.pen();