19#include "FrameQuick_p.h"
22#include "TabWidgetQuick_p.h"
24#include "../DockWidgetBase_p.h"
25#include "../WidgetResizeHandler_p.h"
31FrameQuick::FrameQuick(QWidgetAdapter *parent, FrameOptions options,
int userType)
32 : Frame(parent, options, userType)
34 connect(m_tabWidget->asWidget(), SIGNAL(countChanged()),
35 this, SLOT(updateConstriants()));
40 connect(
this, &QWidgetAdapter::geometryUpdated,
this, &Frame::layoutInvalidated);
42 connect(
this, &QWidgetAdapter::widgetGeometryChanged,
this, [
this] {
43 for (
auto dw : dockWidgets()) {
44 Q_EMIT
static_cast<DockWidgetQuick *
>(dw)->frameGeometryChanged(QWidgetAdapter::geometry());
49 Config::self().frameworkWidgetFactory()->frameFilename());
51 m_visualItem =
static_cast<QQuickItem *
>(component.create());
54 qWarning() << Q_FUNC_INFO <<
"Failed to create item" << component.errorString();
59 m_visualItem->setParentItem(
this);
60 m_visualItem->setParent(
this);
63FrameQuick::~FrameQuick()
71 m_visualItem->setParent(
nullptr);
72 m_visualItem->deleteLater();
78void FrameQuick::updateConstriants()
80 onDockWidgetCountChanged();
84 setProperty(
"kddockwidgets_min_size", minimumSize());
85 setProperty(
"kddockwidgets_max_size", maximumSize());
87 Q_EMIT layoutInvalidated();
92 m_tabWidget->removeDockWidget(dw);
93 disconnect(m_connections.take(dw));
98 return m_tabWidget->indexOfDockWidget(dw);
101int FrameQuick::currentIndex_impl()
const
103 return m_tabWidget->currentIndex();
106void FrameQuick::setCurrentTabIndex_impl(
int index)
108 setCurrentDockWidget_impl(dockWidgetAt(index));
113 m_tabWidget->TabWidget::setCurrentDockWidget(dw);
116void FrameQuick::insertDockWidget_impl(
DockWidgetBase *dw,
int index)
119 if (m_tabWidget->insertDockWidget(index, dw, {}, {})) {
120 dw->setParent(m_stackLayout);
123 if (dw->parent() != m_stackLayout)
124 removeWidget_impl(dw);
127 m_connections[dw] = conn;
128 setCurrentDockWidget_impl(dw);
130 if (oldFrame && oldFrame->beingDeletedLater()) {
146 return m_tabWidget->dockwidgetAt(index);
151 return m_tabWidget->currentDockWidget();
154void FrameQuick::renameTab(
int,
const QString &)
160void FrameQuick::changeTabIcon(
int index,
const QIcon &)
163 qDebug() << Q_FUNC_INFO <<
"Not implemented";
166void FrameQuick::setStackLayout(QQuickItem *stackLayout)
168 if (m_stackLayout || !stackLayout) {
169 qWarning() << Q_FUNC_INFO <<
"Shouldn't happen";
173 m_stackLayout = stackLayout;
176QSize FrameQuick::minimumSize()
const
178 const QSize contentsSize = dockWidgetsMinSize();
179 return contentsSize +
QSize(0, nonContentsHeight());
182QSize FrameQuick::maximumSize()
const
184 return Frame::maximumSize();
187QObject *FrameQuick::tabWidgetObj()
const
189 return m_tabWidget->asWidget();
192TabWidget *FrameQuick::tabWidget()
const
197QQuickItem *FrameQuick::visualItem()
const
202int FrameQuick::nonContentsHeight()
const
Application-wide config to tune certain behaviours of the framework.
QVariant property(const char *name) const const
QVariant fromValue(const T &value)
int toInt(bool *ok) const const