6.2: currentIndexChanged signal is changed.

This commit is contained in:
xiaoyifang 2022-02-27 14:26:49 +08:00 committed by xiaoyifang
parent 7b5511a7bd
commit 23d833fbb8
4 changed files with 16 additions and 17 deletions

View file

@ -677,11 +677,11 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
connect( ui.showReference, SIGNAL( triggered() ), connect( ui.showReference, SIGNAL( triggered() ),
this, SLOT( showGDHelp() ) ); this, SLOT( showGDHelp() ) );
connect( groupListInDock, SIGNAL( currentIndexChanged( QString const & ) ), connect( groupListInDock, &GroupComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &MainWindow::currentGroupChanged );
connect( groupListInToolbar, SIGNAL( currentIndexChanged( QString const & ) ), connect( groupListInToolbar, &GroupComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &MainWindow::currentGroupChanged );
connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ),
this, SLOT( translateInputChanged( QString const & ) ) ); this, SLOT( translateInputChanged( QString const & ) ) );
@ -1391,8 +1391,8 @@ void MainWindow::updateGroupList()
// currentIndexChanged() signal is very trigger-happy. To avoid triggering // currentIndexChanged() signal is very trigger-happy. To avoid triggering
// it, we disconnect it while we're clearing and filling back groups. // it, we disconnect it while we're clearing and filling back groups.
disconnect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), disconnect( groupList, &GroupComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &MainWindow::currentGroupChanged );
groupInstances.clear(); groupInstances.clear();
@ -1437,8 +1437,8 @@ void MainWindow::updateGroupList()
view.reload(); view.reload();
} }
connect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), connect( groupList, &GroupComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &MainWindow::currentGroupChanged );
} }
void MainWindow::updateDictionaryBar() void MainWindow::updateDictionaryBar()
@ -2255,7 +2255,7 @@ void MainWindow::editPreferences()
ftsIndexing.doIndexing(); ftsIndexing.doIndexing();
} }
void MainWindow::currentGroupChanged( QString const & ) void MainWindow::currentGroupChanged( int )
{ {
cfg.lastMainGroupId = groupList->getCurrentGroup(); cfg.lastMainGroupId = groupList->getCurrentGroup();
Instances::Group const * igrp = groupInstances.findGroup( cfg.lastMainGroupId ); Instances::Group const * igrp = groupInstances.findGroup( cfg.lastMainGroupId );
@ -3740,8 +3740,8 @@ void MainWindow::applyWordsZoomLevel()
if ( groupList->font().pointSize() != ps ) if ( groupList->font().pointSize() != ps )
{ {
disconnect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), disconnect( groupList, &GroupComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &MainWindow::currentGroupChanged );
int n = groupList->currentIndex(); int n = groupList->currentIndex();
groupList->clear(); groupList->clear();
groupList->setFont( font ); groupList->setFont( font );

View file

@ -377,7 +377,7 @@ private slots:
void editCurrentGroup(); void editCurrentGroup();
void editPreferences(); void editPreferences();
void currentGroupChanged( QString const & ); void currentGroupChanged( int );
void translateInputChanged( QString const & ); void translateInputChanged( QString const & );
void translateInputFinished( bool checkModifiers = true ); void translateInputFinished( bool checkModifiers = true );

View file

@ -254,8 +254,8 @@ ScanPopup::ScanPopup( QWidget * parent,
connect( &switchExpandModeAction, SIGNAL( triggered() ), connect( &switchExpandModeAction, SIGNAL( triggered() ),
this, SLOT(switchExpandOptionalPartsMode() ) ); this, SLOT(switchExpandOptionalPartsMode() ) );
connect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ), connect( ui.groupList, &QComboBox::currentIndexChanged,
this, SLOT( currentGroupChanged( QString const & ) ) ); this, &ScanPopup::currentGroupChanged);
connect( &wordFinder, SIGNAL( finished() ), connect( &wordFinder, SIGNAL( finished() ),
this, SLOT( prefixMatchFinished() ) ); this, SLOT( prefixMatchFinished() ) );
@ -717,8 +717,7 @@ QString ScanPopup::elideInputWord()
QString const & inputWord = inputPhrase.phrase; QString const & inputWord = inputPhrase.phrase;
return inputWord.size() > 32 ? inputWord.mid( 0, 32 ) + "..." : inputWord; return inputWord.size() > 32 ? inputWord.mid( 0, 32 ) + "..." : inputWord;
} }
void ScanPopup::currentGroupChanged( int )
void ScanPopup::currentGroupChanged( QString const & )
{ {
cfg.lastPopupGroupId = ui.groupList->getCurrentGroup(); cfg.lastPopupGroupId = ui.groupList->getCurrentGroup();
Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId ); Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId );

View file

@ -194,7 +194,7 @@ private:
private slots: private slots:
void clipboardChanged( QClipboard::Mode ); void clipboardChanged( QClipboard::Mode );
void mouseHovered( QString const & , bool forcePopup); void mouseHovered( QString const & , bool forcePopup);
void currentGroupChanged( QString const & ); void currentGroupChanged( int );
void prefixMatchFinished(); void prefixMatchFinished();
void on_pronounceButton_clicked(); void on_pronounceButton_clicked();
void pinButtonClicked( bool checked ); void pinButtonClicked( bool checked );