Skip to content

Commit

Permalink
Make Flag_AutoHideSupport public
Browse files Browse the repository at this point in the history
Ready to be tested by the public
  • Loading branch information
iamsergio committed Sep 20, 2020
1 parent 7e52c51 commit 6a46744
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
* v1.1.0 (unreleased)
- New drop indicator style type: Segmented Indicators
- Added AutoHide / SideBar support
- Added FocusScope support
- Added DockWidget::isFocused() and DockWidgetBase::isFocusedChanged()
- Added Config::Flag_AlwaysTitleBarWhenFloating, which complements Flag_HideTitleBarWhenTabsVisible
- Added Config::Flag_DontUseUtilityWindowsForFloating
- Added Config::Flag_TitleBarHasMinimizeButton
- Added Config::Flag_TitleBarNoFloatButton
- Added Config::Flag_AutoHideSupport
- Bugfixes:
- Windows: Fixed windows not having proper minimum size.
- Windows: Fixed moving windows across screens with different DPI (#72)
Expand Down
12 changes: 6 additions & 6 deletions examples/dockwidgets/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ int main(int argc, char **argv)

QCommandLineOption centralFrame("f", QCoreApplication::translate("main", "Persistent central frame"));

QCommandLineOption autoHideSupport("w", QCoreApplication::translate("main", "Enables auto-hide/minimization to side-bar support"));
parser.addOption(autoHideSupport);

#if defined(DOCKS_DEVELOPER_MODE)
parser.addOption(centralFrame);

Expand All @@ -110,9 +113,6 @@ int main(int argc, char **argv)
parser.addOption(noQtTool);
parser.addOption(noParentForFloating);

QCommandLineOption autoHideSupport("w", QCoreApplication::translate("main", "Enables auto-hide/minimization to side-bar support"));
parser.addOption(autoHideSupport);

# if defined(Q_OS_WIN)
QCommandLineOption noAeroSnap("no-aero-snap", QCoreApplication::translate("main", "(internal) Disable AeroSnap"));
parser.addOption(noAeroSnap);
Expand Down Expand Up @@ -145,16 +145,16 @@ int main(int argc, char **argv)
if (parser.isSet(noParentForFloating))
flags |= KDDockWidgets::Config::Flag_internal_DontUseParentForFloatingWindows;

if (parser.isSet(autoHideSupport))
flags |= Config::Flag_internal_AutoHideSupport;

# if defined(Q_OS_WIN)
if (parser.isSet(noAeroSnap))
flags &= ~KDDockWidgets::Config::Flag_AeroSnapWithClientDecos;
# endif

#endif

if (parser.isSet(autoHideSupport))
flags |= Config::Flag_AutoHideSupport;

if (parser.isSet(noTitleBars))
flags |= KDDockWidgets::Config::Flag_HideTitleBarWhenTabsVisible;

Expand Down
5 changes: 2 additions & 3 deletions src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ class DOCKS_EXPORT Config
Flag_DontUseUtilityFloatingWindows = Flag_internal_DontUseQtToolWindowsForFloatingWindows | Flag_internal_DontUseParentForFloatingWindows,
Flag_TitleBarHasMinimizeButton = 0x2000 | Flag_DontUseUtilityFloatingWindows, ///> The title bar will have a minimize button when floating. This implies Flag_DontUseUtilityFloatingWindows too, otherwise they wouldn't appear in the task bar.
Flag_TitleBarNoFloatButton = 0x4000, ///> The TitleBar won't show the float button
Flag_internal_AutoHideSupport = 0x8000 | Flag_TitleBarNoFloatButton, ///> Supports minimizing dock widgets to the side-bar.
///>By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
///>Internal for now. Will be public once the feature is finished.
Flag_AutoHideSupport = 0x8000 | Flag_TitleBarNoFloatButton, ///> Supports minimizing dock widgets to the side-bar.
///> By default it also turns off the float button, but you can remove Flag_TitleBarNoFloatButton to have both.
Flag_Default = Flag_AeroSnapWithClientDecos ///> The defaults
};
Q_DECLARE_FLAGS(Flags, Flag)
Expand Down
2 changes: 1 addition & 1 deletion src/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class MainWindow::Private
public:

explicit Private(MainWindowOptions, MainWindowBase *mainWindow)
: m_supportsAutoHide(Config::self().flags() & Config::Flag_internal_AutoHideSupport)
: m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
{
if (m_supportsAutoHide) {
for (auto location : { SideBarLocation::North, SideBarLocation::East,
Expand Down
2 changes: 1 addition & 1 deletion src/private/DockRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ bool DockRegistry::eventFilter(QObject *watched, QEvent *event)
}
}
} else if (event->type() == QEvent::MouseButtonPress) {
if (!(Config::self().flags() & Config::Flag_internal_AutoHideSupport))
if (!(Config::self().flags() & Config::Flag_AutoHideSupport))
return false;

auto p = watched;
Expand Down
4 changes: 2 additions & 2 deletions src/private/TitleBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ TitleBar::TitleBar(Frame *parent)
, Draggable(this)
, m_frame(parent)
, m_floatingWindow(nullptr)
, m_supportsAutoHide(Config::self().flags() & Config::Flag_internal_AutoHideSupport)
, m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
{
connect(m_frame, &Frame::numDockWidgetsChanged, this, &TitleBar::updateCloseButton);
connect(m_frame, &Frame::isFocusedChanged, this, &TitleBar::isFocusedChanged);
Expand All @@ -49,7 +49,7 @@ TitleBar::TitleBar(FloatingWindow *parent)
, Draggable(this)
, m_frame(nullptr)
, m_floatingWindow(parent)
, m_supportsAutoHide(Config::self().flags() & Config::Flag_internal_AutoHideSupport)
, m_supportsAutoHide(Config::self().flags() & Config::Flag_AutoHideSupport)
{
connect(m_floatingWindow, &FloatingWindow::numFramesChanged, this, &TitleBar::updateCloseButton);
connect(m_floatingWindow, &FloatingWindow::numFramesChanged, this, &TitleBar::updateFloatButton);
Expand Down
2 changes: 1 addition & 1 deletion src/private/widgets/TitleBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void TitleBarWidget::updateMinimizeButton()

void TitleBarWidget::updateAutoHideButton()
{
if (Config::self().flags() & Config::Flag_internal_AutoHideSupport) {
if (Config::self().flags() & Config::Flag_AutoHideSupport) {
if (const Frame *f = frame()) {
if (f->isInMainWindow()) {
m_autoHideButton->setIcon(QIcon(QStringLiteral(":/img/auto-hide.png")));
Expand Down
2 changes: 1 addition & 1 deletion tests/tst_docks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5954,7 +5954,7 @@ void TestDocks::tst_honourUserGeometry()
void TestDocks::tst_closeRemovesFromSideBar()
{
EnsureTopLevelsDeleted e;
Config::self().setFlags(Config::Flag_internal_AutoHideSupport);
Config::self().setFlags(Config::Flag_AutoHideSupport);
auto m1 = createMainWindow(QSize(1000, 1000), MainWindowOption_None);
auto dw1 = new DockWidget(QStringLiteral("1"));
auto fw1 = dw1->window();
Expand Down

0 comments on commit 6a46744

Please sign in to comment.