From 23d833fbb83058963514d208168bb5dcadfd3aee Mon Sep 17 00:00:00 2001 From: xiaoyifang Date: Sun, 27 Feb 2022 14:26:49 +0800 Subject: [PATCH] 6.2: currentIndexChanged signal is changed. --- mainwindow.cc | 22 +++++++++++----------- mainwindow.hh | 2 +- scanpopup.cc | 7 +++---- scanpopup.hh | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/mainwindow.cc b/mainwindow.cc index 3ad8e914..7a1050e8 100644 --- a/mainwindow.cc +++ b/mainwindow.cc @@ -677,11 +677,11 @@ MainWindow::MainWindow( Config::Class & cfg_ ): connect( ui.showReference, SIGNAL( triggered() ), this, SLOT( showGDHelp() ) ); - connect( groupListInDock, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + connect( groupListInDock, &GroupComboBox::currentIndexChanged, + this, &MainWindow::currentGroupChanged ); - connect( groupListInToolbar, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + connect( groupListInToolbar, &GroupComboBox::currentIndexChanged, + this, &MainWindow::currentGroupChanged ); connect( ui.translateLine, SIGNAL( textChanged( QString const & ) ), this, SLOT( translateInputChanged( QString const & ) ) ); @@ -1391,8 +1391,8 @@ void MainWindow::updateGroupList() // currentIndexChanged() signal is very trigger-happy. To avoid triggering // it, we disconnect it while we're clearing and filling back groups. - disconnect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + disconnect( groupList, &GroupComboBox::currentIndexChanged, + this, &MainWindow::currentGroupChanged ); groupInstances.clear(); @@ -1437,8 +1437,8 @@ void MainWindow::updateGroupList() view.reload(); } - connect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + connect( groupList, &GroupComboBox::currentIndexChanged, + this, &MainWindow::currentGroupChanged ); } void MainWindow::updateDictionaryBar() @@ -2255,7 +2255,7 @@ void MainWindow::editPreferences() ftsIndexing.doIndexing(); } -void MainWindow::currentGroupChanged( QString const & ) +void MainWindow::currentGroupChanged( int ) { cfg.lastMainGroupId = groupList->getCurrentGroup(); Instances::Group const * igrp = groupInstances.findGroup( cfg.lastMainGroupId ); @@ -3740,8 +3740,8 @@ void MainWindow::applyWordsZoomLevel() if ( groupList->font().pointSize() != ps ) { - disconnect( groupList, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + disconnect( groupList, &GroupComboBox::currentIndexChanged, + this, &MainWindow::currentGroupChanged ); int n = groupList->currentIndex(); groupList->clear(); groupList->setFont( font ); diff --git a/mainwindow.hh b/mainwindow.hh index 3cab316a..cf77a657 100644 --- a/mainwindow.hh +++ b/mainwindow.hh @@ -377,7 +377,7 @@ private slots: void editCurrentGroup(); void editPreferences(); - void currentGroupChanged( QString const & ); + void currentGroupChanged( int ); void translateInputChanged( QString const & ); void translateInputFinished( bool checkModifiers = true ); diff --git a/scanpopup.cc b/scanpopup.cc index 01ef02f8..c0d3ea07 100644 --- a/scanpopup.cc +++ b/scanpopup.cc @@ -254,8 +254,8 @@ ScanPopup::ScanPopup( QWidget * parent, connect( &switchExpandModeAction, SIGNAL( triggered() ), this, SLOT(switchExpandOptionalPartsMode() ) ); - connect( ui.groupList, SIGNAL( currentIndexChanged( QString const & ) ), - this, SLOT( currentGroupChanged( QString const & ) ) ); + connect( ui.groupList, &QComboBox::currentIndexChanged, + this, &ScanPopup::currentGroupChanged); connect( &wordFinder, SIGNAL( finished() ), this, SLOT( prefixMatchFinished() ) ); @@ -717,8 +717,7 @@ QString ScanPopup::elideInputWord() QString const & inputWord = inputPhrase.phrase; return inputWord.size() > 32 ? inputWord.mid( 0, 32 ) + "..." : inputWord; } - -void ScanPopup::currentGroupChanged( QString const & ) +void ScanPopup::currentGroupChanged( int ) { cfg.lastPopupGroupId = ui.groupList->getCurrentGroup(); Instances::Group const * igrp = groups.findGroup( cfg.lastPopupGroupId ); diff --git a/scanpopup.hh b/scanpopup.hh index 3ee7d05a..e081ae0a 100644 --- a/scanpopup.hh +++ b/scanpopup.hh @@ -194,7 +194,7 @@ private: private slots: void clipboardChanged( QClipboard::Mode ); void mouseHovered( QString const & , bool forcePopup); - void currentGroupChanged( QString const & ); + void currentGroupChanged( int ); void prefixMatchFinished(); void on_pronounceButton_clicked(); void pinButtonClicked( bool checked );