Skip to content

Commit

Permalink
QStyleHints: code tidies
Browse files Browse the repository at this point in the history
1. Use Q_D and Q_Q instead of d_func() and q_func().
2. Use early return.
3. Remove unnecessary semicon.
4. Add one new line to separate two unrelated functions.

Change-Id: Ie6171c857f00ca171e97723a0d517d2295bbbbd1
Reviewed-by: Axel Spoerl <[email protected]>
Reviewed-by: Paul Wicking <[email protected]>
  • Loading branch information
wangwenx190 committed Dec 20, 2022
1 parent f21c450 commit 528f28f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/gui/kernel/qstylehints.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ int QStyleHints::touchDoubleTapDistance() const
*/
Qt::Appearance QStyleHints::appearance() const
{
return d_func()->appearance();
Q_D(const QStyleHints);
return d->appearance();
}

/*!
Expand Down Expand Up @@ -597,10 +598,11 @@ int QStyleHints::mouseQuickSelectionThreshold() const
*/
void QStyleHintsPrivate::setAppearance(Qt::Appearance appearance)
{
if (m_appearance != appearance) {
m_appearance = appearance;
emit q_func()->appearanceChanged(appearance);
}
if (m_appearance == appearance)
return;
m_appearance = appearance;
Q_Q(QStyleHints);
emit q->appearanceChanged(appearance);
}

QStyleHintsPrivate *QStyleHintsPrivate::get(QStyleHints *q)
Expand Down
3 changes: 2 additions & 1 deletion src/gui/kernel/qstylehints_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class QStyleHintsPrivate : public QObjectPrivate
int m_mouseDoubleClickDistance = -1;
int m_touchDoubleTapDistance = -1;

Qt::Appearance appearance() const { return m_appearance; };
Qt::Appearance appearance() const { return m_appearance; }
void setAppearance(Qt::Appearance appearance);

static QStyleHintsPrivate *get(QStyleHints *q);

private:
Expand Down

0 comments on commit 528f28f

Please sign in to comment.