diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-04-29 10:42:37 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-04-29 10:55:25 (GMT) |
commit | 2dbb9373af3d5cb0d395d99bad285d195ae9fa5c (patch) | |
tree | 827b06758c70090e60c1d57beb78396e25f93968 /src | |
parent | 3540dd2155c730a2aeb173265acb9f7b6e53a8a5 (diff) | |
download | Qt-2dbb9373af3d5cb0d395d99bad285d195ae9fa5c.zip Qt-2dbb9373af3d5cb0d395d99bad285d195ae9fa5c.tar.gz Qt-2dbb9373af3d5cb0d395d99bad285d195ae9fa5c.tar.bz2 |
Fix long menu item texts causing crash
Symbian uses buffer of CEikMenuPaneItem::SData::ENominalTextLength
characters for menu item texts, so truncate any text that is longer
than that.
Task-number: QTBUG-10207
Reviewed-by: Janne Anttila
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qmenu_symbian.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index 7224768..d4b1250 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -149,8 +149,12 @@ static void qt_symbian_insert_action(QSymbianMenuAction* action, QList<SymbianMe "Too many menu actions"); const int underlineShortCut = QApplication::style()->styleHint(QStyle::SH_UnderlineShortcut); - QString iconText = action->action->iconText(); - TPtrC menuItemText = qt_QString2TPtrC( underlineShortCut ? action->action->text() : iconText); + QString actionText; + if (underlineShortCut) + actionText = action->action->text().left(CEikMenuPaneItem::SData::ENominalTextLength); + else + actionText = action->action->iconText().left(CEikMenuPaneItem::SData::ENominalTextLength); + TPtrC menuItemText = qt_QString2TPtrC(actionText); if (action->action->menu()) { SymbianMenuItem* menuItem = new SymbianMenuItem(); menuItem->menuItemData.iCascadeId = action->command; |