Add FloatingWindow::allDockWidgetsHave(option) and the any* variant
This commit is contained in:
@@ -11,7 +11,8 @@
|
||||
},
|
||||
"C_Cpp.default.compileCommands" : "${workspaceFolder}/build-dev-qtwidgets/compile_commands.json",
|
||||
"C_Cpp.default.cStandard": "c17",
|
||||
"C_Cpp.default.intelliSenseMode": "gcc-x64"
|
||||
"C_Cpp.default.intelliSenseMode": "gcc-x64",
|
||||
"files.trimTrailingWhitespace": true
|
||||
},
|
||||
"tasks": {
|
||||
"version": "2.0.0",
|
||||
|
||||
@@ -501,3 +501,19 @@ bool FloatingWindow::event(QEvent *ev)
|
||||
|
||||
return QWidgetAdapter::event(ev);
|
||||
}
|
||||
|
||||
bool FloatingWindow::allDockWidgetsHave(DockWidgetBase::Option option) const
|
||||
{
|
||||
const Frame::List frames = this->frames();
|
||||
return std::all_of(frames.begin(), frames.end(), [option] (Frame *frame) {
|
||||
return frame->allDockWidgetsHave(option);
|
||||
});
|
||||
}
|
||||
|
||||
bool FloatingWindow::anyDockWidgetsHave(DockWidgetBase::Option option) const
|
||||
{
|
||||
const Frame::List frames = this->frames();
|
||||
return std::any_of(frames.begin(), frames.end(), [option] (Frame *frame) {
|
||||
return frame->anyDockWidgetsHave(option);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -131,6 +131,12 @@ public:
|
||||
*/
|
||||
QRect dragRect() const;
|
||||
|
||||
///@brief Returns whether all dock widgets have the specified option set
|
||||
bool allDockWidgetsHave(DockWidgetBase::Option) const;
|
||||
|
||||
///@brief Returns whether at least one dock widget has the specified option set
|
||||
bool anyDockWidgetsHave(DockWidgetBase::Option) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void activatedChanged();
|
||||
void numFramesChanged();
|
||||
|
||||
@@ -720,3 +720,21 @@ TabWidget *Frame::tabWidget() const
|
||||
{
|
||||
return m_tabWidget;
|
||||
}
|
||||
|
||||
///@brief Returns whether all dock widgets have the specified option set
|
||||
bool Frame::allDockWidgetsHave(DockWidgetBase::Option option) const
|
||||
{
|
||||
const DockWidgetBase::List docks = dockWidgets();
|
||||
return std::all_of(docks.cbegin(), docks.cend(), [option] (DockWidgetBase *dw) {
|
||||
return dw->options() & option;
|
||||
});
|
||||
}
|
||||
|
||||
///@brief Returns whether at least one dock widget has the specified option set
|
||||
bool Frame::anyDockWidgetsHave(DockWidgetBase::Option option) const
|
||||
{
|
||||
const DockWidgetBase::List docks = dockWidgets();
|
||||
return std::any_of(docks.cbegin(), docks.cend(), [option] (DockWidgetBase *dw) {
|
||||
return dw->options() & option;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "kddockwidgets/docks_export.h"
|
||||
#include "kddockwidgets/QWidgetAdapter.h"
|
||||
#include "kddockwidgets/FocusScope.h"
|
||||
#include "kddockwidgets/DockWidgetBase.h"
|
||||
#include "../LayoutSaver_p.h"
|
||||
#include "multisplitter/Widget.h"
|
||||
|
||||
@@ -239,6 +240,12 @@ public:
|
||||
*/
|
||||
virtual QRect dragRect() const;
|
||||
|
||||
///@brief Returns whether all dock widgets have the specified option set
|
||||
bool allDockWidgetsHave(DockWidgetBase::Option) const;
|
||||
|
||||
///@brief Returns whether at least one dock widget has the specified option set
|
||||
bool anyDockWidgetsHave(DockWidgetBase::Option) const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void currentDockWidgetChanged(KDDockWidgets::DockWidgetBase *);
|
||||
void numDockWidgetsChanged();
|
||||
|
||||
Reference in New Issue
Block a user