Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickrectangleextruder.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
5#include <QRandomGenerator>
6
8
20 QQuickParticleExtruder(parent), m_fill(true)
21{
22}
23
25{
26 if (m_fill)
27 return QPointF(QRandomGenerator::global()->generateDouble() * rect.width() + rect.x(),
28 QRandomGenerator::global()->generateDouble() * rect.height() + rect.y());
29 int side = QRandomGenerator::global()->bounded(4);
30 switch (side){//TODO: Doesn't this overlap the corners?
31 case 0:
32 return QPointF(rect.x(),
33 QRandomGenerator::global()->generateDouble() * rect.height() + rect.y());
34 case 1:
35 return QPointF(rect.width() + rect.x(),
36 QRandomGenerator::global()->generateDouble() * rect.height() + rect.y());
37 case 2:
38 return QPointF(QRandomGenerator::global()->generateDouble() * rect.width() + rect.x(),
39 rect.y());
40 default:
41 return QPointF(QRandomGenerator::global()->generateDouble() * rect.width() + rect.x(),
42 rect.height() + rect.y());
43 }
44}
45
46bool QQuickRectangleExtruder::contains(const QRectF &bounds, const QPointF &point)
47{
48 return bounds.contains(point);
49}
50
52
53#include "moc_qquickrectangleextruder_p.cpp"
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore\reentrant
Definition qpoint.h:214
QPointF extrude(const QRectF &) override
QQuickRectangleExtruder(QObject *parent=nullptr)
\qmltype RectangleShape \instantiates QQuickRectangleExtruder \inqmlmodule QtQuick....
bool contains(const QRectF &bounds, const QPointF &point) override
double generateDouble()
Generates one random qreal in the canonical range [0, 1) (that is, inclusive of zero and exclusive of...
Definition qrandom.h:58
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
Definition qrandom.h:275
double bounded(double highest)
Generates one random double in the range between 0 (inclusive) and highest (exclusive).
Definition qrandom.h:72
\inmodule QtCore\reentrant
Definition qrect.h:483
bool contains(const QRectF &r) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qrect.cpp:1985
rect
[4]
Combined button and popup list for selecting options.
return generateDouble() *highest
[11]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent