Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickdayofweekrow.cpp
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6
7#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
8
10
15
48
50{
51 if (!contentItem)
52 return;
53
54 QSizeF itemSize;
55 itemSize.setWidth((contentItem->width() - 6 * spacing) / 7);
56 itemSize.setHeight(contentItem->height());
57
58 const auto childItems = contentItem->childItems();
60 item->setSize(itemSize);
61}
62
65{
67 d->model = new QQuickDayOfWeekModel(this);
68 d->source = QVariant::fromValue(d->model);
69}
70
79{
80 Q_D(const QQuickDayOfWeekRow);
81 return d->source;
82}
83
85{
87 if (d->source != source) {
88 d->source = source;
90 }
91}
92
125{
126 Q_D(const QQuickDayOfWeekRow);
127 return d->delegate;
128}
129
131{
133 if (d->delegate != delegate) {
134 d->delegate = delegate;
136 }
137}
138
145
146void QQuickDayOfWeekRow::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
147{
149 QQuickControl::geometryChange(newGeometry, oldGeometry);
151 d->resizeItems();
152}
153
154void QQuickDayOfWeekRow::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
155{
157 QQuickControl::localeChange(newLocale, oldLocale);
158 d->model->setLocale(newLocale);
159}
160
161void QQuickDayOfWeekRow::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
162{
164 QQuickControl::paddingChange(newPadding, oldPadding);
166 d->resizeItems();
167}
168
170
171#include "moc_qquickdayofweekrow_p.cpp"
\inmodule QtCore
Definition qmargins.h:270
The QQmlComponent class encapsulates a QML component definition.
QQuickDeferredPointer< QQuickItem > contentItem
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale)
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
A row of names for the days in a week.
QQuickDayOfWeekModel * model
void setDelegate(QQmlComponent *delegate)
void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
void setSource(const QVariant &source)
QQuickDayOfWeekRow(QQuickItem *parent=nullptr)
void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override
QList< QQuickItem * > childItems
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
QList< QQuickItem * > childItems() const
Returns the children of this item.
qreal width
This property holds the width of this item.
Definition qquickitem.h:75
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal height
This property holds the height of this item.
Definition qquickitem.h:76
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qsize.h:208
constexpr void setHeight(qreal h) noexcept
Sets the height to the given finite height.
Definition qsize.h:341
constexpr void setWidth(qreal w) noexcept
Sets the width to the given finite width.
Definition qsize.h:338
\inmodule QtCore
Definition qvariant.h:65
static auto fromValue(T &&value) noexcept(std::is_nothrow_copy_constructible_v< T > &&Private::CanUseInternalSpace< T >) -> std::enable_if_t< std::conjunction_v< std::is_copy_constructible< T >, std::is_destructible< T > >, QVariant >
Definition qvariant.h:536
Combined button and popup list for selecting options.
GLsizei GLsizei GLchar * source
#define emit
QObject::connect nullptr
QGraphicsItem * item