Add a DockWidgetViewInterface
to share code between both QtQuick and QtWidget DockWidget views
This commit is contained in:
@@ -103,6 +103,8 @@ set(KDDW_BACKEND_SRCS
|
||||
views/MainWindowMDI.h
|
||||
views/MainWindowViewInterface.cpp
|
||||
views/MainWindowViewInterface.h
|
||||
views/DockWidgetViewInterface.cpp
|
||||
views/DockWidgetViewInterface.h
|
||||
qtcommon/Platform_qt.cpp
|
||||
qtcommon/Platform_qt.h
|
||||
qtcommon/Window_qt.cpp
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
Contact KDAB at <info@kdab.com> for commercial licensing options.
|
||||
*/
|
||||
|
||||
#include "../../../views/DockWidget.h"
|
||||
#include "../../../views/DockWidgetViewInterface.h"
|
||||
@@ -20,6 +20,7 @@
|
||||
#define KD_DOCKWIDGET_QUICK_H
|
||||
|
||||
#include "kddockwidgets/controllers/DockWidget.h"
|
||||
#include "kddockwidgets/views/DockWidgetViewInterface.h"
|
||||
#include "View_qtquick.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -39,7 +40,7 @@ namespace Views {
|
||||
*
|
||||
* Most of the interface lives in Controllers::DockWidget, to facilitate sharing with QtQuick.
|
||||
*/
|
||||
class DOCKS_EXPORT DockWidget_qtquick : public Views::View_qtquick
|
||||
class DOCKS_EXPORT DockWidget_qtquick : public Views::View_qtquick, Views::DockWidgetViewInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QObject *actualTitleBar READ actualTitleBarView NOTIFY actualTitleBarChanged)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "kddockwidgets/controllers/DockWidget.h"
|
||||
#include "kddockwidgets/views/DockWidgetViewInterface.h"
|
||||
#include "View_qtwidgets.h"
|
||||
|
||||
// clazy:excludeall=ctor-missing-parent-argument
|
||||
@@ -34,7 +35,7 @@ namespace Views {
|
||||
*
|
||||
* Most of the interface lives in Controllers::DockWidget, to facilitate sharing with QtQuick.
|
||||
*/
|
||||
class DOCKS_EXPORT DockWidget_qtwidgets : public View_qtwidgets<QWidget>
|
||||
class DOCKS_EXPORT DockWidget_qtwidgets : public View_qtwidgets<QWidget>, Views::DockWidgetViewInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
16
src/views/DockWidgetViewInterface.cpp
Normal file
16
src/views/DockWidgetViewInterface.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
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.
|
||||
*/
|
||||
|
||||
#include "DockWidgetViewInterface.h"
|
||||
|
||||
namespace KDDockWidgets::Views {
|
||||
DockWidgetViewInterface::~DockWidgetViewInterface() = default;
|
||||
}
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "kddockwidgets/KDDockWidgets.h"
|
||||
|
||||
namespace KDDockWidgets {
|
||||
|
||||
namespace Controllers {
|
||||
@@ -20,9 +22,10 @@ class DockWidget;
|
||||
namespace Views {
|
||||
|
||||
/// @brief The interface that DockWidget views should implement
|
||||
class DockWidget
|
||||
class DOCKS_EXPORT DockWidgetViewInterface
|
||||
{
|
||||
public:
|
||||
virtual ~DockWidgetViewInterface();
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user