aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-04-24 23:31:59 +0200
committerRobin Burchell <robin.burchell@crimson.no>2017-04-25 13:33:22 +0000
commita7cb3ffb34dce269e0d1073bdd3ebfc39ade44a2 (patch)
tree7d3e6678e1cb88f507148d1cd66dba40efd06a1a
parent27079f9168463b5b27aeb2d1f93f867bf714e71a (diff)
QQuickRectangle: Inline a method into its sole caller
No point separating this out, and prepares us for a cleanup. Change-Id: I051d94a3a8f00525123de6d47d328cafe7623bba Reviewed-by: Gunnar Sletta <gunnar@crimson.no>
-rw-r--r--src/quick/items/qquickrectangle.cpp11
-rw-r--r--src/quick/items/qquickrectangle_p_p.h14
2 files changed, 10 insertions, 15 deletions
diff --git a/src/quick/items/qquickrectangle.cpp b/src/quick/items/qquickrectangle.cpp
index 7ba2421d62..cbf0cdad64 100644
--- a/src/quick/items/qquickrectangle.cpp
+++ b/src/quick/items/qquickrectangle.cpp
@@ -356,7 +356,16 @@ void QQuickRectangle::doUpdate()
QQuickPen *QQuickRectangle::border()
{
Q_D(QQuickRectangle);
- return d->getPen();
+ if (!d->pen) {
+ d->pen = new QQuickPen;
+ static int penChangedSignalIdx = -1;
+ if (penChangedSignalIdx < 0)
+ penChangedSignalIdx = QMetaMethod::fromSignal(&QQuickPen::penChanged).methodIndex();
+ if (d->doUpdateSlotIdx < 0)
+ d->doUpdateSlotIdx = QQuickRectangle::staticMetaObject.indexOfSlot("doUpdate()");
+ QMetaObject::connect(d->pen, penChangedSignalIdx, this, d->doUpdateSlotIdx);
+ }
+ return d->pen;
}
/*!
diff --git a/src/quick/items/qquickrectangle_p_p.h b/src/quick/items/qquickrectangle_p_p.h
index 50d5817951..b7cd91bd73 100644
--- a/src/quick/items/qquickrectangle_p_p.h
+++ b/src/quick/items/qquickrectangle_p_p.h
@@ -78,20 +78,6 @@ public:
QQuickPen *pen;
qreal radius;
static int doUpdateSlotIdx;
-
- QQuickPen *getPen() {
- if (!pen) {
- Q_Q(QQuickRectangle);
- pen = new QQuickPen;
- static int penChangedSignalIdx = -1;
- if (penChangedSignalIdx < 0)
- penChangedSignalIdx = QMetaMethod::fromSignal(&QQuickPen::penChanged).methodIndex();
- if (doUpdateSlotIdx < 0)
- doUpdateSlotIdx = QQuickRectangle::staticMetaObject.indexOfSlot("doUpdate()");
- QMetaObject::connect(pen, penChangedSignalIdx, q, doUpdateSlotIdx);
- }
- return pen;
- }
};
QT_END_NAMESPACE