16#include "../../Item_p.h"
17#include "../../LayoutingHost_p.h"
18#include "../../LayoutingGuest_p.h"
19#include "../../LayoutingSeparator_p.h"
21#include <QApplication>
35 , Core::LayoutingSeparator(host, orientation, container)
64 void enterEvent(KDDockWidgets::Qt5Qt6Compat::QEnterEvent *)
override
79class Host :
public QWidget,
public Core::LayoutingHost
84 m_rootItem =
new Core::ItemBoxContainer(
this);
87 m_rootItem->setSize_recursive(
size());
90 bool supportsHonouringLayoutMinSize()
const override
99 m_rootItem->setSize_recursive(
size());
104class Guest :
public QWidget,
public Core::LayoutingGuest
107 explicit Guest(Host *host,
const QString &uniqueName,
QColor color)
108 : m_uniqueName(uniqueName)
112 auto item =
new Core::Item(host);
113 item->setGuest(
this);
119 p.fillRect(
rect(), m_color);
122 Size minSize()
const override
127 Size maxSizeHint()
const override
147 void setHost(Core::LayoutingHost *parent)
override
149 if (
auto p =
dynamic_cast<QWidget *
>(parent)) {
151 }
else if (!parent) {
154 qFatal(
"Expected a QWidget");
158 Core::LayoutingHost *host()
const override
160 return dynamic_cast<Core::LayoutingHost *
>(
parentWidget());
168 virtual bool freed()
const override
184 Core::Item::setCreateSeparatorFunc([](Core::LayoutingHost *host,
Qt::Orientation orientation, Core::ItemBoxContainer *container) -> Core::LayoutingSeparator * {
185 return new Separator(host, orientation, container);
189 host.resize(1000, 1000);
191 auto guest1 =
new Guest(&host,
"1",
QColor(
"#41729F"));
192 auto guest2 =
new Guest(&host,
"2",
QColor(
"#5885AF"));
193 auto guest3 =
new Guest(&host,
"3",
QColor(
"#274472"));
194 auto guest4 =
new Guest(&host,
"4",
QColor(
"#C3E0E5"));
QString name() const const
void setObjectName(const QString &name)
int main(int argc, char **argv)