Changeset View
Changeset View
Standalone View
Standalone View
src/kacceleratormanager.cpp
Show First 20 Lines • Show All 783 Lines • ▼ Show 20 Line(s) | 782 | { | |||
---|---|---|---|---|---|
784 | Q_FOREACH (QAction *maction, m_popup->actions()) { | 784 | Q_FOREACH (QAction *maction, m_popup->actions()) { | ||
785 | if (maction->isSeparator()) { | 785 | if (maction->isSeparator()) { | ||
786 | continue; | 786 | continue; | ||
787 | } | 787 | } | ||
788 | 788 | | |||
789 | QString iconText = maction->iconText(); | 789 | QString iconText = maction->iconText(); | ||
790 | const QString oldText = maction->text(); | 790 | const QString oldText = maction->text(); | ||
791 | // Check if iconText was generated by Qt. In that case ignore it (no support for CJK accelerators) and set it from the text. | 791 | // Check if iconText was generated by Qt. In that case ignore it (no support for CJK accelerators) and set it from the text. | ||
792 | if (iconText == copy_of_qt_strippedText(oldText)) { | 792 | if (iconText == copy_of_qt_strippedText(oldText)) { | ||
apol: What happens when iconText.isEmpty()? | |||||
Qt returns QAction::text() when QAction::iconText() is empty. Apparently Qt also strips some text, so to check if there was no iconText(), we need this weird check instead of using isEmpty(). cfeck: Qt returns QAction::text() when QAction::iconText() is empty. Apparently Qt also strips some… | |||||
793 | iconText = removeAcceleratorMarker(oldText); | 793 | iconText = removeAcceleratorMarker(oldText); | ||
794 | } | 794 | if (iconText != maction->iconText()) { | ||
795 | maction->setIconText(iconText); | 795 | maction->setIconText(iconText); | ||
796 | } | ||||
797 | } | ||||
796 | 798 | | |||
797 | if (KAcceleratorManagerPrivate::checkChange(list[cnt])) { | 799 | if (KAcceleratorManagerPrivate::checkChange(list[cnt])) { | ||
798 | maction->setText(list[cnt].accelerated()); | 800 | maction->setText(list[cnt].accelerated()); | ||
799 | } | 801 | } | ||
800 | cnt++; | 802 | cnt++; | ||
801 | } | 803 | } | ||
802 | } | 804 | } | ||
803 | 805 | | |||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |
What happens when iconText.isEmpty()?