12#ifndef KD_VIEW_QTWIDGETS_H
13#define KD_VIEW_QTWIDGETS_H
17#include "kddockwidgets/core/Controller.h"
18#include "kddockwidgets/qtcommon/View.h"
22#include <QResizeEvent>
25#include <QApplication>
34template<
typename Base>
38 using Core::View::close;
39 using Core::View::height;
40 using Core::View::minimumHeight;
41 using Core::View::minimumWidth;
42 using Core::View::move;
43 using Core::View::pos;
44 using Core::View::rect;
45 using Core::View::resize;
46 using Core::View::setSize;
47 using Core::View::size;
48 using Core::View::width;
60 Base::minimumWidth() > 0 ? Base::minimumWidth() : minimumSizeHint().width();
63 Base::minimumHeight() > 0 ? Base::minimumHeight() : minimumSizeHint().height();
65 return QSize(minW, minH).
expandedTo(Core::View::hardcodedMinimumSize());
70 return Base::minimumSizeHint();
73 void setMinimumSize(
QSize sz)
override;
81 const QSize min = minSize();
82 QSize max = Base::maximumSize();
83 max = QtWidgets::boundedMaxSize(min, max);
93 max = QtWidgets::boundedMaxSize(min, max);
99 return Base::geometry();
104 return Base::normalGeometry();
109 Base::setGeometry(geo);
112 void setMaximumSize(
QSize sz)
override;
116 return Base::isVisible();
121 return Base::isHidden();
126 Base::setVisible(is);
129 void move(
int x,
int y)
override
136 Base::resize(width, height);
194 widget->QWidget::setParent(
nullptr);
198 if (
auto qwidget = View_qt::asQWidget(parent)) {
199 widget->QWidget::setParent(qwidget);
201 qWarning() << Q_FUNC_INFO <<
"parent is not a widget, you have a bug";
208 setParentFor(
this, parent);
214 const bool isWayland = qApp->platformName() ==
QLatin1String(
"wayland");
221 raiseAndActivate(
this);
226 Base::activateWindow();
241 return Base::mapToGlobal(localPt);
246 return Base::mapFromGlobal(globalPt);
349 std::shared_ptr<Core::View> childViewAt(
QPoint localPos)
const override;
351 std::shared_ptr<Core::Window> window()
const override;
353 std::shared_ptr<Core::View> rootView()
const override;
355 std::shared_ptr<Core::View> parentView()
const override;
357 std::shared_ptr<Core::View> asWrapper()
override;
393 return childViewsFor(
this);
397 bool event(
QEvent *e)
override;
402 if (!onResize(ev->
size()))
403 Base::resizeEvent(ev);
412#ifdef DOCKS_DEVELOPER_MODE
413 if (QtCommon::View_qt::s_logicalDpiFactorOverride > 0)
414 return QtCommon::View_qt::s_logicalDpiFactorOverride;
int logicalDpiX() const const
const QSize & size() const const
QSize expandedTo(const QSize &otherSize) const const
void setHeight(int height)
void setGeometry(int posx, int posy, int w, int h)