src/plugins/accessible/widgets/qaccessiblemenu.cpp File Reference

#include "qaccessiblemenu.h"
#include <qmenu.h>
#include <qmenubar.h>
#include <qstyle.h>

Include dependency graph for qaccessiblemenu.cpp:

Go to the source code of this file.

Functions

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


Function Documentation

QString Q_GUI_EXPORT qt_accHotKey ( const QString text  ) 

Definition at line 96 of file qaccessiblewidget.cpp.

00097 {
00098 #ifndef QT_NO_SHORTCUT
00099     if (text.isEmpty())
00100         return text;
00101 
00102     int fa = 0;
00103     QChar ac;
00104     while ((fa = text.indexOf(QLatin1Char('&'), fa)) != -1) {
00105         if (fa == text.length() - 1 || text.at(fa+1) != QLatin1Char('&')) {
00106             ac = text.at(fa+1);
00107             break;
00108         }
00109     }
00110     if (ac.isNull())
00111         return QString();
00112     return (QString)QKeySequence(Qt::ALT) + ac.toUpper();
00113 #else
00114     Q_UNUSED(text);
00115     return QString();
00116 #endif
00117 }

QString Q_GUI_EXPORT qt_accStripAmp ( const QString text  ) 

Definition at line 74 of file qaccessiblewidget.cpp.

00075 {
00076     if (text.isEmpty())
00077         return text;
00078 
00079     const QChar *ch = text.unicode();
00080     int length = text.length();
00081     QString str;
00082     while (length > 0) {
00083         if (*ch == QLatin1Char('&')) {
00084             ++ch;
00085             --length;
00086             if (!ch)
00087                 --ch;
00088         }
00089         str += *ch;
00090         ++ch;
00091         --length;
00092     }
00093     return str;
00094 }


Generated on Thu Mar 15 14:00:01 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1