diff options
Diffstat (limited to 'src/quickcontrolsimpl')
| -rw-r--r-- | src/quickcontrolsimpl/qquickiconlabel.cpp | 9 | ||||
| -rw-r--r-- | src/quickcontrolsimpl/qquickiconlabel_p_p.h | 5 | ||||
| -rw-r--r-- | src/quickcontrolsimpl/qquickmnemoniclabel.cpp | 10 | ||||
| -rw-r--r-- | src/quickcontrolsimpl/qquickmnemoniclabel_p.h | 3 |
4 files changed, 10 insertions, 17 deletions
diff --git a/src/quickcontrolsimpl/qquickiconlabel.cpp b/src/quickcontrolsimpl/qquickiconlabel.cpp index 1c0c56c098..030399364f 100644 --- a/src/quickcontrolsimpl/qquickiconlabel.cpp +++ b/src/quickcontrolsimpl/qquickiconlabel.cpp @@ -8,7 +8,6 @@ #include "qquickmnemoniclabel_p.h" #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/qpa/qplatformtheme.h> #include <QtQuick/private/qquickitem_p.h> #include <QtQuick/private/qquicktext_p.h> #include <QtQuickTemplates2/private/qquickicon_p.h> @@ -28,12 +27,6 @@ void QQuickIconLabelPrivate::completeComponent(QQuickItem *item) parserStatus->componentComplete(); } -void QQuickIconLabelPrivate::init() -{ - mnemonicEnabled = QGuiApplicationPrivate::platformTheme()->themeHint( - QPlatformTheme::MnemonicsEnabled).toBool(); -} - QQuickIconLabelPrivate::~QQuickIconLabelPrivate() = default; bool QQuickIconLabelPrivate::hasIcon() const @@ -366,13 +359,11 @@ void QQuickIconLabelPrivate::displayChange() QQuickIconLabel::QQuickIconLabel(QQuickItem *parent) : QQuickItem(*(new QQuickIconLabelPrivate), parent) { - d_func()->init(); } QQuickIconLabel::QQuickIconLabel(QQuickIconLabelPrivate &dd, QQuickItem *parent) : QQuickItem(dd, parent) { - d_func()->init(); } QQuickIconLabel::~QQuickIconLabel() diff --git a/src/quickcontrolsimpl/qquickiconlabel_p_p.h b/src/quickcontrolsimpl/qquickiconlabel_p_p.h index 15aa9fb42d..fba5132c7f 100644 --- a/src/quickcontrolsimpl/qquickiconlabel_p_p.h +++ b/src/quickcontrolsimpl/qquickiconlabel_p_p.h @@ -31,7 +31,6 @@ class Q_AUTOTEST_EXPORT QQuickIconLabelPrivate : public QQuickItemPrivate, Q_DECLARE_PUBLIC(QQuickIconLabel) public: - void init(); ~QQuickIconLabelPrivate() override; bool hasIcon() const; @@ -71,6 +70,10 @@ public: const QRectF &rectangle); bool mirrored = false; + // See QQuickMnemonicLabel::m_mnemonicEnabled for why this is true by default. + // We just act as an intermediary between types that require an Icon + Label, like Button, + // and the QQuickMnemonicLabel itself. Other types like CheckBox use QQuickCheckLabel directly, + // which derives from QQuickMnemonicLabel. bool mnemonicEnabled = true; QQuickIconLabel::Display display = QQuickIconLabel::TextBesideIcon; Qt::Alignment alignment = Qt::AlignCenter; diff --git a/src/quickcontrolsimpl/qquickmnemoniclabel.cpp b/src/quickcontrolsimpl/qquickmnemoniclabel.cpp index 471272ad45..01bb277b67 100644 --- a/src/quickcontrolsimpl/qquickmnemoniclabel.cpp +++ b/src/quickcontrolsimpl/qquickmnemoniclabel.cpp @@ -13,8 +13,6 @@ QT_BEGIN_NAMESPACE QQuickMnemonicLabel::QQuickMnemonicLabel(QQuickItem *parent) : QQuickText(parent) { - m_mnemonicEnabled = QGuiApplicationPrivate::platformTheme()->themeHint( - QPlatformTheme::MnemonicsEnabled).toBool(); } QString QQuickMnemonicLabel::text() const @@ -53,8 +51,7 @@ void QQuickMnemonicLabel::setText(const QString &text) \li \c false: the displayed text is \c "M&nemonic" (unchanged). \endlist - The default value is \c true if the platform supports mnemonics - (\c QPlatformTheme::MnemonicsEnabled), otherwise \c false. + The default value is \c true. */ bool QQuickMnemonicLabel::isMnemonicEnabled() const { @@ -103,7 +100,7 @@ void QQuickMnemonicLabel::updateMnemonic() while (len) { if (m_fullText.at(pos) == QLatin1Char('&') && (len == 1 || m_fullText.at(pos + 1) != QLatin1Char('&'))) { // A plain mnemonic marker, e.g. "M&nemonic": drop the "&" and - // underline the character that follows it. + // underline the character that follows it (if the platform supports it). if (showUnderline && (pos == 0 || m_fullText.at(pos - 1) != QLatin1Char('&'))) formats += underlineRange(pos); ++pos; @@ -116,8 +113,7 @@ void QQuickMnemonicLabel::updateMnemonic() m_fullText.at(pos + 3) == QLatin1Char(')')) { // A mnemonic with format "\s*(&X)", used when the label itself has // no natural character to underline (e.g. non-Latin scripts). Keep - // "X" in the text, and underline it if the platform draws - // underlines for shortcuts. + // "X" in the text, and underline it if the platform supports it. if (showUnderline) formats += underlineRange(pos + 1); } diff --git a/src/quickcontrolsimpl/qquickmnemoniclabel_p.h b/src/quickcontrolsimpl/qquickmnemoniclabel_p.h index b92a69ec42..71fd75ced8 100644 --- a/src/quickcontrolsimpl/qquickmnemoniclabel_p.h +++ b/src/quickcontrolsimpl/qquickmnemoniclabel_p.h @@ -41,6 +41,9 @@ public: private: void updateMnemonic(); + // True by default because it's the default for most types like Button: + // only ItemDelegate and its derived types set it to false. Note that underlining + // is controlled separately; see the docs for this property. bool m_mnemonicEnabled = true; QString m_fullText; }; |
