Qt 4.8
Functions
qaccessiblemenu.cpp File Reference
#include "qaccessiblemenu.h"
#include <qmenu.h>
#include <qmenubar.h>
#include <QtGui/QAction>
#include <qstyle.h>

Go to the source code of this file.

Functions

QString Q_GUI_EXPORT qt_accHotKey (const QString &text)
 
QString Q_GUI_EXPORT qt_accStripAmp (const QString &text)
 

Function Documentation

◆ qt_accHotKey()

QString Q_GUI_EXPORT qt_accHotKey ( const QString text)

Definition at line 145 of file qaccessiblewidget.cpp.

Referenced by QAccessibleMenuBar::text(), and QAccessibleMenuItem::text().

146 {
147  int ampIndex = qt_accAmpIndex(text);
148  if (ampIndex != -1)
149  return (QString)QKeySequence(Qt::ALT) + text.at(ampIndex + 1);
150 
151  return QString();
152 }
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
The QString class provides a Unicode character string.
Definition: qstring.h:83
static int qt_accAmpIndex(const QString &text)
The QKeySequence class encapsulates a key sequence as used by shortcuts.
Definition: qkeysequence.h:72

◆ qt_accStripAmp()

QString Q_GUI_EXPORT qt_accStripAmp ( const QString text)

Definition at line 135 of file qaccessiblewidget.cpp.

Referenced by QAccessibleMenu::text(), QAccessibleMenuBar::text(), and QAccessibleMenuItem::text().

136 {
137  QString newText(text);
138  int ampIndex = qt_accAmpIndex(newText);
139  if (ampIndex != -1)
140  newText.remove(ampIndex, 1);
141 
142  return newText.replace(QLatin1String("&&"), QLatin1String("&"));
143 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static int qt_accAmpIndex(const QString &text)