12#include "kddockwidgets/KDDockWidgets.h"
14#include "views/ViewWrapper_p.h"
15#include "views/View.h"
16#include "kddockwidgets/core/MainWindow.h"
20#include <QStyleFactory>
21#include <QApplication>
28#ifdef DOCKS_TESTING_METHODS
35 explicit TestView(Core::CreateViewOptions opts,
QWidget *parent)
40 setMinimumSize(opts.minSize.boundedTo(opts.maxSize));
43 QSize sizeHint()
const override
45 return m_opts.sizeHint;
48 QSize maxSizeHint()
const override
54 Core::CreateViewOptions m_opts;
61 explicit FocusableTestView(Core::CreateViewOptions opts,
QWidget *parent)
66 setMinimumSize(opts.minSize.boundedTo(opts.maxSize));
70 QSize sizeHint()
const override
72 return m_opts.sizeHint;
75 QSize maxSizeHint()
const override
81 Core::CreateViewOptions m_opts;
88 explicit NonClosableTestView(
QWidget *parent)
102void Platform::tests_initPlatform_impl()
104 Platform_qt::tests_initPlatform_impl();
107void Platform::tests_deinitPlatform_impl()
111 qDeleteAll(qApp->topLevelWidgets());
113 Platform_qt::tests_deinitPlatform_impl();
118 QWidget *parentWidget = QtCommon::View_qt::asQWidget(parent);
120 auto newWidget =
new TestView(opts, parentWidget);
127Core::View *Platform::tests_createFocusableView(Core::CreateViewOptions opts,
Core::View *parent)
129 QWidget *parentWidget = QtCommon::View_qt::asQWidget(parent);
131 auto newWidget =
new FocusableTestView(opts, parentWidget);
140 QWidget *parentWidget = QtCommon::View_qt::asQWidget(parent);
141 auto newWidget =
new NonClosableTestView(parentWidget);
147 Core::CreateViewOptions opts,
148 MainWindowOptions options,
158 view->resize(opts.size);
160 return view->mainWindow();
163std::shared_ptr<Core::Window> Platform::tests_createWindow()
166 window->setVisible(
true);
167 return std::shared_ptr<Core::Window>(window);
172#include "TestHelpers.moc"
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
The QMainwindow sub-class that the application should use to be able to dock KDDockWidget DockWidget ...
QSize boundedTo(const QSize &otherSize) const const
QMainWindow sub-class to enable KDDockWidgets support.