8#if QT_CONFIG(quicktemplates2_container)
9#include "qquicktabbar_p.h"
10#include "qquickdialogbuttonbox_p.h"
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
74 | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
82Q_STATIC_ASSERT(
int(Header) ==
int(QQuickToolBar::Header));
83Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickToolBar::Footer));
85#if QT_CONFIG(quicktemplates2_container)
86 Q_STATIC_ASSERT(
int(Header) ==
int(QQuickTabBar::Header));
87 Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickTabBar::Footer));
89 Q_STATIC_ASSERT(
int(Header) ==
int(QQuickDialogButtonBox::Header));
90 Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickDialogButtonBox::Footer));
93 static void setPos(QQuickItem *item, Position position)
95 if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(item))
96 toolBar->setPosition(
static_cast<QQuickToolBar::Position>(position));
97#if QT_CONFIG(quicktemplates2_container)
98 else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(item))
99 tabBar->setPosition(
static_cast<QQuickTabBar::Position>(position));
100 else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(item))
101 buttonBox->setPosition(
static_cast<QQuickDialogButtonBox::Position>(position));
109 const qreal hh = header && header->isVisible() ? header->height() : 0;
110 const qreal fh = footer && footer->isVisible() ? footer->height() : 0;
111 const qreal hsp = hh > 0 ? spacing : 0;
112 const qreal fsp = fh > 0 ? spacing : 0;
115 contentItem->setY(q->topPadding() + hh + hsp);
116 contentItem->setX(q->leftPadding());
117 contentItem->setWidth(q->availableWidth());
118 contentItem->setHeight(q->availableHeight() - hh - fh - hsp - fsp);
123 header->setWidth(q->width());
127 footer->setY(q->height() - footer->height());
128 footer->setWidth(q->width());
140 QQuickPanePrivate::itemVisibilityChanged(item);
142 if (item == header) {
143 emit q->implicitHeaderWidthChanged();
144 emit q->implicitHeaderHeightChanged();
146 }
else if (item == footer) {
147 emit q->implicitFooterWidthChanged();
148 emit q->implicitFooterHeightChanged();
156 QQuickPanePrivate::itemImplicitWidthChanged(item);
163 emit q->implicitHeaderWidthChanged();
164 else if (item == footer)
165 emit q->implicitFooterWidthChanged();
171 QQuickPanePrivate::itemImplicitHeightChanged(item);
178 emit q->implicitHeaderHeightChanged();
179 else if (item == footer)
180 emit q->implicitFooterHeightChanged();
185 QQuickPanePrivate::itemGeometryChanged(item, change, diff);
186 if (item == header || item == footer)
193 QQuickPanePrivate::itemDestroyed(item);
194 if (item == header) {
197 emit q->implicitHeaderWidthChanged();
198 emit q->implicitHeaderHeightChanged();
199 emit q->headerChanged();
200 }
else if (item == footer) {
203 emit q->implicitFooterWidthChanged();
204 emit q->implicitFooterHeightChanged();
205 emit q->footerChanged();
209QQuickPage::QQuickPage(QQuickItem *parent)
210 : QQuickPane(*(
new QQuickPagePrivate), parent)
214QQuickPage::QQuickPage(QQuickPagePrivate &dd, QQuickItem *parent)
215 : QQuickPane(dd, parent)
219QQuickPage::~QQuickPage()
223 QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
225 QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
268QString QQuickPage::title()
const
270 return d_func()->title;
273void QQuickPage::setTitle(
const QString &title)
276 if (d->title == title)
280 maybeSetAccessibleName(title);
284void QQuickPage::resetTitle()
290
291
292
293
294
295
296
297
298
299
300
301QQuickItem *QQuickPage::header()
const
303 Q_D(
const QQuickPage);
307void QQuickPage::setHeader(QQuickItem *header)
310 if (d->header == header)
314 QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
315 d->header->setParentItem(
nullptr);
319 header->setParentItem(
this);
320 QQuickItemPrivate::get(header)->addItemChangeListener(d, LayoutChanges);
321 if (qFuzzyIsNull(header->z()))
323 setPos(header, Header);
325 if (isComponentComplete())
327 emit headerChanged();
331
332
333
334
335
336
337
338
339
340
341
342QQuickItem *QQuickPage::footer()
const
344 Q_D(
const QQuickPage);
348void QQuickPage::setFooter(QQuickItem *footer)
351 if (d->footer == footer)
355 QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
356 d->footer->setParentItem(
nullptr);
360 footer->setParentItem(
this);
361 QQuickItemPrivate::get(footer)->addItemChangeListener(d, LayoutChanges);
362 if (qFuzzyIsNull(footer->z()))
364 setPos(footer, Footer);
366 if (isComponentComplete())
368 emit footerChanged();
372
373
374
375
376
377
378
379
380
381
382qreal QQuickPage::implicitHeaderWidth()
const
384 Q_D(
const QQuickPage);
385 if (!d->header || !d->header->isVisible())
387 return d->header->implicitWidth();
391
392
393
394
395
396
397
398
399
400
401qreal QQuickPage::implicitHeaderHeight()
const
403 Q_D(
const QQuickPage);
404 if (!d->header || !d->header->isVisible())
406 return d->header->implicitHeight();
410
411
412
413
414
415
416
417
418
419
420qreal QQuickPage::implicitFooterWidth()
const
422 Q_D(
const QQuickPage);
423 if (!d->footer || !d->footer->isVisible())
425 return d->footer->implicitWidth();
429
430
431
432
433
434
435
436
437
438
439qreal QQuickPage::implicitFooterHeight()
const
441 Q_D(
const QQuickPage);
442 if (!d->footer || !d->footer->isVisible())
444 return d->footer->implicitHeight();
447void QQuickPage::componentComplete()
450 QQuickPane::componentComplete();
454void QQuickPage::spacingChange(qreal newSpacing, qreal oldSpacing)
457 QQuickPane::spacingChange(newSpacing, oldSpacing);
461#if QT_CONFIG(accessibility)
462QAccessible::Role QQuickPage::accessibleRole()
const
464 return QAccessible::Pane;
467void QQuickPage::accessibilityActiveChanged(
bool active)
470 QQuickPane::accessibilityActiveChanged(active);
473 maybeSetAccessibleName(d->title);
479#include "moc_qquickpage_p.cpp"
void itemDestroyed(QQuickItem *item) override
void itemVisibilityChanged(QQuickItem *item) override
bool emittingImplicitSizeChangedSignals
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override
void itemImplicitWidthChanged(QQuickItem *item) override
void itemImplicitHeightChanged(QQuickItem *item) override
void resizeContent() override
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE const QQuickItemPrivate::ChangeTypes LayoutChanges
Styled page control with support for a header and footer.