clean: convert a few trivial old SIGNAL/SLOT to new syntax

This commit is contained in:
shenleban tongying 2023-06-11 10:31:47 -04:00
parent 7e93d787b5
commit 35f39ea7a0
No known key found for this signature in database
8 changed files with 25 additions and 18 deletions

View file

@ -246,8 +246,8 @@ FullTextSearchDialog::FullTextSearchDialog( QWidget * parent,
connect( this, &QDialog::finished, this, &FullTextSearchDialog::saveData );
connect( ui.OKButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
connect( ui.cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( ui.OKButton, &QPushButton::clicked, this, &QDialog::accept );
connect( ui.cancelButton, &QPushButton::clicked, this, &QDialog::reject );
helpAction.setShortcut( QKeySequence( "F1" ) );

View file

@ -176,7 +176,7 @@ ArticleView::ArticleView( QWidget * parent, ArticleNetworkAccessManager & nm, Au
connect( webview, &QWidget::customContextMenuRequested, this, &ArticleView::contextMenuRequested );
connect( webview->page(), SIGNAL( linkHovered( const QString & ) ), this, SLOT( linkHovered( const QString & ) ) );
connect( webview->page(), &QWebEnginePage::linkHovered, this, &ArticleView::linkHovered );
connect( webview, &ArticleWebView::doubleClicked, this, &ArticleView::doubleClicked );

View file

@ -113,9 +113,9 @@ void FavoritesPaneWidget::setUp( Config::Class * cfg, QMenu * menu )
connect( m_favoritesTree, &QAbstractItemView::clicked, this, &FavoritesPaneWidget::onItemClicked );
connect( m_favoritesTree->selectionModel(),
SIGNAL( selectionChanged( QItemSelection const &, QItemSelection const & ) ),
this,
SLOT( onSelectionChanged( QItemSelection const & ) ) );
&QItemSelectionModel::selectionChanged,
this,
&FavoritesPaneWidget::onSelectionChanged );
connect( m_favoritesTree, &QWidget::customContextMenuRequested, this, &FavoritesPaneWidget::showCustomMenu );
}
@ -196,8 +196,10 @@ void FavoritesPaneWidget::showCustomMenu(QPoint const & pos)
m_favoritesMenu->exec( m_favoritesTree->mapToGlobal( pos ) );
}
void FavoritesPaneWidget::onSelectionChanged( QItemSelection const & selection )
void FavoritesPaneWidget::onSelectionChanged( const QItemSelection & selection, const QItemSelection & deselected )
{
Q_UNUSED( deselected )
if ( m_favoritesTree->selectionModel()->selectedIndexes().size() != 1
|| selection.indexes().isEmpty() )
return;

View file

@ -68,7 +68,7 @@ protected:
private slots:
void emitFavoritesItemRequested(QModelIndex const &);
void onSelectionChanged(QItemSelection const & selection);
void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected );
void onItemClicked(QModelIndex const & idx);
void showCustomMenu(QPoint const & pos);
void deleteSelectedItems();

View file

@ -78,8 +78,10 @@ void HistoryPaneWidget::setUp( Config::Class * cfg, History * history, QMenu *
// list selection and keyboard navigation
connect( m_historyList, &QAbstractItemView::clicked, this, &HistoryPaneWidget::onItemClicked );
connect( m_history, &History::itemsChanged, this, &HistoryPaneWidget::updateHistoryCounts );
connect ( m_historyList->selectionModel(), SIGNAL( selectionChanged ( QItemSelection const & , QItemSelection const & ) ),
this, SLOT( onSelectionChanged( QItemSelection const & ) ) );
connect( m_historyList->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&HistoryPaneWidget::onSelectionChanged );
connect( m_historyList, &QWidget::customContextMenuRequested, this, &HistoryPaneWidget::showCustomMenu );
@ -188,9 +190,9 @@ void HistoryPaneWidget::emitHistoryItemRequested( QModelIndex const & idx )
}
}
void HistoryPaneWidget::onSelectionChanged( QItemSelection const & selection )
void HistoryPaneWidget::onSelectionChanged( const QItemSelection & selection, const QItemSelection & deselected )
{
// qDebug() << "selectionChanged";
Q_UNUSED( deselected );
if ( selection.empty() )
return;

View file

@ -40,7 +40,7 @@ public slots:
private slots:
void emitHistoryItemRequested(QModelIndex const &);
void onSelectionChanged(QItemSelection const & selection);
void onSelectionChanged( const QItemSelection & selection, const QItemSelection & deselected );
void onItemClicked(QModelIndex const & idx);
void showCustomMenu(QPoint const & pos);
void deleteSelectedItems();

View file

@ -108,8 +108,10 @@ OrderAndProps::OrderAndProps( QWidget * parent,
connect( ui.dictionaryOrder, &DictListWidget::gotFocus, this, &OrderAndProps::dictListFocused );
connect( ui.inactiveDictionaries, &DictListWidget::gotFocus, this, &OrderAndProps::inactiveDictListFocused );
connect ( ui.dictionaryOrder->selectionModel(), SIGNAL( selectionChanged ( const QItemSelection & , const QItemSelection & ) ),
this, SLOT( dictionarySelectionChanged( const QItemSelection & ) ) );
connect( ui.dictionaryOrder->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
&OrderAndProps::dictionarySelectionChanged );
connect( ui.inactiveDictionaries->selectionModel(),
&QItemSelectionModel::selectionChanged,
this,
@ -158,8 +160,10 @@ void OrderAndProps::inactiveDictListFocused()
describeDictionary( ui.inactiveDictionaries, ui.inactiveDictionaries->currentIndex() );
}
void OrderAndProps::dictionarySelectionChanged( const QItemSelection & current )
void OrderAndProps::dictionarySelectionChanged( const QItemSelection & current, const QItemSelection & deselected )
{
Q_UNUSED( deselected )
if ( current.empty() )
return;

View file

@ -22,8 +22,7 @@ public:
Config::Group getCurrentInactiveDictionaries() const;
private slots:
void dictionarySelectionChanged( const QItemSelection &current );
void dictionarySelectionChanged( const QItemSelection & current, const QItemSelection & deselected );
void inactiveDictionarySelectionChanged( const QItemSelection &current );
void contextMenuRequested( const QPoint & pos );
void filterChanged( QString const & filterText );