From 41caeebd8cef6bf3e50e50e3f9bb6c8ce096af50 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 27 Sep 2019 13:51:01 +0200 Subject: [PATCH] Use wxString rather than QString methods It's preferable to use code which is simpler to understand to wx developers not necessarily familiar with Qt API and which can also be reused with the other ports if necessary. In this particular case, using wxString::AfterFirst() also results in shorter and more clear code too. See https://github.com/wxWidgets/wxWidgets/pull/1544 --- src/qt/menuitem.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qt/menuitem.cpp b/src/qt/menuitem.cpp index 268c8300b4..0792230ad7 100644 --- a/src/qt/menuitem.cpp +++ b/src/qt/menuitem.cpp @@ -174,15 +174,11 @@ wxQtAction::wxQtAction( wxMenu *parent, int id, const wxString &text, const wxSt void wxQtAction::UpdateShortcutsFromLabel(const wxString& text) { #if wxUSE_ACCEL - QString qlabel = wxQtConvertString( text ); - int index = qlabel.lastIndexOf( QChar( '\t' ) ); - - if ( index != -1 ) + const wxString accelStr = text.AfterFirst('\t'); + if ( !accelStr.empty() ) { QList shortcuts; - QString shortcut_key = qlabel.remove( 0, index+1 ); - - shortcuts.append( QKeySequence( shortcut_key ) ); + shortcuts.append( QKeySequence( wxQtConvertString(accelStr) ) ); setShortcuts( shortcuts ); } #endif // wxUSE_ACCEL