qt: remove unnecessary member in RoundImage

This commit is contained in:
Fatih Uzunoglu 2022-03-02 21:11:21 +02:00 committed by Hugo Beauzée-Luyssen
parent 88c518596b
commit 4333661cdf
2 changed files with 5 additions and 17 deletions

View File

@ -170,19 +170,10 @@ QSGNode *RoundImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
return node;
}
void RoundImage::classBegin()
{
QQuickItem::classBegin();
m_isComponentComplete = false;
}
void RoundImage::componentComplete()
{
QQuickItem::componentComplete();
Q_ASSERT(!m_isComponentComplete); // classBegin is not called?
m_isComponentComplete = true;
if (!m_source.isEmpty())
regenerateRoundImage();
}
@ -197,7 +188,7 @@ qreal RoundImage::radius() const
return m_radius;
}
void RoundImage::setSource(QUrl source)
void RoundImage::setSource(const QUrl& source)
{
if (m_source == source)
return;
@ -236,7 +227,7 @@ void RoundImage::setDPR(const qreal value)
void RoundImage::regenerateRoundImage()
{
if (!m_isComponentComplete || m_enqueuedGeneration)
if (!isComponentComplete() || m_enqueuedGeneration)
return;
m_roundImageGenerator.reset();

View File

@ -43,20 +43,18 @@ class RoundImage : public QQuickItem
public:
RoundImage(QQuickItem *parent = nullptr);
void classBegin() override;
void componentComplete() override;
QUrl source() const;
qreal radius() const;
public slots:
void setSource(QUrl source);
void setSource(const QUrl& source);
void setRadius(qreal radius);
signals:
void sourceChanged(QUrl source);
void radiusChanged(int radius);
void sourceSizeChanged(QSizeF sourceSize);
void sourceChanged(const QUrl&);
void radiusChanged(qreal);
protected:
void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value) override;
@ -90,7 +88,6 @@ private:
TaskHandle<RoundImageGenerator> m_roundImageGenerator {};
bool m_enqueuedGeneration = false;
bool m_isComponentComplete = true;
};
#endif