Add a title bar interface, so we don't need to depend on TitleBar_qtwidgets
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include "DockWidgetQuick.h"
|
||||
#else
|
||||
// TODO: Use framework factory instead
|
||||
#include "views_qtwidgets/DockWidget_qtwidgets.h"
|
||||
#include "views_qtwidgets/MainWindow_qtwidgets.h"
|
||||
#endif
|
||||
|
||||
|
||||
@@ -13,12 +13,11 @@
|
||||
#include "Config.h"
|
||||
#include "FrameworkWidgetFactory.h"
|
||||
#include "View.h"
|
||||
#include "views_qtwidgets/View_qtwidgets.h"
|
||||
#include "views_qtwidgets/TitleBar_qtwidgets.h"
|
||||
#include "private/WindowBeingDragged_p.h"
|
||||
#include "private/Utils_p.h"
|
||||
#include "private/Logging_p.h"
|
||||
|
||||
#include "views/TitleBar.h"
|
||||
#include "controllers/FloatingWindow.h"
|
||||
#include "controllers/TabBar.h"
|
||||
#include "controllers/MainWindow.h"
|
||||
@@ -54,7 +53,9 @@ TitleBar::TitleBar(FloatingWindow *parent)
|
||||
{
|
||||
init();
|
||||
connect(m_floatingWindow, &FloatingWindow::numFramesChanged, this, &TitleBar::updateButtons);
|
||||
connect(m_floatingWindow, &FloatingWindow::windowStateChanged, static_cast<Views::TitleBar_qtwidgets *>(view()), &Views::TitleBar_qtwidgets::updateMaximizeButton); // TODO
|
||||
connect(m_floatingWindow, &FloatingWindow::windowStateChanged, this, [this] {
|
||||
dynamic_cast<Views::TitleBar *>(view())->updateMaximizeButton();
|
||||
});
|
||||
connect(m_floatingWindow, &FloatingWindow::activatedChanged, this, &TitleBar::isFocusedChanged);
|
||||
}
|
||||
|
||||
|
||||
29
src/views/TitleBar.h
Normal file
29
src/views/TitleBar.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
This file is part of KDDockWidgets.
|
||||
|
||||
SPDX-FileCopyrightText: 2020-2022 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
|
||||
Author: Sérgio Martins <sergio.martins@kdab.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
|
||||
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
namespace Views {
|
||||
|
||||
|
||||
/// Brief The interface that title bar views should implement
|
||||
class TitleBar
|
||||
{
|
||||
public:
|
||||
virtual void updateMaximizeButton() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "View_qtwidgets.h"
|
||||
#include "controllers/FloatingWindow.h"
|
||||
#include "views/TitleBar.h"
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
@@ -25,14 +26,14 @@ class TitleBar;
|
||||
|
||||
namespace KDDockWidgets::Views {
|
||||
|
||||
class DOCKS_EXPORT TitleBar_qtwidgets : public View_qtwidgets<QWidget>
|
||||
class DOCKS_EXPORT TitleBar_qtwidgets : public View_qtwidgets<QWidget>, public Views::TitleBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TitleBar_qtwidgets(Controllers::TitleBar *controller, QWidget *parent = nullptr);
|
||||
|
||||
// TODO:
|
||||
void updateMaximizeButton();
|
||||
void updateMaximizeButton() override;
|
||||
void updateMinimizeButton();
|
||||
void updateAutoHideButton();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user