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
73 | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
81Q_STATIC_ASSERT(
int(Header) ==
int(QQuickToolBar::Header));
82Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickToolBar::Footer));
84#if QT_CONFIG(quicktemplates2_container)
85 Q_STATIC_ASSERT(
int(Header) ==
int(QQuickTabBar::Header));
86 Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickTabBar::Footer));
88 Q_STATIC_ASSERT(
int(Header) ==
int(QQuickDialogButtonBox::Header));
89 Q_STATIC_ASSERT(
int(Footer) ==
int(QQuickDialogButtonBox::Footer));
92 static void setPos(QQuickItem *item, Position position)
94 if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(item))
95 toolBar->setPosition(
static_cast<QQuickToolBar::Position>(position));
96#if QT_CONFIG(quicktemplates2_container)
97 else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(item))
98 tabBar->setPosition(
static_cast<QQuickTabBar::Position>(position));
99 else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(item))
100 buttonBox->setPosition(
static_cast<QQuickDialogButtonBox::Position>(position));
108 const qreal hh = header && header->isVisible() ? header->height() : 0;
109 const qreal fh = footer && footer->isVisible() ? footer->height() : 0;
110 const qreal hsp = hh > 0 ? spacing : 0;
111 const qreal fsp = fh > 0 ? spacing : 0;
114 contentItem->setY(q->topPadding() + hh + hsp);
115 contentItem->setX(q->leftPadding());
116 contentItem->setWidth(q->availableWidth());
117 contentItem->setHeight(q->availableHeight() - hh - fh - hsp - fsp);
122 header->setWidth(q->width());
126 footer->setY(q->height() - footer->height());
127 footer->setWidth(q->width());
139 QQuickPanePrivate::itemVisibilityChanged(item);
141 if (item == header) {
142 emit q->implicitHeaderWidthChanged();
143 emit q->implicitHeaderHeightChanged();
145 }
else if (item == footer) {
146 emit q->implicitFooterWidthChanged();
147 emit q->implicitFooterHeightChanged();
155 QQuickPanePrivate::itemImplicitWidthChanged(item);
162 emit q->implicitHeaderWidthChanged();
163 else if (item == footer)
164 emit q->implicitFooterWidthChanged();
170 QQuickPanePrivate::itemImplicitHeightChanged(item);
177 emit q->implicitHeaderHeightChanged();
178 else if (item == footer)
179 emit q->implicitFooterHeightChanged();
184 QQuickPanePrivate::itemGeometryChanged(item, change, diff);
185 if (item == header || item == footer)
192 QQuickPanePrivate::itemDestroyed(item);
193 if (item == header) {
196 emit q->implicitHeaderWidthChanged();
197 emit q->implicitHeaderHeightChanged();
198 emit q->headerChanged();
199 }
else if (item == footer) {
202 emit q->implicitFooterWidthChanged();
203 emit q->implicitFooterHeightChanged();
204 emit q->footerChanged();
208QQuickPage::QQuickPage(QQuickItem *parent)
209 : QQuickPane(*(
new QQuickPagePrivate), parent)
213QQuickPage::QQuickPage(QQuickPagePrivate &dd, QQuickItem *parent)
214 : QQuickPane(dd, parent)
218QQuickPage::~QQuickPage()
222 QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
224 QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
228
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
267QString QQuickPage::title()
const
269 return d_func()->title;
272void QQuickPage::setTitle(
const QString &title)
275 if (d->title == title)
279 maybeSetAccessibleName(title);
283void QQuickPage::resetTitle()
289
290
291
292
293
294
295
296
297
298
299
300QQuickItem *QQuickPage::header()
const
302 Q_D(
const QQuickPage);
306void QQuickPage::setHeader(QQuickItem *header)
309 if (d->header == header)
313 QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
314 d->header->setParentItem(
nullptr);
318 header->setParentItem(
this);
319 QQuickItemPrivate::get(header)->addItemChangeListener(d, LayoutChanges);
320 if (qFuzzyIsNull(header->z()))
322 setPos(header, Header);
324 if (isComponentComplete())
326 emit headerChanged();
330
331
332
333
334
335
336
337
338
339
340
341QQuickItem *QQuickPage::footer()
const
343 Q_D(
const QQuickPage);
347void QQuickPage::setFooter(QQuickItem *footer)
350 if (d->footer == footer)
354 QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
355 d->footer->setParentItem(
nullptr);
359 footer->setParentItem(
this);
360 QQuickItemPrivate::get(footer)->addItemChangeListener(d, LayoutChanges);
361 if (qFuzzyIsNull(footer->z()))
363 setPos(footer, Footer);
365 if (isComponentComplete())
367 emit footerChanged();
371
372
373
374
375
376
377
378
379
380
381qreal QQuickPage::implicitHeaderWidth()
const
383 Q_D(
const QQuickPage);
384 if (!d->header || !d->header->isVisible())
386 return d->header->implicitWidth();
390
391
392
393
394
395
396
397
398
399
400qreal QQuickPage::implicitHeaderHeight()
const
402 Q_D(
const QQuickPage);
403 if (!d->header || !d->header->isVisible())
405 return d->header->implicitHeight();
409
410
411
412
413
414
415
416
417
418
419qreal QQuickPage::implicitFooterWidth()
const
421 Q_D(
const QQuickPage);
422 if (!d->footer || !d->footer->isVisible())
424 return d->footer->implicitWidth();
428
429
430
431
432
433
434
435
436
437
438qreal QQuickPage::implicitFooterHeight()
const
440 Q_D(
const QQuickPage);
441 if (!d->footer || !d->footer->isVisible())
443 return d->footer->implicitHeight();
446void QQuickPage::componentComplete()
449 QQuickPane::componentComplete();
453void QQuickPage::spacingChange(qreal newSpacing, qreal oldSpacing)
456 QQuickPane::spacingChange(newSpacing, oldSpacing);
460#if QT_CONFIG(accessibility)
461QAccessible::Role QQuickPage::accessibleRole()
const
463 return QAccessible::PageTab;
466void QQuickPage::accessibilityActiveChanged(
bool active)
469 QQuickPane::accessibilityActiveChanged(active);
472 maybeSetAccessibleName(d->title);
478#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
static QT_BEGIN_NAMESPACE const QQuickItemPrivate::ChangeTypes LayoutChanges
Styled page control with support for a header and footer.