mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-28 03:44:07 +00:00
Merge pull request #1025 from GD-fix/safety_menu_sequence
Safety menu sequence in dictionaries order window
This commit is contained in:
commit
6efb52109c
|
@ -252,13 +252,8 @@ void OrderAndProps::describeDictionary( DictListWidget * lst, QModelIndex const
|
||||||
void OrderAndProps::contextMenuRequested( const QPoint & pos )
|
void OrderAndProps::contextMenuRequested( const QPoint & pos )
|
||||||
{
|
{
|
||||||
QMenu menu( this );
|
QMenu menu( this );
|
||||||
QAction * sortNameAction = new QAction( tr( "Sort by name" ), &menu );
|
|
||||||
menu.addAction( sortNameAction );
|
|
||||||
QAction * sortLangAction = new QAction( tr( "Sort by languages" ), &menu );
|
|
||||||
menu.addAction( sortLangAction );
|
|
||||||
|
|
||||||
QAction * showHeadwordsAction = NULL;
|
QAction * showHeadwordsAction = NULL;
|
||||||
|
|
||||||
QModelIndex idx = ui.searchLine->mapToSource( ui.dictionaryOrder->indexAt( pos ) );
|
QModelIndex idx = ui.searchLine->mapToSource( ui.dictionaryOrder->indexAt( pos ) );
|
||||||
sptr< Dictionary::Class > dict;
|
sptr< Dictionary::Class > dict;
|
||||||
if( idx.isValid() && (unsigned)idx.row() < ui.dictionaryOrder->getCurrentDictionaries().size() )
|
if( idx.isValid() && (unsigned)idx.row() < ui.dictionaryOrder->getCurrentDictionaries().size() )
|
||||||
|
@ -269,6 +264,11 @@ void OrderAndProps::contextMenuRequested( const QPoint & pos )
|
||||||
menu.addAction( showHeadwordsAction );
|
menu.addAction( showHeadwordsAction );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction * sortNameAction = new QAction( tr( "Sort by name" ), &menu );
|
||||||
|
menu.addAction( sortNameAction );
|
||||||
|
QAction * sortLangAction = new QAction( tr( "Sort by languages" ), &menu );
|
||||||
|
menu.addAction( sortLangAction );
|
||||||
|
|
||||||
QAction * result = menu.exec( ui.dictionaryOrder->mapToGlobal( pos ) );
|
QAction * result = menu.exec( ui.dictionaryOrder->mapToGlobal( pos ) );
|
||||||
|
|
||||||
if( result == sortNameAction || result == sortLangAction )
|
if( result == sortNameAction || result == sortLangAction )
|
||||||
|
|
Loading…
Reference in a new issue