diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2017-03-14 16:30:27 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2017-05-02 13:56:19 +0000 |
commit | 63bee398b5db72fdb40d039d8e01223992655403 (patch) | |
tree | d353a259514f35c95a793fb68e41f3c84268fca2 | |
parent | 07ebe565913f8cdc531c862fed62d0398c83ecc4 (diff) | |
download | qttools-63bee398b5db72fdb40d039d8e01223992655403.tar.gz |
Refactor connect to use Qt5 style
Change-Id: I9fed1b82d5afd0458b772475d303d2c0179ac73e
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
47 files changed, 602 insertions, 534 deletions
diff --git a/src/assistant/assistant/aboutdialog.cpp b/src/assistant/assistant/aboutdialog.cpp index 24ff1c9a6..6ab795ab3 100644 --- a/src/assistant/assistant/aboutdialog.cpp +++ b/src/assistant/assistant/aboutdialog.cpp @@ -103,7 +103,7 @@ AboutDialog::AboutDialog(QWidget *parent) m_closeButton = new QPushButton(); m_closeButton->setText(tr("&Close")); - connect(m_closeButton, SIGNAL(clicked()), this, SLOT(close())); + connect(m_closeButton, &QAbstractButton::clicked, this, &QWidget::close); m_layout = new QGridLayout(this); m_layout->addWidget(m_aboutLabel, 1, 0, 1, -1); diff --git a/src/assistant/assistant/bookmarkdialog.cpp b/src/assistant/assistant/bookmarkdialog.cpp index 6091c87a6..8207da04e 100644 --- a/src/assistant/assistant/bookmarkdialog.cpp +++ b/src/assistant/assistant/bookmarkdialog.cpp @@ -51,18 +51,17 @@ BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title, ui.newFolderButton->setVisible(false); ui.buttonBox->button(QDialogButtonBox::Ok)->setDefault(true); - connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(accepted())); - connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(rejected())); - connect(ui.newFolderButton, SIGNAL(clicked()), this, SLOT(addFolder())); - connect(ui.toolButton, SIGNAL(clicked()), this, SLOT(toolButtonClicked())); - connect(ui.bookmarkEdit, SIGNAL(textChanged(QString)), this, - SLOT(textChanged(QString))); + connect(ui.buttonBox, &QDialogButtonBox::accepted, this, &BookmarkDialog::accepted); + connect(ui.buttonBox, &QDialogButtonBox::rejected, this, &BookmarkDialog::rejected); + connect(ui.newFolderButton, &QAbstractButton::clicked, this, &BookmarkDialog::addFolder); + connect(ui.toolButton, &QAbstractButton::clicked, this, &BookmarkDialog::toolButtonClicked); + connect(ui.bookmarkEdit, &QLineEdit::textChanged, this, &BookmarkDialog::textChanged); bookmarkProxyModel = new BookmarkFilterModel(this); bookmarkProxyModel->setSourceModel(bookmarkModel); ui.bookmarkFolders->setModel(bookmarkProxyModel); - connect(ui.bookmarkFolders, SIGNAL(currentIndexChanged(int)), this, - SLOT(currentIndexChanged(int))); + connect(ui.bookmarkFolders, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, QOverload<int>::of(&BookmarkDialog::currentIndexChanged)); bookmarkTreeModel = new BookmarkTreeModel(this); bookmarkTreeModel->setSourceModel(bookmarkModel); @@ -74,10 +73,10 @@ BookmarkDialog::BookmarkDialog(BookmarkModel *sourceModel, const QString &title, ui.treeView->viewport()->installEventFilter(this); ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(customContextMenuRequested(QPoint))); - connect(ui.treeView->selectionModel(), SIGNAL(currentChanged(QModelIndex, - QModelIndex)), this, SLOT(currentIndexChanged(QModelIndex))); + connect(ui.treeView, &QWidget::customContextMenuRequested, + this, &BookmarkDialog::customContextMenuRequested); + connect(ui.treeView->selectionModel(), &QItemSelectionModel::currentChanged, + this, QOverload<const QModelIndex &>::of(&BookmarkDialog::currentIndexChanged)); ui.bookmarkFolders->setCurrentIndex(ui.bookmarkFolders->count() > 1 ? 1 : 0); diff --git a/src/assistant/assistant/bookmarkfiltermodel.cpp b/src/assistant/assistant/bookmarkfiltermodel.cpp index d0078840d..1e8b6a7f2 100644 --- a/src/assistant/assistant/bookmarkfiltermodel.cpp +++ b/src/assistant/assistant/bookmarkfiltermodel.cpp @@ -42,47 +42,44 @@ void BookmarkFilterModel::setSourceModel(QAbstractItemModel *_sourceModel) beginResetModel(); if (sourceModel) { - disconnect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(changed(QModelIndex,QModelIndex))); - disconnect(sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(rowsInserted(QModelIndex,int,int))); - disconnect(sourceModel, - SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), this, - SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); - disconnect(sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), - this, SLOT(rowsRemoved(QModelIndex,int,int))); - disconnect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, - SLOT(layoutAboutToBeChanged())); - disconnect(sourceModel, SIGNAL(layoutChanged()), this, - SLOT(layoutChanged())); - disconnect(sourceModel, SIGNAL(modelAboutToBeReset()), this, - SLOT(modelAboutToBeReset())); - disconnect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); + disconnect(sourceModel, &QAbstractItemModel::dataChanged, + this, &BookmarkFilterModel::changed); + disconnect(sourceModel, &QAbstractItemModel::rowsInserted, + this, &BookmarkFilterModel::rowsInserted); + disconnect(sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &BookmarkFilterModel::rowsAboutToBeRemoved); + disconnect(sourceModel, &QAbstractItemModel::rowsRemoved, + this, &BookmarkFilterModel::rowsRemoved); + disconnect(sourceModel, &QAbstractItemModel::layoutAboutToBeChanged, + this, &BookmarkFilterModel::layoutAboutToBeChanged); + disconnect(sourceModel, &QAbstractItemModel::layoutChanged, + this, &BookmarkFilterModel::layoutChanged); + disconnect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, + this, &BookmarkFilterModel::modelAboutToBeReset); + disconnect(sourceModel, &QAbstractItemModel::modelReset, + this, &BookmarkFilterModel::modelReset); } sourceModel = qobject_cast<BookmarkModel*> (_sourceModel); QAbstractProxyModel::setSourceModel(sourceModel); if (sourceModel) { - connect(sourceModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, - SLOT(changed(QModelIndex,QModelIndex))); - - connect(sourceModel, SIGNAL(rowsInserted(QModelIndex,int,int)), - this, SLOT(rowsInserted(QModelIndex,int,int))); - - connect(sourceModel, SIGNAL(rowsAboutToBeRemoved(QModelIndex,int,int)), - this, SLOT(rowsAboutToBeRemoved(QModelIndex,int,int))); - connect(sourceModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, - SLOT(rowsRemoved(QModelIndex,int,int))); - - connect(sourceModel, SIGNAL(layoutAboutToBeChanged()), this, - SLOT(layoutAboutToBeChanged())); - connect(sourceModel, SIGNAL(layoutChanged()), this, - SLOT(layoutChanged())); - - connect(sourceModel, SIGNAL(modelAboutToBeReset()), this, - SLOT(modelAboutToBeReset())); - connect(sourceModel, SIGNAL(modelReset()), this, SLOT(modelReset())); + connect(sourceModel, &QAbstractItemModel::dataChanged, + this, &BookmarkFilterModel::changed); + connect(sourceModel, &QAbstractItemModel::rowsInserted, + this, &BookmarkFilterModel::rowsInserted); + connect(sourceModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &BookmarkFilterModel::rowsAboutToBeRemoved); + connect(sourceModel, &QAbstractItemModel::rowsRemoved, + this, &BookmarkFilterModel::rowsRemoved); + connect(sourceModel, &QAbstractItemModel::layoutAboutToBeChanged, + this, &BookmarkFilterModel::layoutAboutToBeChanged); + connect(sourceModel, &QAbstractItemModel::layoutChanged, + this, &BookmarkFilterModel::layoutChanged); + connect(sourceModel, &QAbstractItemModel::modelAboutToBeReset, + this, &BookmarkFilterModel::modelAboutToBeReset); + connect(sourceModel, &QAbstractItemModel::modelReset, + this, &BookmarkFilterModel::modelReset); setupCache(sourceModel->index(0, 0, QModelIndex()).parent()); } diff --git a/src/assistant/assistant/bookmarkmanager.cpp b/src/assistant/assistant/bookmarkmanager.cpp index 702808174..9016c2c6e 100644 --- a/src/assistant/assistant/bookmarkmanager.cpp +++ b/src/assistant/assistant/bookmarkmanager.cpp @@ -54,7 +54,7 @@ void BookmarkManager::BookmarkWidget::focusInEvent(QFocusEvent *event) ui.lineEdit->setFocus(); // force the focus in event on bookmark manager - emit focusInEvent(); + emit focusInEventOccurred(); } } @@ -71,11 +71,8 @@ BookmarkManager::BookmarkTreeView::BookmarkTreeView(QWidget *parent) setDropIndicatorShown(true); setExpandsOnDoubleClick(true); - connect(this, SIGNAL(expanded(QModelIndex)), this, - SLOT(setExpandedData(QModelIndex))); - connect(this, SIGNAL(collapsed(QModelIndex)), this, - SLOT(setExpandedData(QModelIndex))); - + connect(this, &QTreeView::expanded, this, &BookmarkTreeView::setExpandedData); + connect(this, &QTreeView::collapsed, this, &BookmarkTreeView::setExpandedData); } void BookmarkManager::BookmarkTreeView::subclassKeyPressEvent(QKeyEvent *event) @@ -162,13 +159,14 @@ BookmarkManager::BookmarkManager() { TRACE_OBJ bookmarkWidget->installEventFilter(this); - connect(bookmarkWidget->ui.add, SIGNAL(clicked()), this, - SLOT(addBookmark())); - connect(bookmarkWidget->ui.remove, SIGNAL(clicked()), this, - SLOT(removeBookmark())); - connect(bookmarkWidget->ui.lineEdit, SIGNAL(textChanged(QString)), this, - SLOT(textChanged(QString))); - connect(bookmarkWidget, SIGNAL(focusInEvent()), this, SLOT(focusInEvent())); + connect(bookmarkWidget->ui.add, &QAbstractButton::clicked, + this, &BookmarkManager::addBookmarkActivated); + connect(bookmarkWidget->ui.remove, &QAbstractButton::clicked, + this, &BookmarkManager::removeBookmarkActivated); + connect(bookmarkWidget->ui.lineEdit, &QLineEdit::textChanged, + this, &BookmarkManager::textChanged); + connect(bookmarkWidget, &BookmarkWidget::focusInEventOccurred, + this, &BookmarkManager::focusInEventOccurred); bookmarkTreeView->setModel(bookmarkModel); bookmarkTreeView->installEventFilter(this); @@ -176,26 +174,27 @@ BookmarkManager::BookmarkManager() bookmarkTreeView->setContextMenuPolicy(Qt::CustomContextMenu); bookmarkWidget->ui.stackedWidget->addWidget(bookmarkTreeView); - connect(bookmarkTreeView, SIGNAL(activated(QModelIndex)), this, - SLOT(setSourceFromIndex(QModelIndex))); - connect(bookmarkTreeView, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(customContextMenuRequested(QPoint))); - - connect(&HelpEngineWrapper::instance(), SIGNAL(setupFinished()), this, - SLOT(setupFinished())); - connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, - SLOT(refreshBookmarkMenu())); - connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, - SLOT(refreshBookmarkMenu())); - connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, - SLOT(refreshBookmarkMenu())); - - connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, - SLOT(refreshBookmarkToolBar())); - connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, - SLOT(refreshBookmarkToolBar())); - connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, - SLOT(refreshBookmarkToolBar())); + connect(bookmarkTreeView, &QAbstractItemView::activated, + [this](const QModelIndex &index) { setSourceFromIndex(index, false); }); + connect(bookmarkTreeView, &QWidget::customContextMenuRequested, + this, &BookmarkManager::customContextMenuRequested); + + connect(&HelpEngineWrapper::instance(), &HelpEngineWrapper::setupFinished, + this, &BookmarkManager::setupFinished); + + connect(bookmarkModel, &QAbstractItemModel::rowsRemoved, + this, &BookmarkManager::refreshBookmarkMenu); + connect(bookmarkModel, &QAbstractItemModel::rowsInserted, + this, &BookmarkManager::refreshBookmarkMenu); + connect(bookmarkModel, &QAbstractItemModel::dataChanged, + this, &BookmarkManager::refreshBookmarkMenu); + + connect(bookmarkModel, &QAbstractItemModel::rowsRemoved, + this, &BookmarkManager::refreshBookmarkToolBar); + connect(bookmarkModel, &QAbstractItemModel::rowsInserted, + this, &BookmarkManager::refreshBookmarkToolBar); + connect(bookmarkModel, &QAbstractItemModel::dataChanged, + this, &BookmarkManager::refreshBookmarkToolBar); } BookmarkManager::~BookmarkManager() @@ -333,14 +332,14 @@ void BookmarkManager::setupFinished() typeAndSearchModel->setSourceModel(bookmarkFilterModel); } -void BookmarkManager::addBookmark() +void BookmarkManager::addBookmarkActivated() { TRACE_OBJ if (CentralWidget *widget = CentralWidget::instance()) addBookmark(widget->currentTitle(), widget->currentSource().toString()); } -void BookmarkManager::removeBookmark() +void BookmarkManager::removeBookmarkActivated() { TRACE_OBJ removeItem(bookmarkTreeView->currentIndex()); @@ -351,12 +350,12 @@ void BookmarkManager::manageBookmarks() TRACE_OBJ if (bookmarkManagerWidget == 0) { bookmarkManagerWidget = new BookmarkManagerWidget(bookmarkModel); - connect(bookmarkManagerWidget, SIGNAL(setSource(QUrl)), this, - SIGNAL(setSource(QUrl))); - connect(bookmarkManagerWidget, SIGNAL(setSourceInNewTab(QUrl)) - , this, SIGNAL(setSourceInNewTab(QUrl))); - connect(bookmarkManagerWidget, SIGNAL(managerWidgetAboutToClose()) - , this, SLOT(managerWidgetAboutToClose())); + connect(bookmarkManagerWidget, &BookmarkManagerWidget::setSource, + this, &BookmarkManager::setSource); + connect(bookmarkManagerWidget, &BookmarkManagerWidget::setSourceInNewTab, + this, &BookmarkManager::setSourceInNewTab); + connect(bookmarkManagerWidget, &BookmarkManagerWidget::managerWidgetAboutToClose, + this, &BookmarkManager::managerWidgetAboutToClose); } bookmarkManagerWidget->show(); bookmarkManagerWidget->raise(); @@ -371,9 +370,10 @@ void BookmarkManager::refreshBookmarkMenu() bookmarkMenu->clear(); bookmarkMenu->addAction(tr("Manage Bookmarks..."), this, - SLOT(manageBookmarks())); - bookmarkMenu->addAction(QIcon::fromTheme("bookmark-new"), - tr("Add Bookmark..."), this, SLOT(addBookmark()), QKeySequence(tr("Ctrl+D"))); + &BookmarkManager::manageBookmarks); + bookmarkMenu->addAction(QIcon::fromTheme("bookmark-new"), tr("Add Bookmark..."), + this, &BookmarkManager::addBookmarkActivated, + QKeySequence(tr("Ctrl+D"))); bookmarkMenu->addSeparator(); @@ -386,8 +386,8 @@ void BookmarkManager::refreshBookmarkMenu() for (int i = 0; i < bookmarkModel->rowCount(root); ++i) buildBookmarksMenu(bookmarkModel->index(i, 0, root), bookmarkMenu); - connect(bookmarkMenu, SIGNAL(triggered(QAction*)), this, - SLOT(setSourceFromAction(QAction*))); + connect(bookmarkMenu, &QMenu::triggered, + this, &BookmarkManager::setSourceFromAction); } void BookmarkManager::refreshBookmarkToolBar() @@ -409,8 +409,8 @@ void BookmarkManager::refreshBookmarkToolBar() QMenu *menu = new QMenu(button); for (int j = 0; j < bookmarkModel->rowCount(index); ++j) buildBookmarksMenu(bookmarkModel->index(j, 0, index), menu); - connect(menu, SIGNAL(triggered(QAction*)), this, - SLOT(setSourceFromAction(QAction*))); + connect(menu, &QMenu::triggered, + this, &BookmarkManager::setSourceFromAction); button->setMenu(menu); button->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); button->setIcon(qvariant_cast<QIcon>(index.data(Qt::DecorationRole))); @@ -419,7 +419,7 @@ void BookmarkManager::refreshBookmarkToolBar() } else { QAction *action = m_toolBar->addAction( qvariant_cast<QIcon>(index.data(Qt::DecorationRole)), - index.data().toString(), this, SLOT(setSourceFromAction())); + index.data().toString(), this, &BookmarkManager::setSourceFromAction); action->setData(index.data(UserRoleUrl).toString()); } } @@ -440,17 +440,13 @@ void BookmarkManager::renameBookmark(const QModelIndex &index) void BookmarkManager::setSourceFromAction() { TRACE_OBJ - setSourceFromAction(qobject_cast<QAction*> (sender())); -} + const QAction *action = qobject_cast<QAction*>(sender()); + if (!action) + return; -void BookmarkManager::setSourceFromAction(QAction *action) -{ - TRACE_OBJ - if (action) { - const QVariant &data = action->data(); - if (data.canConvert<QUrl>()) - emit setSource(data.toUrl()); - } + const QVariant &data = action->data(); + if (data.canConvert<QUrl>()) + emit setSource(data.toUrl()); } void BookmarkManager::setSourceFromIndex(const QModelIndex &index, bool newTab) @@ -509,7 +505,7 @@ void BookmarkManager::customContextMenuRequested(const QPoint &point) setSourceFromIndex(index, pickedAction == showItemInNewTab); } -void BookmarkManager::focusInEvent() +void BookmarkManager::focusInEventOccurred() { TRACE_OBJ const QModelIndex &index = bookmarkTreeView->indexAt(QPoint(2, 2)); diff --git a/src/assistant/assistant/bookmarkmanager.h b/src/assistant/assistant/bookmarkmanager.h index a9637eaa7..fcdebf4d1 100644 --- a/src/assistant/assistant/bookmarkmanager.h +++ b/src/assistant/assistant/bookmarkmanager.h @@ -78,18 +78,17 @@ private: private slots: void setupFinished(); - void addBookmark(); - void removeBookmark(); + void addBookmarkActivated(); + void removeBookmarkActivated(); void manageBookmarks(); void refreshBookmarkMenu(); void refreshBookmarkToolBar(); void renameBookmark(const QModelIndex &index); void setSourceFromAction(); - void setSourceFromAction(QAction *action); - void setSourceFromIndex(const QModelIndex &index, bool newTab = false); + void setSourceFromIndex(const QModelIndex &index, bool newTab); - void focusInEvent(); + void focusInEventOccurred(); void managerWidgetAboutToClose(); void textChanged(const QString &text); void customContextMenuRequested(const QPoint &point); @@ -123,7 +122,7 @@ public: Ui::BookmarkWidget ui; signals: - void focusInEvent(); + void focusInEventOccurred(); private: void focusInEvent(QFocusEvent *event) override; diff --git a/src/assistant/assistant/bookmarkmanagerwidget.cpp b/src/assistant/assistant/bookmarkmanagerwidget.cpp index 2373b335c..9d7b9cc57 100644 --- a/src/assistant/assistant/bookmarkmanagerwidget.cpp +++ b/src/assistant/assistant/bookmarkmanagerwidget.cpp @@ -58,27 +58,36 @@ BookmarkManagerWidget::BookmarkManagerWidget(BookmarkModel *sourceModel, ui.treeView->viewport()->installEventFilter(this); ui.treeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui.treeView, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(customContextMenuRequested(QPoint))); - - connect(ui.remove, SIGNAL(clicked()), this, SLOT(removeItem())); - connect(ui.lineEdit, SIGNAL(textChanged(QString)), this, - SLOT(textChanged(QString))); - new QShortcut(QKeySequence::Find, ui.lineEdit, SLOT(setFocus())); - - importExportMenu.addAction(tr("Import..."), this, SLOT(importBookmarks())); - importExportMenu.addAction(tr("Export..."), this, SLOT(exportBookmarks())); + connect(ui.treeView, &QWidget::customContextMenuRequested, + this, &BookmarkManagerWidget::customContextMenuRequested); + + connect(ui.remove, &QAbstractButton::clicked, + [this]() { removeItem(); }); + connect(ui.lineEdit, &QLineEdit::textChanged, + this, &BookmarkManagerWidget::textChanged); + QShortcut *shortcut = new QShortcut(QKeySequence::Find, ui.lineEdit); + connect(shortcut, &QShortcut::activated, + ui.lineEdit, QOverload<>::of(&QWidget::setFocus)); + + importExportMenu.addAction(tr("Import..."), this, + &BookmarkManagerWidget::importBookmarks); + importExportMenu.addAction(tr("Export..."), this, + &BookmarkManagerWidget::exportBookmarks); ui.importExport->setMenu(&importExportMenu); - new QShortcut(QKeySequence::FindNext, this, SLOT(findNext())); - new QShortcut(QKeySequence::FindPrevious, this, SLOT(findPrevious())); - - connect(bookmarkModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, - SLOT(refeshBookmarkCache())); - connect(bookmarkModel, SIGNAL(rowsInserted(QModelIndex,int,int)), this, - SLOT(refeshBookmarkCache())); - connect(bookmarkModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, - SLOT(refeshBookmarkCache())); + shortcut = new QShortcut(QKeySequence::FindNext, this); + connect(shortcut, &QShortcut::activated, + this, &BookmarkManagerWidget::findNext); + shortcut = new QShortcut(QKeySequence::FindPrevious, this); + connect(shortcut, &QShortcut::activated, + this, &BookmarkManagerWidget::findPrevious); + + connect(bookmarkModel, &QAbstractItemModel::rowsRemoved, + this, &BookmarkManagerWidget::refeshBookmarkCache); + connect(bookmarkModel, &QAbstractItemModel::rowsInserted, + this, &BookmarkManagerWidget::refeshBookmarkCache); + connect(bookmarkModel, &QAbstractItemModel::dataChanged, + this, &BookmarkManagerWidget::refeshBookmarkCache); ui.treeView->setCurrentIndex(ui.treeView->indexAt(QPoint(2, 2))); } diff --git a/src/assistant/assistant/centralwidget.cpp b/src/assistant/assistant/centralwidget.cpp index fa4df3b92..fd4778db1 100644 --- a/src/assistant/assistant/centralwidget.cpp +++ b/src/assistant/assistant/centralwidget.cpp @@ -71,10 +71,12 @@ TabBar::TabBar(QWidget *parent) setContextMenuPolicy(Qt::CustomContextMenu); setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred, QSizePolicy::TabWidget)); - connect(this, SIGNAL(currentChanged(int)), this, SLOT(slotCurrentChanged(int))); - connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(slotTabCloseRequested(int))); - connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(slotCustomContextMenuRequested(QPoint))); + connect(this, &QTabBar::currentChanged, + this, &TabBar::slotCurrentChanged); + connect(this, &QTabBar::tabCloseRequested, + this, &TabBar::slotTabCloseRequested); + connect(this, &QWidget::customContextMenuRequested, + this, &TabBar::slotCustomContextMenuRequested); } TabBar::~TabBar() @@ -146,7 +148,8 @@ void TabBar::slotCustomContextMenuRequested(const QPoint &pos) return; QMenu menu(QString(), this); - menu.addAction(tr("New &Tab"), OpenPagesManager::instance(), SLOT(createPage())); + menu.addAction(tr("New &Tab"), OpenPagesManager::instance(), + &OpenPagesManager::createBlankPage); const bool enableAction = count() > 1; QAction *closePage = menu.addAction(tr("&Close Tab")); @@ -198,13 +201,11 @@ CentralWidget::CentralWidget(QWidget *parent) vboxLayout->addWidget(m_findWidget); m_findWidget->hide(); - connect(m_findWidget, SIGNAL(findNext()), this, SLOT(findNext())); - connect(m_findWidget, SIGNAL(findPrevious()), this, SLOT(findPrevious())); - connect(m_findWidget, SIGNAL(find(QString,bool,bool)), this, - SLOT(find(QString,bool,bool))); - connect(m_findWidget, SIGNAL(escapePressed()), this, SLOT(activateTab())); - connect(m_tabBar, SIGNAL(addBookmark(QString,QString)), this, - SIGNAL(addBookmark(QString,QString))); + connect(m_findWidget, &FindWidget::findNext, this, &CentralWidget::findNext); + connect(m_findWidget, &FindWidget::findPrevious, this, &CentralWidget::findPrevious); + connect(m_findWidget, &FindWidget::find, this, &CentralWidget::find); + connect(m_findWidget, &FindWidget::escapePressed, this, &CentralWidget::activateTab); + connect(m_tabBar, &TabBar::addBookmark, this, &CentralWidget::addBookmark); } CentralWidget::~CentralWidget() @@ -288,11 +289,11 @@ void CentralWidget::addPage(HelpViewer *page, bool fromSearch) const int index = m_stackedWidget->addWidget(page); m_tabBar->setTabData(m_tabBar->addNewTab(page->title()), QVariant::fromValue(viewerAt(index))); - connect (page, SIGNAL(titleChanged()), m_tabBar, SLOT(titleChanged())); + connect(page, &HelpViewer::titleChanged, m_tabBar, &TabBar::titleChanged); if (fromSearch) { - connect(currentHelpViewer(), SIGNAL(loadFinished(bool)), this, - SLOT(highlightSearchTerms())); + connect(currentHelpViewer(), &HelpViewer::loadFinished, + this, &CentralWidget::highlightSearchTerms); } } @@ -323,8 +324,8 @@ void CentralWidget::setCurrentPage(HelpViewer *page) void CentralWidget::connectTabBar() { TRACE_OBJ - connect(m_tabBar, SIGNAL(currentTabChanged(HelpViewer*)), - OpenPagesManager::instance(), SLOT(setCurrentPage(HelpViewer*))); + connect(m_tabBar, &TabBar::currentTabChanged, OpenPagesManager::instance(), + QOverload<HelpViewer *>::of(&OpenPagesManager::setCurrentPage)); } // -- public slots @@ -420,8 +421,8 @@ void CentralWidget::printPreview() #if !defined(QT_NO_PRINTER) && !defined(QT_NO_PRINTDIALOG) initPrinter(); QPrintPreviewDialog preview(m_printer, this); - connect(&preview, SIGNAL(paintRequested(QPrinter*)), - SLOT(printPreview(QPrinter*))); + connect(&preview, &QPrintPreviewDialog::paintRequested, + this, &CentralWidget::printPreviewToPrinter); preview.exec(); #endif } @@ -437,8 +438,8 @@ void CentralWidget::setSource(const QUrl &url) void CentralWidget::setSourceFromSearch(const QUrl &url) { TRACE_OBJ - connect(currentHelpViewer(), SIGNAL(loadFinished(bool)), this, - SLOT(highlightSearchTerms())); + connect(currentHelpViewer(), &HelpViewer::loadFinished, + this, &CentralWidget::highlightSearchTerms); currentHelpViewer()->setSource(url); currentHelpViewer()->setFocus(Qt::OtherFocusReason); } @@ -526,10 +527,11 @@ void CentralWidget::focusInEvent(QFocusEvent * /* event */) // otherwise it's the central widget. This is needed, so an embedding // program can just set the focus to the central widget and it does // The Right Thing(TM) - QObject *receiver = m_stackedWidget; + QWidget *receiver = m_stackedWidget; if (HelpViewer *viewer = currentHelpViewer()) receiver = viewer; - QTimer::singleShot(1, receiver, SLOT(setFocus())); + QTimer::singleShot(1, receiver, + QOverload<>::of(&QWidget::setFocus)); } // -- private slots @@ -544,11 +546,11 @@ void CentralWidget::highlightSearchTerms() HelpViewer *viewer = currentHelpViewer(); for (const QString &word : words) viewer->findText(word, 0, false, true); - disconnect(viewer, SIGNAL(loadFinished(bool)), this, - SLOT(highlightSearchTerms())); + disconnect(viewer, &HelpViewer::loadFinished, + this, &CentralWidget::highlightSearchTerms); } -void CentralWidget::printPreview(QPrinter *p) +void CentralWidget::printPreviewToPrinter(QPrinter *p) { TRACE_OBJ #ifndef QT_NO_PRINTER @@ -589,17 +591,19 @@ void CentralWidget::connectSignals(HelpViewer *page) { TRACE_OBJ #if defined(BROWSER_QTWEBKIT) - connect(page, SIGNAL(printRequested()), this, SLOT(print())); + connect(page, &HelpViewer::printRequested, + this, &CentralWidget::print); #endif - connect(page, SIGNAL(copyAvailable(bool)), this, - SIGNAL(copyAvailable(bool))); - connect(page, SIGNAL(forwardAvailable(bool)), this, - SIGNAL(forwardAvailable(bool))); - connect(page, SIGNAL(backwardAvailable(bool)), this, - SIGNAL(backwardAvailable(bool))); - connect(page, SIGNAL(sourceChanged(QUrl)), this, - SLOT(handleSourceChanged(QUrl))); - connect(page, SIGNAL(highlighted(QString)), this, SLOT(slotHighlighted(QString))); + connect(page, &QTextEdit::copyAvailable, + this, &CentralWidget::copyAvailable); + connect(page, &QTextBrowser::forwardAvailable, + this, &CentralWidget::forwardAvailable); + connect(page, &QTextBrowser::backwardAvailable, + this, &CentralWidget::backwardAvailable); + connect(page, &QTextBrowser::sourceChanged, + this, &CentralWidget::handleSourceChanged); + connect(page, QOverload<const QString &>::of(&QTextBrowser::highlighted), + this, &CentralWidget::slotHighlighted); } bool CentralWidget::eventFilter(QObject *object, QEvent *e) diff --git a/src/assistant/assistant/centralwidget.h b/src/assistant/assistant/centralwidget.h index f61eb800a..614949478 100644 --- a/src/assistant/assistant/centralwidget.h +++ b/src/assistant/assistant/centralwidget.h @@ -140,7 +140,7 @@ protected: private slots: void highlightSearchTerms(); - void printPreview(QPrinter *printer); + void printPreviewToPrinter(QPrinter *printer); void handleSourceChanged(const QUrl &url); void slotHighlighted(const QString &link); diff --git a/src/assistant/assistant/contentwindow.cpp b/src/assistant/assistant/contentwindow.cpp index 0b012ce0f..57bd51261 100644 --- a/src/assistant/assistant/contentwindow.cpp +++ b/src/assistant/assistant/contentwindow.cpp @@ -54,14 +54,15 @@ ContentWindow::ContentWindow() layout->setMargin(4); layout->addWidget(m_contentWidget); - connect(m_contentWidget, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(showContextMenu(QPoint))); - connect(m_contentWidget, SIGNAL(linkActivated(QUrl)), this, - SIGNAL(linkActivated(QUrl))); + connect(m_contentWidget, &QWidget::customContextMenuRequested, + this, &ContentWindow::showContextMenu); + connect(m_contentWidget, &QHelpContentWidget::linkActivated, + this, &ContentWindow::linkActivated); QHelpContentModel *contentModel = qobject_cast<QHelpContentModel*>(m_contentWidget->model()); - connect(contentModel, SIGNAL(contentsCreated()), this, SLOT(expandTOC())); + connect(contentModel, &QHelpContentModel::contentsCreated, + this, &ContentWindow::expandTOC); } ContentWindow::~ContentWindow() diff --git a/src/assistant/assistant/filternamedialog.cpp b/src/assistant/assistant/filternamedialog.cpp index ab6ba4828..33b19cff8 100644 --- a/src/assistant/assistant/filternamedialog.cpp +++ b/src/assistant/assistant/filternamedialog.cpp @@ -38,14 +38,13 @@ FilterNameDialog::FilterNameDialog(QWidget *parent) { TRACE_OBJ m_ui.setupUi(this); - connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), - SIGNAL(clicked()), this, SLOT(accept())); - connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), - SIGNAL(clicked()), this, SLOT(reject())); - connect(m_ui.lineEdit, SIGNAL(textChanged(QString)), - this, SLOT(updateOkButton())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, + this, &QDialog::accept); + connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked, + this, &QDialog::reject); + connect(m_ui.lineEdit, &QLineEdit::textChanged, + this, &FilterNameDialog::updateOkButton); m_ui.buttonBox->button(QDialogButtonBox::Ok)->setDisabled(true); - } QString FilterNameDialog::filterName() const diff --git a/src/assistant/assistant/findwidget.cpp b/src/assistant/assistant/findwidget.cpp index 4c66ab639..b9607b703 100644 --- a/src/assistant/assistant/findwidget.cpp +++ b/src/assistant/assistant/findwidget.cpp @@ -59,26 +59,25 @@ FindWidget::FindWidget(QWidget *parent) toolClose = setupToolButton(QString(), resourcePath + QLatin1String("/closetab.png")); hboxLayout->addWidget(toolClose); - connect(toolClose, SIGNAL(clicked()), SLOT(hide())); + connect(toolClose, &QAbstractButton::clicked, this, &QWidget::hide); editFind = new QLineEdit(this); hboxLayout->addWidget(editFind); editFind->setMinimumSize(QSize(150, 0)); - connect(editFind, SIGNAL(textChanged(QString)), this, - SLOT(textChanged(QString))); - connect(editFind, SIGNAL(returnPressed()), this, SIGNAL(findNext())); - connect(editFind, SIGNAL(textChanged(QString)), this, SLOT(updateButtons())); + connect(editFind, &QLineEdit::textChanged, this, &FindWidget::textChanged); + connect(editFind, &QLineEdit::returnPressed, this, &FindWidget::findNext); + connect(editFind, &QLineEdit::textChanged, this, &FindWidget::updateButtons); toolPrevious = setupToolButton(tr("Previous"), resourcePath + QLatin1String("/previous.png")); - connect(toolPrevious, SIGNAL(clicked()), this, SIGNAL(findPrevious())); + connect(toolPrevious, &QAbstractButton::clicked, this, &FindWidget::findPrevious); hboxLayout->addWidget(toolPrevious); toolNext = setupToolButton(tr("Next"), resourcePath + QLatin1String("/next.png")); hboxLayout->addWidget(toolNext); - connect(toolNext, SIGNAL(clicked()), this, SIGNAL(findNext())); + connect(toolNext, &QAbstractButton::clicked, this, &FindWidget::findNext); checkCase = new QCheckBox(tr("Case Sensitive"), this); hboxLayout->addWidget(checkCase); diff --git a/src/assistant/assistant/globalactions.cpp b/src/assistant/assistant/globalactions.cpp index b1b1f179c..945f025a3 100644 --- a/src/assistant/assistant/globalactions.cpp +++ b/src/assistant/assistant/globalactions.cpp @@ -64,7 +64,7 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent) m_backAction->setEnabled(false); m_backAction->setShortcuts(QKeySequence::Back); m_backAction->setIcon(QIcon(resourcePath + QLatin1String("/previous.png"))); - connect(m_backAction, SIGNAL(triggered()), centralWidget, SLOT(backward())); + connect(m_backAction, &QAction::triggered, centralWidget, &CentralWidget::backward); m_actionList << m_backAction; m_nextAction = new QAction(tr("&Forward"), parent); @@ -72,7 +72,7 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent) m_nextAction->setEnabled(false); m_nextAction->setShortcuts(QKeySequence::Forward); m_nextAction->setIcon(QIcon(resourcePath + QLatin1String("/next.png"))); - connect(m_nextAction, SIGNAL(triggered()), centralWidget, SLOT(forward())); + connect(m_nextAction, &QAction::triggered, centralWidget, &CentralWidget::forward); m_actionList << m_nextAction; setupNavigationMenus(m_backAction, m_nextAction, centralWidget); @@ -80,7 +80,7 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent) m_homeAction = new QAction(tr("&Home"), parent); m_homeAction->setShortcut(tr("ALT+Home")); m_homeAction->setIcon(QIcon(resourcePath + QLatin1String("/home.png"))); - connect(m_homeAction, SIGNAL(triggered()), centralWidget, SLOT(home())); + connect(m_homeAction, &QAction::triggered, centralWidget, &CentralWidget::home); m_actionList << m_homeAction; QAction *separator = new QAction(parent); @@ -91,14 +91,14 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent) m_zoomInAction->setPriority(QAction::LowPriority); m_zoomInAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomin.png"))); m_zoomInAction->setShortcut(QKeySequence::ZoomIn); - connect(m_zoomInAction, SIGNAL(triggered()), centralWidget, SLOT(zoomIn())); + connect(m_zoomInAction, &QAction::triggered, centralWidget, &CentralWidget::zoomIn); m_actionList << m_zoomInAction; m_zoomOutAction = new QAction(tr("Zoom &out"), parent); m_zoomOutAction->setPriority(QAction::LowPriority); m_zoomOutAction->setIcon(QIcon(resourcePath + QLatin1String("/zoomout.png"))); m_zoomOutAction->setShortcut(QKeySequence::ZoomOut); - connect(m_zoomOutAction, SIGNAL(triggered()), centralWidget, SLOT(zoomOut())); + connect(m_zoomOutAction, &QAction::triggered, centralWidget, &CentralWidget::zoomOut); m_actionList << m_zoomOutAction; separator = new QAction(parent); @@ -111,21 +111,21 @@ GlobalActions::GlobalActions(QObject *parent) : QObject(parent) m_copyAction->setIcon(QIcon(resourcePath + QLatin1String("/editcopy.png"))); m_copyAction->setShortcuts(QKeySequence::Copy); m_copyAction->setEnabled(false); - connect(m_copyAction, SIGNAL(triggered()), centralWidget, SLOT(copy())); + connect(m_copyAction, &QAction::triggered, centralWidget, &CentralWidget::copy); m_actionList << m_copyAction; m_printAction = new QAction(tr("&Print..."), parent); m_printAction->setPriority(QAction::LowPriority); m_printAction->setIcon(QIcon(resourcePath + QLatin1String("/print.png"))); m_printAction->setShortcut(QKeySequence::Print); - connect(m_printAction, SIGNAL(triggered()), centralWidget, SLOT(print())); + connect(m_printAction, &QAction::triggered, centralWidget, &CentralWidget::print); m_actionList << m_printAction; m_findAction = new QAction(tr("&Find in Text..."), parent); m_findAction->setIconText(tr("&Find")); m_findAction->setIcon(QIcon(resourcePath + QLatin1String("/find.png"))); m_findAction->setShortcuts(QKeySequence::Find); - connect(m_findAction, SIGNAL(triggered()), centralWidget, SLOT(showTextSearch())); + connect(m_findAction, &QAction::triggered, centralWidget, &CentralWidget::showTextSearch); m_actionList << m_findAction; #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) @@ -211,17 +211,17 @@ void GlobalActions::setupNavigationMenus(QAction *back, QAction *next, { #if defined(BROWSER_QTWEBKIT) m_backMenu = new QMenu(parent); - connect(m_backMenu, SIGNAL(aboutToShow()), this, - SLOT(slotAboutToShowBackMenu())); - connect(m_backMenu, SIGNAL(triggered(QAction*)), this, - SLOT(slotOpenActionUrl(QAction*))); + connect(m_backMenu, &QMenu::aboutToShow, + this, &GlobalActions::slotAboutToShowBackMenu); + connect(m_backMenu, &QMenu::triggered, + this, &GlobalActions::slotOpenActionUrl); back->setMenu(m_backMenu); m_nextMenu = new QMenu(parent); - connect(m_nextMenu, SIGNAL(aboutToShow()), this, - SLOT(slotAboutToShowNextMenu())); - connect(m_nextMenu, SIGNAL(triggered(QAction*)), this, - SLOT(slotOpenActionUrl(QAction*))); + connect(m_nextMenu, &QMenu::aboutToShow, + this, &GlobalActions::slotAboutToShowNextMenu); + connect(m_nextMenu, &QMenu::triggered, + this, &GlobalActions::slotOpenActionUrl); next->setMenu(m_nextMenu); #else Q_UNUSED(back) diff --git a/src/assistant/assistant/helpenginewrapper.cpp b/src/assistant/assistant/helpenginewrapper.cpp index 68427562a..a6e8936f2 100644 --- a/src/assistant/assistant/helpenginewrapper.cpp +++ b/src/assistant/assistant/helpenginewrapper.cpp @@ -146,17 +146,17 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile) * This call is reverted by initialDocSetupDone(), which must be * called after the new docs have been installed. */ - disconnect(d->m_helpEngine, SIGNAL(setupFinished()), - searchEngine(), SLOT(scheduleIndexDocumentation())); + disconnect(d->m_helpEngine, &QHelpEngineCore::setupFinished, + searchEngine(), &QHelpSearchEngine::scheduleIndexDocumentation); - connect(d, SIGNAL(documentationRemoved(QString)), - this, SIGNAL(documentationRemoved(QString))); - connect(d, SIGNAL(documentationUpdated(QString)), - this, SIGNAL(documentationUpdated(QString))); - connect(d->m_helpEngine, SIGNAL(currentFilterChanged(QString)), - this, SLOT(handleCurrentFilterChanged(QString))); - connect(d->m_helpEngine, SIGNAL(setupFinished()), - this, SIGNAL(setupFinished())); + connect(d, &HelpEngineWrapperPrivate::documentationRemoved, + this, &HelpEngineWrapper::documentationRemoved); + connect(d, &HelpEngineWrapperPrivate::documentationUpdated, + this, &HelpEngineWrapper::documentationUpdated); + connect(d->m_helpEngine, &QHelpEngineCore::currentFilterChanged, + this, &HelpEngineWrapper::handleCurrentFilterChanged); + connect(d->m_helpEngine, &QHelpEngineCore::setupFinished, + this, &HelpEngineWrapper::setupFinished); } HelpEngineWrapper::~HelpEngineWrapper() @@ -175,8 +175,8 @@ HelpEngineWrapper::~HelpEngineWrapper() void HelpEngineWrapper::initialDocSetupDone() { TRACE_OBJ - connect(d->m_helpEngine, SIGNAL(setupFinished()), - searchEngine(), SLOT(scheduleIndexDocumentation())); + connect(d->m_helpEngine, &QHelpEngineCore::setupFinished, + searchEngine(), &QHelpSearchEngine::scheduleIndexDocumentation); setupData(); } @@ -762,8 +762,8 @@ void HelpEngineWrapperPrivate::initFileSystemWatchers() for (const QString &ns : m_helpEngine->registeredDocumentations()) { const QString &docFile = m_helpEngine->documentationFileName(ns); m_qchWatcher->addPath(docFile); - connect(m_qchWatcher, SIGNAL(fileChanged(QString)), - this, SLOT(qchFileChanged(QString))); + connect(m_qchWatcher, &QFileSystemWatcher::fileChanged, this, + QOverload<const QString &>::of(&HelpEngineWrapperPrivate::qchFileChanged)); } checkDocFilesWatched(); } @@ -824,7 +824,8 @@ void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName, if (it == m_recentQchUpdates.end()) { QSharedPointer<TimeoutForwarder> forwarder(new TimeoutForwarder(fileName)); m_recentQchUpdates.insert(fileName, RecentSignal(now, forwarder)); - QTimer::singleShot(UpdateGracePeriod, forwarder.data(), SLOT(forward())); + QTimer::singleShot(UpdateGracePeriod, forwarder.data(), + &TimeoutForwarder::forward); return; } @@ -834,7 +835,7 @@ void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName, it.value().first = now; else QTimer::singleShot(UpdateGracePeriod, it.value().second.data(), - SLOT(forward())); + &TimeoutForwarder::forward); return; } diff --git a/src/assistant/assistant/helpviewer_p.h b/src/assistant/assistant/helpviewer_p.h index 1364ea6a3..23aab69e2 100644 --- a/src/assistant/assistant/helpviewer_p.h +++ b/src/assistant/assistant/helpviewer_p.h @@ -86,26 +86,15 @@ public: return true; } - void openLink(bool newPage) - { - if(lastAnchor.isEmpty()) - return; - if (newPage) - OpenPagesManager::instance()->createPage(lastAnchor); - else - CentralWidget::instance()->setSource(lastAnchor); - lastAnchor.clear(); - } - public slots: void openLink() { - openLink(false); + doOpenLink(false); } void openLinkInNewPage() { - openLink(true); + doOpenLink(true); } public: @@ -118,6 +107,20 @@ public: public: bool m_loadFinished; + +private: + + void doOpenLink(bool newPage) + { + if (lastAnchor.isEmpty()) + return; + if (newPage) + OpenPagesManager::instance()->createPage(lastAnchor); + else + CentralWidget::instance()->setSource(lastAnchor); + lastAnchor.clear(); + } + }; QT_END_NAMESPACE diff --git a/src/assistant/assistant/helpviewer_qtb.cpp b/src/assistant/assistant/helpviewer_qtb.cpp index 40d59997e..0ed234542 100644 --- a/src/assistant/assistant/helpviewer_qtb.cpp +++ b/src/assistant/assistant/helpviewer_qtb.cpp @@ -64,8 +64,8 @@ HelpViewer::HelpViewer(qreal zoom, QWidget *parent) font.setPointSize(int(font.pointSize() + zoom)); setViewerFont(font); - connect(this, SIGNAL(sourceChanged(QUrl)), this, SIGNAL(titleChanged())); - connect(this, SIGNAL(loadFinished(bool)), this, SLOT(setLoadFinished(bool))); + connect(this, &QTextBrowser::sourceChanged, this, &HelpViewer::titleChanged); + connect(this, &HelpViewer::loadFinished, this, &HelpViewer::setLoadFinished); } QFont HelpViewer::viewerFont() const @@ -341,17 +341,17 @@ void HelpViewer::contextMenuEvent(QContextMenuEvent *event) link = anchorAt(event->pos()); if (link.isRelative()) link = source().resolved(link); - menu.addAction(tr("Open Link"), d, SLOT(openLink())); - menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), d, SLOT(openLinkInNewPage())); + menu.addAction(tr("Open Link"), d, &HelpViewerPrivate::openLink); + menu.addAction(tr("Open Link in New Tab\tCtrl+LMB"), d, &HelpViewerPrivate::openLinkInNewPage); if (!link.isEmpty() && link.isValid()) copyAnchorAction = menu.addAction(tr("Copy &Link Location")); } else if (!selectedText().isEmpty()) { #ifndef QT_NO_CLIPBOARD - menu.addAction(tr("Copy"), this, SLOT(copy())); + menu.addAction(tr("Copy"), this, &HelpViewer::copy); #endif } else { - menu.addAction(tr("Reload"), this, SLOT(reload())); + menu.addAction(tr("Reload"), this, &HelpViewer::reload); } #ifndef QT_NO_CLIPBOARD diff --git a/src/assistant/assistant/helpviewer_qwv.cpp b/src/assistant/assistant/helpviewer_qwv.cpp index 7d0cdc367..e237d1f53 100644 --- a/src/assistant/assistant/helpviewer_qwv.cpp +++ b/src/assistant/assistant/helpviewer_qwv.cpp @@ -82,8 +82,8 @@ HelpPage::HelpPage(QObject *parent) QWebPage *HelpPage::createWindow(QWebPage::WebWindowType) { TRACE_OBJ - HelpPage* newPage = static_cast<HelpPage*>(OpenPagesManager::instance() - ->createPage()->page()); + HelpPage *newPage = static_cast<HelpPage *>(OpenPagesManager::instance() + ->createBlankPage()->page()); newPage->closeNewTabIfNeeded = closeNewTabIfNeeded; closeNewTabIfNeeded = false; return newPage; diff --git a/src/assistant/assistant/indexwindow.cpp b/src/assistant/assistant/indexwindow.cpp index 4a23cd75f..b735c130b 100644 --- a/src/assistant/assistant/indexwindow.cpp +++ b/src/assistant/assistant/indexwindow.cpp @@ -58,24 +58,24 @@ IndexWindow::IndexWindow(QWidget *parent) layout->addWidget(l); l->setBuddy(m_searchLineEdit); - connect(m_searchLineEdit, SIGNAL(textChanged(QString)), this, - SLOT(filterIndices(QString))); + connect(m_searchLineEdit, &QLineEdit::textChanged, + this, &IndexWindow::filterIndices); m_searchLineEdit->installEventFilter(this); layout->setMargin(4); layout->addWidget(m_searchLineEdit); HelpEngineWrapper &helpEngine = HelpEngineWrapper::instance(); m_indexWidget->installEventFilter(this); - connect(helpEngine.indexModel(), SIGNAL(indexCreationStarted()), this, - SLOT(disableSearchLineEdit())); - connect(helpEngine.indexModel(), SIGNAL(indexCreated()), this, - SLOT(enableSearchLineEdit())); - connect(m_indexWidget, SIGNAL(linkActivated(QUrl,QString)), this, - SIGNAL(linkActivated(QUrl))); - connect(m_indexWidget, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)), - this, SIGNAL(linksActivated(QMap<QString,QUrl>,QString))); - connect(m_searchLineEdit, SIGNAL(returnPressed()), m_indexWidget, - SLOT(activateCurrentItem())); + connect(helpEngine.indexModel(), &QHelpIndexModel::indexCreationStarted, + this, &IndexWindow::disableSearchLineEdit); + connect(helpEngine.indexModel(), &QHelpIndexModel::indexCreated, + this, &IndexWindow::enableSearchLineEdit); + connect(m_indexWidget, &QHelpIndexWidget::linkActivated, + this, &IndexWindow::linkActivated); + connect(m_indexWidget, &QHelpIndexWidget::linksActivated, + this, &IndexWindow::linksActivated); + connect(m_searchLineEdit, &QLineEdit::returnPressed, + m_indexWidget, &QHelpIndexWidget::activateCurrentItem); layout->addWidget(m_indexWidget); m_indexWidget->viewport()->installEventFilter(this); diff --git a/src/assistant/assistant/main.cpp b/src/assistant/assistant/main.cpp index 5cf868f8f..3011bd4c5 100644 --- a/src/assistant/assistant/main.cpp +++ b/src/assistant/assistant/main.cpp @@ -195,7 +195,10 @@ QCoreApplication* createApplication(int &argc, char *argv[]) } } #endif - return new QApplication(argc, argv); + QApplication *app = new QApplication(argc, argv); + app->connect(app, &QGuiApplication::lastWindowClosed, + &QCoreApplication::quit); + return app; } bool registerDocumentation(QHelpEngineCore &collection, CmdLineParser &cmd, @@ -382,7 +385,6 @@ int main(int argc, char *argv[]) MainWindow *w = new MainWindow(&cmd); w->show(); - a->connect(a.data(), SIGNAL(lastWindowClosed()), a.data(), SLOT(quit())); /* * We need to be careful here: The main window has to be deleted before diff --git a/src/assistant/assistant/mainwindow.cpp b/src/assistant/assistant/mainwindow.cpp index 3d760ff2b..46f68bcd0 100644 --- a/src/assistant/assistant/mainwindow.cpp +++ b/src/assistant/assistant/mainwindow.cpp @@ -156,18 +156,20 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) openPagesDock->setWidget(openPagesManager->openPagesWidget()); addDockWidget(Qt::LeftDockWidgetArea, openPagesDock); - connect(m_centralWidget, SIGNAL(addBookmark(QString,QString)), - bookMarkManager, SLOT(addBookmark(QString,QString))); - connect(bookMarkManager, SIGNAL(escapePressed()), this, - SLOT(activateCurrentCentralWidgetTab())); - connect(bookMarkManager, SIGNAL(setSource(QUrl)), m_centralWidget, - SLOT(setSource(QUrl))); - connect(bookMarkManager, SIGNAL(setSourceInNewTab(QUrl)), - openPagesManager, SLOT(createPage(QUrl))); + connect(m_centralWidget, &CentralWidget::addBookmark, + bookMarkManager, &BookmarkManager::addBookmark); + connect(bookMarkManager, &BookmarkManager::escapePressed, + this, &MainWindow::activateCurrentCentralWidgetTab); + connect(bookMarkManager, &BookmarkManager::setSource, + m_centralWidget, &CentralWidget::setSource); + connect(bookMarkManager, &BookmarkManager::setSourceInNewTab, + [openPagesManager](const QUrl &url){ openPagesManager->createPage(url); }); QHelpSearchEngine *searchEngine = helpEngineWrapper.searchEngine(); - connect(searchEngine, SIGNAL(indexingStarted()), this, SLOT(indexingStarted())); - connect(searchEngine, SIGNAL(indexingFinished()), this, SLOT(indexingFinished())); + connect(searchEngine, &QHelpSearchEngine::indexingStarted, + this, &MainWindow::indexingStarted); + connect(searchEngine, &QHelpSearchEngine::indexingFinished, + this, &MainWindow::indexingFinished); QString defWindowTitle = tr("Qt Assistant"); setWindowTitle(defWindowTitle); @@ -239,7 +241,7 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) updateAboutMenuText(); - QTimer::singleShot(0, this, SLOT(insertLastPages())); + QTimer::singleShot(0, this, &MainWindow::insertLastPages); if (m_cmdLine->enableRemoteControl()) (void)new RemoteControl(this); @@ -277,14 +279,14 @@ MainWindow::MainWindow(CmdLineParser *cmdLine, QWidget *parent) } if (usesDefaultCollection()) - QTimer::singleShot(0, this, SLOT(lookForNewQtDocumentation())); + QTimer::singleShot(0, this, &MainWindow::lookForNewQtDocumentation); else checkInitState(); - connect(&helpEngineWrapper, SIGNAL(documentationRemoved(QString)), - this, SLOT(documentationRemoved(QString))); - connect(&helpEngineWrapper, SIGNAL(documentationUpdated(QString)), - this, SLOT(documentationUpdated(QString))); + connect(&helpEngineWrapper, &HelpEngineWrapper::documentationRemoved, + this, &MainWindow::documentationRemoved); + connect(&helpEngineWrapper, &HelpEngineWrapper::documentationUpdated, + this, &MainWindow::documentationUpdated); setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North); GlobalActions::instance()->updateActions(); @@ -456,12 +458,12 @@ void MainWindow::lookForNewQtDocumentation() } m_qtDocInstaller = new QtDocInstaller(qtDocInfos); - connect(m_qtDocInstaller, SIGNAL(docsInstalled(bool)), this, - SLOT(qtDocumentationInstalled())); - connect(m_qtDocInstaller, SIGNAL(qchFileNotFound(QString)), this, - SLOT(resetQtDocInfo(QString))); - connect(m_qtDocInstaller, SIGNAL(registerDocumentation(QString,QString)), - this, SLOT(registerDocumentation(QString,QString))); + connect(m_qtDocInstaller, &QtDocInstaller::docsInstalled, + this, &MainWindow::qtDocumentationInstalled); + connect(m_qtDocInstaller, &QtDocInstaller::qchFileNotFound, + this, &MainWindow::resetQtDocInfo); + connect(m_qtDocInstaller, &QtDocInstaller::registerDocumentation, + this, &MainWindow::registerDocumentation); if (helpEngine.qtDocInfo(QLatin1String("qt")).count() != 2) statusBar()->showMessage(tr("Looking for Qt Documentation...")); m_qtDocInstaller->installDocs(); @@ -486,10 +488,10 @@ void MainWindow::checkInitState() if (helpEngine.contentModel()->isCreatingContents() || helpEngine.indexModel()->isCreatingIndex()) { if (!m_connectedInitSignals) { - connect(helpEngine.contentModel(), SIGNAL(contentsCreated()), - this, SLOT(checkInitState())); - connect(helpEngine.indexModel(), SIGNAL(indexCreated()), this, - SLOT(checkInitState())); + connect(helpEngine.contentModel(), &QHelpContentModel::contentsCreated, + this, &MainWindow::checkInitState); + connect(helpEngine.indexModel(), &QHelpIndexModel::indexCreated, + this, &MainWindow::checkInitState); m_connectedInitSignals = true; } } else { @@ -521,22 +523,25 @@ void MainWindow::setupActions() #endif QMenu *menu = menuBar()->addMenu(tr("&File")); - OpenPagesManager * const openPages = OpenPagesManager::instance(); - m_newTabAction = menu->addAction(tr("New &Tab"), openPages, SLOT(createPage())); + OpenPagesManager *const openPages = OpenPagesManager::instance(); + m_newTabAction = menu->addAction(tr("New &Tab"), + openPages, &OpenPagesManager::createBlankPage); m_newTabAction->setShortcut(QKeySequence::AddTab); m_closeTabAction = menu->addAction(tr("&Close Tab"), - openPages, SLOT(closeCurrentPage())); + openPages, &OpenPagesManager::closeCurrentPage); m_closeTabAction->setShortcuts(QKeySequence::Close); m_closeTabAction->setEnabled(openPages->pageCount() > 1); - connect(openPages, SIGNAL(pageClosed()), this, SLOT(handlePageCountChanged())); - connect(openPages, SIGNAL(pageAdded(int)), this, SLOT(handlePageCountChanged())); + connect(openPages, &OpenPagesManager::pageClosed, + this, &MainWindow::handlePageCountChanged); + connect(openPages, &OpenPagesManager::pageAdded, + this, &MainWindow::handlePageCountChanged); menu->addSeparator(); - m_pageSetupAction = menu->addAction(tr("Page Set&up..."), m_centralWidget, - SLOT(pageSetup())); - m_printPreviewAction = menu->addAction(tr("Print Preview..."), m_centralWidget, - SLOT(printPreview())); + m_pageSetupAction = menu->addAction(tr("Page Set&up..."), + m_centralWidget, &CentralWidget::pageSetup); + m_printPreviewAction = menu->addAction(tr("Print Preview..."), + m_centralWidget, &CentralWidget::printPreview); GlobalActions *globalActions = GlobalActions::instance(this); menu->addAction(globalActions->printAction()); @@ -545,10 +550,12 @@ void MainWindow::setupActions() QIcon appExitIcon = QIcon::fromTheme("application-exit"); QAction *tmp; #ifdef Q_OS_WIN - tmp = menu->addAction(appExitIcon, tr("E&xit"), this, SLOT(close())); + tmp = menu->addAction(appExitIcon, tr("E&xit"), + this, &QWidget::close); tmp->setShortcut(QKeySequence(tr("CTRL+Q"))); #else - tmp = menu->addAction(appExitIcon, tr("&Quit"), this, SLOT(close())); + tmp = menu->addAction(appExitIcon, tr("&Quit"), + this, &QWidget::close); tmp->setShortcut(QKeySequence::Quit); #endif tmp->setMenuRole(QAction::QuitRole); @@ -557,77 +564,83 @@ void MainWindow::setupActions() menu->addAction(globalActions->copyAction()); menu->addAction(globalActions->findAction()); - QAction *findNextAction = menu->addAction(tr("Find &Next"), m_centralWidget, - SLOT(findNext())); + QAction *findNextAction = menu->addAction(tr("Find &Next"), + m_centralWidget, &CentralWidget::findNext); findNextAction->setShortcuts(QKeySequence::FindNext); QAction *findPreviousAction = menu->addAction(tr("Find &Previous"), - m_centralWidget, SLOT(findPrevious())); + m_centralWidget, &CentralWidget::findPrevious); findPreviousAction->setShortcuts(QKeySequence::FindPrevious); menu->addSeparator(); - tmp = menu->addAction(tr("Preferences..."), this, SLOT(showPreferences())); + tmp = menu->addAction(tr("Preferences..."), + this, &MainWindow::showPreferences); tmp->setMenuRole(QAction::PreferencesRole); m_viewMenu = menuBar()->addMenu(tr("&View")); m_viewMenu->addAction(globalActions->zoomInAction()); m_viewMenu->addAction(globalActions->zoomOutAction()); - m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), m_centralWidget, - SLOT(resetZoom())); + m_resetZoomAction = m_viewMenu->addAction(tr("Normal &Size"), + m_centralWidget, &CentralWidget::resetZoom); m_resetZoomAction->setPriority(QAction::LowPriority); m_resetZoomAction->setIcon(QIcon(resourcePath + QLatin1String("/resetzoom.png"))); m_resetZoomAction->setShortcut(tr("Ctrl+0")); m_viewMenu->addSeparator(); - m_viewMenu->addAction(tr("Contents"), this, SLOT(showContents()), - QKeySequence(tr("ALT+C"))); - m_viewMenu->addAction(tr("Index"), this, SLOT(showIndex()), - QKeySequence(tr("ALT+I"))); - m_viewMenu->addAction(tr("Bookmarks"), this, SLOT(showBookmarksDockWidget()), - QKeySequence(tr("ALT+O"))); - m_viewMenu->addAction(tr("Search"), this, SLOT(showSearch()), - QKeySequence(tr("ALT+S"))); - m_viewMenu->addAction(tr("Open Pages"), this, SLOT(showOpenPages()), - QKeySequence(tr("ALT+P"))); + m_viewMenu->addAction(tr("Contents"), + this, &MainWindow::showContents, QKeySequence(tr("ALT+C"))); + m_viewMenu->addAction(tr("Index"), + this, &MainWindow::showIndex, QKeySequence(tr("ALT+I"))); + m_viewMenu->addAction(tr("Bookmarks"), + this, &MainWindow::showBookmarksDockWidget, QKeySequence(tr("ALT+O"))); + m_viewMenu->addAction(tr("Search"), + this, &MainWindow::showSearch, QKeySequence(tr("ALT+S"))); + m_viewMenu->addAction(tr("Open Pages"), + this, &MainWindow::showOpenPages, QKeySequence(tr("ALT+P"))); menu = menuBar()->addMenu(tr("&Go")); menu->addAction(globalActions->homeAction()); menu->addAction(globalActions->backAction()); menu->addAction(globalActions->nextAction()); - m_syncAction = menu->addAction(tr("Sync with Table of Contents"), this, - SLOT(syncContents())); + m_syncAction = menu->addAction(tr("Sync with Table of Contents"), + this, &MainWindow::syncContents); m_syncAction->setIconText(tr("Sync")); m_syncAction->setIcon(QIcon(resourcePath + QLatin1String("/synctoc.png"))); menu->addSeparator(); - tmp = menu->addAction(tr("Next Page"), openPages, SLOT(nextPage())); + tmp = menu->addAction(tr("Next Page"), + openPages, &OpenPagesManager::nextPage); tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Right")) << QKeySequence(Qt::CTRL + Qt::Key_PageDown)); - tmp = menu->addAction(tr("Previous Page"), openPages, SLOT(previousPage())); + tmp = menu->addAction(tr("Previous Page"), + openPages, &OpenPagesManager::previousPage); tmp->setShortcuts(QList<QKeySequence>() << QKeySequence(tr("Ctrl+Alt+Left")) << QKeySequence(Qt::CTRL + Qt::Key_PageUp)); + const Qt::Modifier modifier = #ifdef Q_OS_MAC - QShortcut *sct = new QShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab), this); - connect(sct, SIGNAL(activated()), openPages, SLOT(nextPageWithSwitcher())); - sct = new QShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab), this); - connect(sct, SIGNAL(activated()), openPages, SLOT(previousPageWithSwitcher())); + Qt::ALT; #else - QShortcut *sct = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab), this); - connect(sct, SIGNAL(activated()), openPages, SLOT(nextPageWithSwitcher())); - sct = new QShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab), this); - connect(sct, SIGNAL(activated()), openPages, SLOT(previousPageWithSwitcher())); + Qt::CTRL; #endif + QShortcut *sct = new QShortcut(QKeySequence(modifier + Qt::Key_Tab), this); + connect(sct, &QShortcut::activated, + openPages, &OpenPagesManager::nextPageWithSwitcher); + sct = new QShortcut(QKeySequence(modifier + Qt::SHIFT + Qt::Key_Tab), this); + connect(sct, &QShortcut::activated, + openPages, &OpenPagesManager::previousPageWithSwitcher); + BookmarkManager::instance()->setBookmarksMenu(menuBar()->addMenu(tr("&Bookmarks"))); menu = menuBar()->addMenu(tr("&Help")); - m_aboutAction = menu->addAction(tr("About..."), this, SLOT(showAboutDialog())); + m_aboutAction = menu->addAction(tr("About..."), + this, &MainWindow::showAboutDialog); m_aboutAction->setMenuRole(QAction::AboutRole); #if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) @@ -653,42 +666,43 @@ void MainWindow::setupActions() #if defined(Q_OS_MAC) QMenu *windowMenu = new QMenu(tr("&Window"), this); menuBar()->insertMenu(menu->menuAction(), windowMenu); - windowMenu->addAction(tr("Zoom"), this, SLOT(showMaximized())); - windowMenu->addAction(tr("Minimize"), this, SLOT(showMinimized()), - QKeySequence(tr("Ctrl+M"))); + windowMenu->addAction(tr("Zoom"), + this, &QWidget::showMaximized); + windowMenu->addAction(tr("Minimize"), + this, &QWidget::showMinimized, QKeySequence(tr("Ctrl+M"))); #endif // content viewer connections - connect(m_centralWidget, SIGNAL(copyAvailable(bool)), globalActions, - SLOT(setCopyAvailable(bool))); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), globalActions, - SLOT(updateActions())); - connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), globalActions, - SLOT(updateActions())); - connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), globalActions, - SLOT(updateActions())); - connect(m_centralWidget, SIGNAL(highlighted(QString)), statusBar(), - SLOT(showMessage(QString))); + connect(m_centralWidget, &CentralWidget::copyAvailable, + globalActions, &GlobalActions::setCopyAvailable); + connect(m_centralWidget, &CentralWidget::currentViewerChanged, + globalActions, &GlobalActions::updateActions); + connect(m_centralWidget, &CentralWidget::forwardAvailable, + globalActions, &GlobalActions::updateActions); + connect(m_centralWidget, &CentralWidget::backwardAvailable, + globalActions, &GlobalActions::updateActions); + connect(m_centralWidget, &CentralWidget::highlighted, + [this](const QString &link) { statusBar()->showMessage(link);} ); // index window - connect(m_indexWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, - SLOT(setSource(QUrl))); - connect(m_indexWindow, SIGNAL(linksActivated(QMap<QString,QUrl>,QString)), - this, SLOT(showTopicChooser(QMap<QString,QUrl>,QString))); - connect(m_indexWindow, SIGNAL(escapePressed()), this, - SLOT(activateCurrentCentralWidgetTab())); + connect(m_indexWindow, &IndexWindow::linkActivated, + m_centralWidget, &CentralWidget::setSource); + connect(m_indexWindow, &IndexWindow::linksActivated, + this, &MainWindow::showTopicChooser); + connect(m_indexWindow, &IndexWindow::escapePressed, + this, &MainWindow::activateCurrentCentralWidgetTab); // content window - connect(m_contentWindow, SIGNAL(linkActivated(QUrl)), m_centralWidget, - SLOT(setSource(QUrl))); - connect(m_contentWindow, SIGNAL(escapePressed()), this, - SLOT(activateCurrentCentralWidgetTab())); + connect(m_contentWindow, &ContentWindow::linkActivated, + m_centralWidget, &CentralWidget::setSource); + connect(m_contentWindow, &ContentWindow::escapePressed, + this, &MainWindow::activateCurrentCentralWidgetTab); // search window - connect(m_searchWindow, SIGNAL(requestShowLink(QUrl)), - CentralWidget::instance(), SLOT(setSourceFromSearch(QUrl))); - connect(m_searchWindow, SIGNAL(requestShowLinkInNewTab(QUrl)), - OpenPagesManager::instance(), SLOT(createNewPageFromSearch(QUrl))); + connect(m_searchWindow, &SearchWidget::requestShowLink, + CentralWidget::instance(), &CentralWidget::setSourceFromSearch); + connect(m_searchWindow, &SearchWidget::requestShowLinkInNewTab, + OpenPagesManager::instance(), &OpenPagesManager::createNewPageFromSearch); #if defined(QT_NO_PRINTER) m_pageSetupAction->setVisible(false); @@ -728,12 +742,12 @@ void MainWindow::setupFilterToolbar() filterToolBar->hide(); toolBarMenu()->addAction(filterToolBar->toggleViewAction()); - connect(&helpEngine, SIGNAL(setupFinished()), this, - SLOT(setupFilterCombo()), Qt::QueuedConnection); - connect(m_filterCombo, SIGNAL(activated(QString)), this, - SLOT(filterDocumentation(QString))); - connect(&helpEngine, SIGNAL(currentFilterChanged(QString)), this, - SLOT(currentFilterChanged(QString))); + connect(&helpEngine, &HelpEngineWrapper::setupFinished, + this, &MainWindow::setupFilterCombo, Qt::QueuedConnection); + connect(m_filterCombo, QOverload<const QString &>::of(&QComboBox::activated), + this, &MainWindow::filterDocumentation); + connect(&helpEngine, &HelpEngineWrapper::currentFilterChanged, + this, &MainWindow::currentFilterChanged); setupFilterCombo(); } @@ -759,12 +773,12 @@ void MainWindow::setupAddressToolbar() toolBarMenu()->addAction(addressToolBar->toggleViewAction()); // address lineedit - connect(m_addressLineEdit, SIGNAL(returnPressed()), this, - SLOT(gotoAddress())); - connect(m_centralWidget, SIGNAL(currentViewerChanged()), this, - SLOT(showNewAddress())); - connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this, - SLOT(showNewAddress(QUrl))); + connect(m_addressLineEdit, &QLineEdit::returnPressed, + this, &MainWindow::gotoAddress); + connect(m_centralWidget, &CentralWidget::currentViewerChanged, + this, QOverload<>::of(&MainWindow::showNewAddress)); + connect(m_centralWidget, &CentralWidget::sourceChanged, + this, QOverload<>::of(&MainWindow::showNewAddress)); } void MainWindow::updateAboutMenuText() @@ -827,12 +841,12 @@ void MainWindow::showPreferences() { TRACE_OBJ PreferencesDialog dia(this); - connect(&dia, SIGNAL(updateApplicationFont()), this, - SLOT(updateApplicationFont())); - connect(&dia, SIGNAL(updateBrowserFont()), m_centralWidget, - SLOT(updateBrowserFont())); - connect(&dia, SIGNAL(updateUserInterface()), m_centralWidget, - SLOT(updateUserInterface())); + connect(&dia, &PreferencesDialog::updateApplicationFont, + this, &MainWindow::updateApplicationFont); + connect(&dia, &PreferencesDialog::updateBrowserFont, + m_centralWidget, &CentralWidget::updateBrowserFont); + connect(&dia, &PreferencesDialog::updateUserInterface, + m_centralWidget, &CentralWidget::updateUserInterface); dia.showDialog(); } diff --git a/src/assistant/assistant/openpagesmanager.cpp b/src/assistant/assistant/openpagesmanager.cpp index c6f2e7347..61c2d6b08 100644 --- a/src/assistant/assistant/openpagesmanager.cpp +++ b/src/assistant/assistant/openpagesmanager.cpp @@ -70,18 +70,18 @@ OpenPagesManager::OpenPagesManager(QObject *parent, bool defaultCollection, TRACE_OBJ m_openPagesWidget = new OpenPagesWidget(m_model); m_openPagesWidget->setFrameStyle(QFrame::NoFrame); - connect(m_openPagesWidget, SIGNAL(setCurrentPage(QModelIndex)), this, - SLOT(setCurrentPage(QModelIndex))); - connect(m_openPagesWidget, SIGNAL(closePage(QModelIndex)), this, - SLOT(closePage(QModelIndex))); - connect(m_openPagesWidget, SIGNAL(closePagesExcept(QModelIndex)), this, - SLOT(closePagesExcept(QModelIndex))); + connect(m_openPagesWidget, &OpenPagesWidget::setCurrentPage, + this, QOverload<const QModelIndex &>::of(&OpenPagesManager::setCurrentPage)); + connect(m_openPagesWidget, &OpenPagesWidget::closePage, + this, QOverload<const QModelIndex &>::of(&OpenPagesManager::closePage)); + connect(m_openPagesWidget, &OpenPagesWidget::closePagesExcept, + this, &OpenPagesManager::closePagesExcept); m_openPagesSwitcher = new OpenPagesSwitcher(m_model); - connect(m_openPagesSwitcher, SIGNAL(closePage(QModelIndex)), this, - SLOT(closePage(QModelIndex))); - connect(m_openPagesSwitcher, SIGNAL(setCurrentPage(QModelIndex)), this, - SLOT(setCurrentPage(QModelIndex))); + connect(m_openPagesSwitcher, &OpenPagesSwitcher::closePage, + this, QOverload<const QModelIndex &>::of(&OpenPagesManager::closePage)); + connect(m_openPagesSwitcher, &OpenPagesSwitcher::setCurrentPage, + this, QOverload<const QModelIndex &>::of(&OpenPagesManager::setCurrentPage)); setupInitialPages(defaultCollection, cmdLineUrl); } @@ -159,7 +159,7 @@ void OpenPagesManager::setupInitialPages(bool defaultCollection, m_openPagesSwitcher->selectCurrentPage(); } -HelpViewer *OpenPagesManager::createPage() +HelpViewer *OpenPagesManager::createBlankPage() { TRACE_OBJ return createPage(QUrl(QLatin1String("about:blank"))); diff --git a/src/assistant/assistant/openpagesmanager.h b/src/assistant/assistant/openpagesmanager.h index bec8fe20e..387ae4d31 100644 --- a/src/assistant/assistant/openpagesmanager.h +++ b/src/assistant/assistant/openpagesmanager.h @@ -62,7 +62,7 @@ public: public slots: HelpViewer *createPage(const QUrl &url, bool fromSearch = false); HelpViewer *createNewPageFromSearch(const QUrl &url); - HelpViewer *createPage(); + HelpViewer *createBlankPage(); void closeCurrentPage(); void nextPage(); diff --git a/src/assistant/assistant/openpagesmodel.cpp b/src/assistant/assistant/openpagesmodel.cpp index a72205883..41a4504e7 100644 --- a/src/assistant/assistant/openpagesmodel.cpp +++ b/src/assistant/assistant/openpagesmodel.cpp @@ -69,7 +69,8 @@ void OpenPagesModel::addPage(const QUrl &url, qreal zoom) TRACE_OBJ beginInsertRows(QModelIndex(), rowCount(), rowCount()); HelpViewer *page = new HelpViewer(zoom); - connect(page, SIGNAL(titleChanged()), this, SLOT(handleTitleChanged())); + connect(page, &HelpViewer::titleChanged, + this, &OpenPagesModel::handleTitleChanged); m_pages << page; endInsertRows(); page->setSource(url); diff --git a/src/assistant/assistant/openpagesswitcher.cpp b/src/assistant/assistant/openpagesswitcher.cpp index 9932fd216..30acd6bd5 100644 --- a/src/assistant/assistant/openpagesswitcher.cpp +++ b/src/assistant/assistant/openpagesswitcher.cpp @@ -66,10 +66,10 @@ OpenPagesSwitcher::OpenPagesSwitcher(OpenPagesModel *model) layout->setMargin(0); layout->addWidget(m_openPagesWidget); - connect(m_openPagesWidget, SIGNAL(closePage(QModelIndex)), this, - SIGNAL(closePage(QModelIndex))); - connect(m_openPagesWidget, SIGNAL(setCurrentPage(QModelIndex)), this, - SIGNAL(setCurrentPage(QModelIndex))); + connect(m_openPagesWidget, &OpenPagesWidget::closePage, + this, &OpenPagesSwitcher::closePage); + connect(m_openPagesWidget, &OpenPagesWidget::setCurrentPage, + this, &OpenPagesSwitcher::setCurrentPage); } OpenPagesSwitcher::~OpenPagesSwitcher() diff --git a/src/assistant/assistant/openpageswidget.cpp b/src/assistant/assistant/openpageswidget.cpp index c4196fbff..c22906617 100644 --- a/src/assistant/assistant/openpageswidget.cpp +++ b/src/assistant/assistant/openpageswidget.cpp @@ -101,12 +101,12 @@ OpenPagesWidget::OpenPagesWidget(OpenPagesModel *model) setUniformRowHeights(true); setContextMenuPolicy(Qt::CustomContextMenu); - connect(this, SIGNAL(clicked(QModelIndex)), this, - SLOT(handleClicked(QModelIndex))); - connect(this, SIGNAL(pressed(QModelIndex)), this, - SLOT(handlePressed(QModelIndex))); - connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, - SLOT(contextMenuRequested(QPoint))); + connect(this, &QAbstractItemView::clicked, + this, &OpenPagesWidget::handleClicked); + connect(this, &QAbstractItemView::pressed, + this, &OpenPagesWidget::handlePressed); + connect(this, &QWidget::customContextMenuRequested, + this, &OpenPagesWidget::contextMenuRequested); } OpenPagesWidget::~OpenPagesWidget() diff --git a/src/assistant/assistant/preferencesdialog.cpp b/src/assistant/assistant/preferencesdialog.cpp index 1942d19d8..963b61596 100644 --- a/src/assistant/assistant/preferencesdialog.cpp +++ b/src/assistant/assistant/preferencesdialog.cpp @@ -152,26 +152,24 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) connect(m_ui.registeredDocsFilterLineEdit, &QLineEdit::textChanged, m_registereredDocsFilterModel, &QSortFilterProxyModel::setFilterFixedString); - connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), - this, SLOT(applyChanges())); - connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), - this, SLOT(reject())); + connect(m_ui.buttonBox->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, + this, &PreferencesDialog::applyChanges); + connect(m_ui.buttonBox->button(QDialogButtonBox::Cancel), &QAbstractButton::clicked, + this, &QDialog::reject); if (!m_hideFiltersTab) { m_ui.attributeWidget->header()->hide(); m_ui.attributeWidget->setRootIsDecorated(false); - connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), - this, SLOT(updateFilterMap())); + connect(m_ui.attributeWidget, &QTreeWidget::itemChanged, + this, &PreferencesDialog::updateFilterMap); + connect(m_ui.filterWidget, &QListWidget::currentItemChanged, + this, &PreferencesDialog::updateAttributes); - connect(m_ui.filterWidget, - SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, - SLOT(updateAttributes(QListWidgetItem*))); - - connect(m_ui.filterAddButton, SIGNAL(clicked()), this, - SLOT(addFilter())); - connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this, - SLOT(removeFilter())); + connect(m_ui.filterAddButton, &QAbstractButton::clicked, + this, &PreferencesDialog::addFilter); + connect(m_ui.filterRemoveButton, &QAbstractButton::clicked, + this, &PreferencesDialog::removeFilter); updateFilterPage(); } else { @@ -179,10 +177,10 @@ PreferencesDialog::PreferencesDialog(QWidget *parent) } if (!m_hideDocsTab) { - connect(m_ui.docAddButton, SIGNAL(clicked()), this, - SLOT(addDocumentationLocal())); - connect(m_ui.docRemoveButton, SIGNAL(clicked()), this, - SLOT(removeDocumentation())); + connect(m_ui.docAddButton, &QAbstractButton::clicked, + this, &PreferencesDialog::addDocumentationLocal); + connect(m_ui.docRemoveButton, &QAbstractButton::clicked, + this, &PreferencesDialog::removeDocumentation); m_docsBackup.reserve(m_registeredDocsModel->rowCount()); for (const RegisteredDocEntry &e : m_registeredDocsModel->docEntries()) @@ -508,21 +506,21 @@ void PreferencesDialog::updateFontSettingsPage() m_browserFontPanel->setChecked(helpEngine.usesBrowserFont()); - connect(m_appFontPanel, SIGNAL(toggled(bool)), this, - SLOT(appFontSettingToggled(bool))); - connect(m_browserFontPanel, SIGNAL(toggled(bool)), this, - SLOT(browserFontSettingToggled(bool))); + connect(m_appFontPanel, &QGroupBox::toggled, + this, &PreferencesDialog::appFontSettingToggled); + connect(m_browserFontPanel, &QGroupBox::toggled, + this, &PreferencesDialog::browserFontSettingToggled); const QList<QComboBox*> &appCombos = m_appFontPanel->findChildren<QComboBox*>(); for (QComboBox* box : appCombos) { - connect(box, SIGNAL(currentIndexChanged(int)), this, - SLOT(appFontSettingChanged(int))); + connect(box, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &PreferencesDialog::appFontSettingChanged); } const QList<QComboBox*> &browserCombos = m_browserFontPanel->findChildren<QComboBox*>(); for (QComboBox* box : browserCombos) { - connect(box, SIGNAL(currentIndexChanged(int)), this, - SLOT(browserFontSettingChanged(int))); + connect(box, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &PreferencesDialog::browserFontSettingChanged); } } @@ -565,9 +563,12 @@ void PreferencesDialog::updateOptionsPage() m_showTabs = helpEngine.showTabs(); m_ui.showTabs->setChecked(m_showTabs); - connect(m_ui.blankPageButton, SIGNAL(clicked()), this, SLOT(setBlankPage())); - connect(m_ui.currentPageButton, SIGNAL(clicked()), this, SLOT(setCurrentPage())); - connect(m_ui.defaultPageButton, SIGNAL(clicked()), this, SLOT(setDefaultPage())); + connect(m_ui.blankPageButton, &QAbstractButton::clicked, + this, &PreferencesDialog::setBlankPage); + connect(m_ui.currentPageButton, &QAbstractButton::clicked, + this, &PreferencesDialog::setCurrentPage); + connect(m_ui.defaultPageButton, &QAbstractButton::clicked, + this, &PreferencesDialog::setDefaultPage); } void PreferencesDialog::setBlankPage() diff --git a/src/assistant/assistant/remotecontrol.cpp b/src/assistant/assistant/remotecontrol.cpp index e577a667b..61f8b0282 100644 --- a/src/assistant/assistant/remotecontrol.cpp +++ b/src/assistant/assistant/remotecontrol.cpp @@ -64,11 +64,12 @@ RemoteControl::RemoteControl(MainWindow *mainWindow) { TRACE_OBJ - connect(m_mainWindow, SIGNAL(initDone()), this, SLOT(applyCache())); + connect(m_mainWindow, &MainWindow::initDone, + this, &RemoteControl::applyCache); StdInListener *l = new StdInListener(this); - connect(l, SIGNAL(receivedCommand(QString)), - this, SLOT(handleCommandString(QString))); + connect(l, &StdInListener::receivedCommand, + this, &RemoteControl::handleCommandString); l->start(); } diff --git a/src/assistant/assistant/searchwidget.cpp b/src/assistant/assistant/searchwidget.cpp index 3aefe46c2..136403d6f 100644 --- a/src/assistant/assistant/searchwidget.cpp +++ b/src/assistant/assistant/searchwidget.cpp @@ -66,14 +66,15 @@ SearchWidget::SearchWidget(QHelpSearchEngine *engine, QWidget *parent) setFocusProxy(queryWidget); - connect(queryWidget, SIGNAL(search()), this, SLOT(search())); - connect(resultWidget, SIGNAL(requestShowLink(QUrl)), this, - SIGNAL(requestShowLink(QUrl))); - - connect(searchEngine, SIGNAL(searchingStarted()), this, - SLOT(searchingStarted())); - connect(searchEngine, SIGNAL(searchingFinished(int)), this, - SLOT(searchingFinished(int))); + connect(queryWidget, &QHelpSearchQueryWidget::search, + this, &SearchWidget::search); + connect(resultWidget, &QHelpSearchResultWidget::requestShowLink, + this, &SearchWidget::requestShowLink); + + connect(searchEngine, &QHelpSearchEngine::searchingStarted, + this, &SearchWidget::searchingStarted); + connect(searchEngine, &QHelpSearchEngine::searchingFinished, + this, &SearchWidget::searchingFinished); QTextBrowser* browser = resultWidget->findChild<QTextBrowser*>(); if (browser) diff --git a/src/assistant/assistant/stdinlistener.cpp b/src/assistant/assistant/stdinlistener.cpp index 8c83fbe58..43c13f299 100644 --- a/src/assistant/assistant/stdinlistener.cpp +++ b/src/assistant/assistant/stdinlistener.cpp @@ -38,7 +38,8 @@ StdInListener::StdInListener(QObject *parent) : QSocketNotifier(fileno(stdin), QSocketNotifier::Read, parent) { TRACE_OBJ - connect(this, SIGNAL(activated(int)), this, SLOT(receivedData())); + connect(this, &QSocketNotifier::activated, + this, &StdInListener::receivedData); } StdInListener::~StdInListener() diff --git a/src/assistant/assistant/topicchooser.cpp b/src/assistant/assistant/topicchooser.cpp index ff3bbd8b7..478ca65ed 100644 --- a/src/assistant/assistant/topicchooser.cpp +++ b/src/assistant/assistant/topicchooser.cpp @@ -67,10 +67,14 @@ TopicChooser::TopicChooser(QWidget *parent, const QString &keyword, const QMap<Q if (m_filterModel->rowCount() != 0) ui.listWidget->setCurrentIndex(m_filterModel->index(0, 0)); - connect(ui.buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); - connect(ui.buttonDisplay, SIGNAL(clicked()), this, SLOT(acceptDialog())); - connect(ui.lineEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString))); - connect(ui.listWidget, SIGNAL(activated(QModelIndex)), this, SLOT(activated(QModelIndex))); + connect(ui.buttonCancel, &QAbstractButton::clicked, + this, &QDialog::reject); + connect(ui.buttonDisplay, &QAbstractButton::clicked, + this, &TopicChooser::acceptDialog); + connect(ui.lineEdit, &QLineEdit::textChanged, + this, &TopicChooser::setFilter); + connect(ui.listWidget, &QAbstractItemView::activated, + this, &TopicChooser::activated); const QByteArray ba = HelpEngineWrapper::instance().topicChooserGeometry(); if (!ba.isEmpty()) diff --git a/src/assistant/help/qhelpcontentwidget.cpp b/src/assistant/help/qhelpcontentwidget.cpp index 634a14bfa..57dfff591 100644 --- a/src/assistant/help/qhelpcontentwidget.cpp +++ b/src/assistant/help/qhelpcontentwidget.cpp @@ -352,9 +352,10 @@ QHelpContentModel::QHelpContentModel(QHelpEnginePrivate *helpEngine) d->rootItem = 0; d->qhelpContentProvider = new QHelpContentProvider(helpEngine); - connect(d->qhelpContentProvider, SIGNAL(finishedSuccessFully()), - this, SLOT(insertContents()), Qt::QueuedConnection); - connect(helpEngine->q, SIGNAL(readersAboutToBeInvalidated()), this, SLOT(invalidateContents())); + connect(d->qhelpContentProvider, &QHelpContentProvider::finishedSuccessFully, + this, &QHelpContentModel::insertContents, Qt::QueuedConnection); + connect(helpEngine->q, &QHelpEngineCore::readersAboutToBeInvalidated, + [this]() { invalidateContents(); }); } /*! @@ -369,7 +370,8 @@ QHelpContentModel::~QHelpContentModel() void QHelpContentModel::invalidateContents(bool onShutDown) { if (onShutDown) { - disconnect(this, SLOT(insertContents())); + disconnect(d->qhelpContentProvider, &QHelpContentProvider::finishedSuccessFully, + this, &QHelpContentModel::insertContents); } else { beginResetModel(); } @@ -521,8 +523,8 @@ QHelpContentWidget::QHelpContentWidget() { header()->hide(); setUniformRowHeights(true); - connect(this, SIGNAL(activated(QModelIndex)), - this, SLOT(showLink(QModelIndex))); + connect(this, &QAbstractItemView::activated, + this, &QHelpContentWidget::showLink); } /*! diff --git a/src/assistant/help/qhelpengine.cpp b/src/assistant/help/qhelpengine.cpp index ab512e85c..6562d69a3 100644 --- a/src/assistant/help/qhelpengine.cpp +++ b/src/assistant/help/qhelpengine.cpp @@ -77,10 +77,10 @@ void QHelpEnginePrivate::init(const QString &collectionFile, if (!indexModel) indexModel = new QHelpIndexModel(this); - connect(helpEngineCore, SIGNAL(setupFinished()), this, - SLOT(applyCurrentFilter())); - connect(helpEngineCore, SIGNAL(currentFilterChanged(QString)), this, - SLOT(applyCurrentFilter())); + connect(helpEngineCore, &QHelpEngineCore::setupFinished, + this, &QHelpEnginePrivate::applyCurrentFilter); + connect(helpEngineCore, &QHelpEngineCore::currentFilterChanged, + this, &QHelpEnginePrivate::applyCurrentFilter); } void QHelpEnginePrivate::applyCurrentFilter() @@ -181,10 +181,10 @@ QHelpContentWidget *QHelpEngine::contentWidget() if (!d->contentWidget) { d->contentWidget = new QHelpContentWidget(); d->contentWidget->setModel(d->contentModel); - connect(d->contentModel, SIGNAL(contentsCreationStarted()), - d, SLOT(setContentsWidgetBusy())); - connect(d->contentModel, SIGNAL(contentsCreated()), - d, SLOT(unsetContentsWidgetBusy())); + connect(d->contentModel, &QHelpContentModel::contentsCreationStarted, + d, &QHelpEnginePrivate::setContentsWidgetBusy); + connect(d->contentModel, &QHelpContentModel::contentsCreated, + d, &QHelpEnginePrivate::unsetContentsWidgetBusy); } return d->contentWidget; } @@ -197,10 +197,10 @@ QHelpIndexWidget *QHelpEngine::indexWidget() if (!d->indexWidget) { d->indexWidget = new QHelpIndexWidget(); d->indexWidget->setModel(d->indexModel); - connect(d->indexModel, SIGNAL(indexCreationStarted()), - d, SLOT(setIndexWidgetBusy())); - connect(d->indexModel, SIGNAL(indexCreated()), - d, SLOT(unsetIndexWidgetBusy())); + connect(d->indexModel, &QHelpIndexModel::indexCreationStarted, + d, &QHelpEnginePrivate::setIndexWidgetBusy); + connect(d->indexModel, &QHelpIndexModel::indexCreated, + d, &QHelpEnginePrivate::unsetIndexWidgetBusy); } return d->indexWidget; } diff --git a/src/assistant/help/qhelpenginecore.cpp b/src/assistant/help/qhelpenginecore.cpp index 51e9bade1..539198c54 100644 --- a/src/assistant/help/qhelpenginecore.cpp +++ b/src/assistant/help/qhelpenginecore.cpp @@ -63,8 +63,8 @@ void QHelpEngineCorePrivate::init(const QString &collectionFile, { q = helpEngineCore; collectionHandler = new QHelpCollectionHandler(collectionFile, helpEngineCore); - connect(collectionHandler, SIGNAL(error(QString)), - this, SLOT(errorReceived(QString))); + connect(collectionHandler, &QHelpCollectionHandler::error, + this, &QHelpEngineCorePrivate::errorReceived); needsSetup = true; } diff --git a/src/assistant/help/qhelpindexwidget.cpp b/src/assistant/help/qhelpindexwidget.cpp index 375ddb6b8..e31f8b30e 100644 --- a/src/assistant/help/qhelpindexwidget.cpp +++ b/src/assistant/help/qhelpindexwidget.cpp @@ -229,8 +229,10 @@ QHelpIndexModel::QHelpIndexModel(QHelpEnginePrivate *helpEngine) { d = new QHelpIndexModelPrivate(helpEngine); - connect(d->indexProvider, SIGNAL(finished()), this, SLOT(insertIndices())); - connect(helpEngine->q, SIGNAL(readersAboutToBeInvalidated()), this, SLOT(invalidateIndex())); + connect(d->indexProvider, &QThread::finished, + this, &QHelpIndexModel::insertIndices); + connect(helpEngine->q, &QHelpEngineCore::readersAboutToBeInvalidated, + [this]() { invalidateIndex(); }); } QHelpIndexModel::~QHelpIndexModel() @@ -240,8 +242,10 @@ QHelpIndexModel::~QHelpIndexModel() void QHelpIndexModel::invalidateIndex(bool onShutDown) { - if (onShutDown) - disconnect(this, SLOT(insertIndices())); + if (onShutDown) { + disconnect(d->indexProvider, &QThread::finished, + this, &QHelpIndexModel::insertIndices); + } d->indexProvider->stopCollecting(); d->indices.clear(); if (!onShutDown) @@ -390,8 +394,8 @@ QHelpIndexWidget::QHelpIndexWidget() { setEditTriggers(QAbstractItemView::NoEditTriggers); setUniformItemSizes(true); - connect(this, SIGNAL(activated(QModelIndex)), - this, SLOT(showLink(QModelIndex))); + connect(this, &QAbstractItemView::activated, + this, &QHelpIndexWidget::showLink); } void QHelpIndexWidget::showLink(const QModelIndex &index) diff --git a/src/assistant/help/qhelpsearchengine.cpp b/src/assistant/help/qhelpsearchengine.cpp index 5f9edb265..a62d4e977 100644 --- a/src/assistant/help/qhelpsearchengine.cpp +++ b/src/assistant/help/qhelpsearchengine.cpp @@ -201,8 +201,10 @@ private: if (!indexWriter) { indexWriter = new QHelpSearchIndexWriter(); - connect(indexWriter, SIGNAL(indexingStarted()), this, SIGNAL(indexingStarted())); - connect(indexWriter, SIGNAL(indexingFinished()), this, SIGNAL(indexingFinished())); + connect(indexWriter, &QHelpSearchIndexWriter::indexingStarted, + this, &QHelpSearchEnginePrivate::indexingStarted); + connect(indexWriter, &QHelpSearchIndexWriter::indexingFinished, + this, &QHelpSearchEnginePrivate::indexingFinished); } indexWriter->cancelIndexing(); @@ -226,8 +228,10 @@ private: if (!indexReader) { indexReader = new QHelpSearchIndexReaderDefault(); - connect(indexReader, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted())); - connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int))); + connect(indexReader, &fulltextsearch::QHelpSearchIndexReader::searchingStarted, + this, &QHelpSearchEnginePrivate::searchingStarted); + connect(indexReader, &fulltextsearch::QHelpSearchIndexReader::searchingFinished, + this, &QHelpSearchEnginePrivate::searchingFinished); } m_searchInput = searchInput; @@ -389,12 +393,17 @@ QHelpSearchEngine::QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *paren { d = new QHelpSearchEnginePrivate(helpEngine); - connect(helpEngine, SIGNAL(setupFinished()), this, SLOT(scheduleIndexDocumentation())); - - connect(d, SIGNAL(indexingStarted()), this, SIGNAL(indexingStarted())); - connect(d, SIGNAL(indexingFinished()), this, SIGNAL(indexingFinished())); - connect(d, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted())); - connect(d, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int))); + connect(helpEngine, &QHelpEngineCore::setupFinished, + this, &QHelpSearchEngine::scheduleIndexDocumentation); + + connect(d, &QHelpSearchEnginePrivate::indexingStarted, + this, &QHelpSearchEngine::indexingStarted); + connect(d, &QHelpSearchEnginePrivate::indexingFinished, + this, &QHelpSearchEngine::indexingFinished); + connect(d, &QHelpSearchEnginePrivate::searchingStarted, + this, &QHelpSearchEngine::searchingStarted); + connect(d, &QHelpSearchEnginePrivate::searchingFinished, + this, &QHelpSearchEngine::searchingFinished); } /*! diff --git a/src/assistant/help/qhelpsearchengine.h b/src/assistant/help/qhelpsearchengine.h index 51ac975d7..02cdbab9a 100644 --- a/src/assistant/help/qhelpsearchengine.h +++ b/src/assistant/help/qhelpsearchengine.h @@ -125,6 +125,8 @@ public Q_SLOTS: void search(const QString &searchInput); void cancelSearching(); + void scheduleIndexDocumentation(); + Q_SIGNALS: void indexingStarted(); void indexingFinished(); @@ -133,7 +135,6 @@ Q_SIGNALS: void searchingFinished(int searchResultCount); private Q_SLOTS: - void scheduleIndexDocumentation(); void indexDocumentation(); private: diff --git a/src/assistant/help/qhelpsearchquerywidget.cpp b/src/assistant/help/qhelpsearchquerywidget.cpp index 6300635da..bddb0c321 100644 --- a/src/assistant/help/qhelpsearchquerywidget.cpp +++ b/src/assistant/help/qhelpsearchquerywidget.cpp @@ -257,13 +257,18 @@ QHelpSearchQueryWidget::QHelpSearchQueryWidget(QWidget *parent) vLayout->addLayout(hBoxLayout); - connect(d->m_prevQueryButton, SIGNAL(clicked()), d, SLOT(prevQuery())); - connect(d->m_nextQueryButton, SIGNAL(clicked()), d, SLOT(nextQuery())); - connect(d->m_searchButton, SIGNAL(clicked()), this, SIGNAL(search())); - connect(d->m_lineEdit, SIGNAL(returnPressed()), this, SIGNAL(search())); + connect(d->m_prevQueryButton, &QAbstractButton::clicked, + d, &QHelpSearchQueryWidgetPrivate::prevQuery); + connect(d->m_nextQueryButton, &QAbstractButton::clicked, + d, &QHelpSearchQueryWidgetPrivate::nextQuery); + connect(d->m_searchButton, &QAbstractButton::clicked, + this, &QHelpSearchQueryWidget::search); + connect(d->m_lineEdit, &QLineEdit::returnPressed, + this, &QHelpSearchQueryWidget::search); d->retranslate(); - connect(this, SIGNAL(search()), d, SLOT(searchRequested())); + connect(this, &QHelpSearchQueryWidget::search, + d, &QHelpSearchQueryWidgetPrivate::searchRequested); setCompactMode(true); } diff --git a/src/assistant/help/qhelpsearchresultwidget.cpp b/src/assistant/help/qhelpsearchresultwidget.cpp index 6bb512e9a..2e4eaee68 100644 --- a/src/assistant/help/qhelpsearchresultwidget.cpp +++ b/src/assistant/help/qhelpsearchresultwidget.cpp @@ -64,8 +64,8 @@ public: QResultWidget(QWidget *parent = 0) : QTextBrowser(parent) { - connect(this, SIGNAL(anchorClicked(QUrl)), - this, SIGNAL(requestShowLink(QUrl))); + connect(this, &QTextBrowser::anchorClicked, + this, &QResultWidget::requestShowLink); setContextMenuPolicy(Qt::NoContextMenu); } @@ -230,10 +230,10 @@ private: nextResultPage = 0; lastResultPage = 0; - connect(searchEngine, SIGNAL(indexingStarted()), - this, SLOT(indexingStarted())); - connect(searchEngine, SIGNAL(indexingFinished()), - this, SLOT(indexingFinished())); + connect(searchEngine.data(), &QHelpSearchEngine::indexingStarted, + this, &QHelpSearchResultWidgetPrivate::indexingStarted); + connect(searchEngine.data(), &QHelpSearchEngine::indexingFinished, + this, &QHelpSearchResultWidgetPrivate::indexingFinished); } ~QHelpSearchResultWidgetPrivate() @@ -344,20 +344,29 @@ QHelpSearchResultWidget::QHelpSearchResultWidget(QHelpSearchEngine *engine) d->resultTextBrowser = new QResultWidget(this); vLayout->addWidget(d->resultTextBrowser); - connect(d->resultTextBrowser, SIGNAL(requestShowLink(QUrl)), this, - SIGNAL(requestShowLink(QUrl))); - - connect(d->nextResultPage, SIGNAL(clicked()), d, SLOT(showNextResultPage())); - connect(d->lastResultPage, SIGNAL(clicked()), d, SLOT(showLastResultPage())); - connect(d->firstResultPage, SIGNAL(clicked()), d, SLOT(showFirstResultPage())); - connect(d->previousResultPage, SIGNAL(clicked()), d, SLOT(showPreviousResultPage())); - - connect(d->firstResultPage, SIGNAL(clicked()), d, SLOT(updateNextButtonState())); - connect(d->previousResultPage, SIGNAL(clicked()), d, SLOT(updateNextButtonState())); - connect(d->nextResultPage, SIGNAL(clicked()), d, SLOT(updatePrevButtonState())); - connect(d->lastResultPage, SIGNAL(clicked()), d, SLOT(updatePrevButtonState())); - - connect(engine, SIGNAL(searchingFinished(int)), d, SLOT(setResults(int))); + connect(d->resultTextBrowser, &QResultWidget::requestShowLink, + this, &QHelpSearchResultWidget::requestShowLink); + + connect(d->nextResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::showNextResultPage); + connect(d->lastResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::showLastResultPage); + connect(d->firstResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::showFirstResultPage); + connect(d->previousResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::showPreviousResultPage); + + connect(d->firstResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::updateNextButtonState); + connect(d->previousResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::updateNextButtonState); + connect(d->nextResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::updatePrevButtonState); + connect(d->lastResultPage, &QAbstractButton::clicked, + d, &QHelpSearchResultWidgetPrivate::updatePrevButtonState); + + connect(engine, &QHelpSearchEngine::searchingFinished, + d, &QHelpSearchResultWidgetPrivate::setResults); } /*! \reimp diff --git a/src/assistant/qhelpconverter/conversionwizard.cpp b/src/assistant/qhelpconverter/conversionwizard.cpp index 7c2541594..c69330e20 100644 --- a/src/assistant/qhelpconverter/conversionwizard.cpp +++ b/src/assistant/qhelpconverter/conversionwizard.cpp @@ -86,15 +86,16 @@ ConversionWizard::ConversionWizard() setPage(Finish_Page, m_finishPage); m_finishPage->setMaximumHeight(240); - connect(this, SIGNAL(currentIdChanged(int)), - this, SLOT(pageChanged(int))); + connect(this, &QWizard::currentIdChanged, + this, &ConversionWizard::pageChanged); m_helpWindow = 0; qApp->installEventFilter(this); QAbstractButton *btn = button(QWizard::HelpButton); btn->setCheckable(true); - connect(btn, SIGNAL(toggled(bool)), this, SLOT(showHelp(bool))); + connect(btn, &QAbstractButton::toggled, + this, &ConversionWizard::showHelp); } void ConversionWizard::setAdpFileName(const QString &fileName) @@ -143,7 +144,7 @@ void ConversionWizard::pageChanged(int id) m_outputPage->setCollectionComponentEnabled( !m_adpReader.properties().isEmpty()); } else if (id == Finish_Page) { - QTimer::singleShot(300, this, SLOT(convert())); + QTimer::singleShot(300, this, &ConversionWizard::convert); } } diff --git a/src/assistant/qhelpconverter/filespage.cpp b/src/assistant/qhelpconverter/filespage.cpp index 45d2840b6..335a698f7 100644 --- a/src/assistant/qhelpconverter/filespage.cpp +++ b/src/assistant/qhelpconverter/filespage.cpp @@ -41,10 +41,10 @@ FilesPage::FilesPage(QWidget *parent) m_ui.setupUi(this); m_ui.fileListWidget->setSelectionMode(QAbstractItemView::ExtendedSelection); m_ui.fileListWidget->installEventFilter(this); - connect(m_ui.removeButton, SIGNAL(clicked()), - this, SLOT(removeFile())); - connect(m_ui.removeAllButton, SIGNAL(clicked()), - this, SLOT(removeAllFiles())); + connect(m_ui.removeButton, &QAbstractButton::clicked, + this, &FilesPage::removeFile); + connect(m_ui.removeAllButton, &QAbstractButton::clicked, + this, &FilesPage::removeAllFiles); m_ui.fileLabel->setText(tr("<p><b>Warning:</b> " "When removing images or stylesheets, be aware that those files " diff --git a/src/assistant/qhelpconverter/filterpage.cpp b/src/assistant/qhelpconverter/filterpage.cpp index 605a8e6a4..0f0e7f1a6 100644 --- a/src/assistant/qhelpconverter/filterpage.cpp +++ b/src/assistant/qhelpconverter/filterpage.cpp @@ -46,10 +46,10 @@ FilterPage::FilterPage(QWidget *parent) m_ui.customFilterWidget->headerItem()->setText(1, tr("Filter Attributes")); m_ui.customFilterWidget->setRootIsDecorated(false); m_ui.removeButton->setDisabled(true); - connect(m_ui.addButton, SIGNAL(clicked()), - this, SLOT(addFilter())); - connect(m_ui.removeButton, SIGNAL(clicked()), - this, SLOT(removeFilter())); + connect(m_ui.addButton, &QAbstractButton::clicked, + this, &FilterPage::addFilter); + connect(m_ui.removeButton, &QAbstractButton::clicked, + this, &FilterPage::removeFilter); } bool FilterPage::validatePage() diff --git a/src/assistant/qhelpconverter/generalpage.cpp b/src/assistant/qhelpconverter/generalpage.cpp index e1245d8de..f31e5fa53 100644 --- a/src/assistant/qhelpconverter/generalpage.cpp +++ b/src/assistant/qhelpconverter/generalpage.cpp @@ -39,10 +39,10 @@ GeneralPage::GeneralPage(QWidget *parent) "folder for the documentation.")); m_ui.setupUi(this); - connect(m_ui.namespaceLineEdit, SIGNAL(textChanged(QString)), - this, SIGNAL(completeChanged())); - connect(m_ui.folderLineEdit, SIGNAL(textChanged(QString)), - this, SIGNAL(completeChanged())); + connect(m_ui.namespaceLineEdit, &QLineEdit::textChanged, + this, &QWizardPage::completeChanged); + connect(m_ui.folderLineEdit, &QLineEdit::textChanged, + this, &QWizardPage::completeChanged); m_ui.namespaceLineEdit->setText(QLatin1String("mycompany.com")); m_ui.folderLineEdit->setText(QLatin1String("product_1.0")); diff --git a/src/assistant/qhelpconverter/identifierpage.cpp b/src/assistant/qhelpconverter/identifierpage.cpp index abf180fe7..fd7597aae 100644 --- a/src/assistant/qhelpconverter/identifierpage.cpp +++ b/src/assistant/qhelpconverter/identifierpage.cpp @@ -39,8 +39,8 @@ IdentifierPage::IdentifierPage(QWidget *parent) m_ui.setupUi(this); - connect(m_ui.identifierCheckBox, SIGNAL(toggled(bool)), - this, SLOT(setupButtons(bool))); + connect(m_ui.identifierCheckBox, &QAbstractButton::toggled, + this, &IdentifierPage::setupButtons); registerField(QLatin1String("createIdentifier"), m_ui.identifierCheckBox); registerField(QLatin1String("globalPrefix"), m_ui.prefixLineEdit); diff --git a/src/assistant/qhelpconverter/inputpage.cpp b/src/assistant/qhelpconverter/inputpage.cpp index dce979c92..471cc9acf 100644 --- a/src/assistant/qhelpconverter/inputpage.cpp +++ b/src/assistant/qhelpconverter/inputpage.cpp @@ -52,8 +52,8 @@ InputPage::InputPage(AdpReader *reader, QWidget *parent) "collection format.")); m_ui.setupUi(this); - connect(m_ui.browseButton, SIGNAL(clicked()), - this, SLOT(getFileName())); + connect(m_ui.browseButton, &QAbstractButton::clicked, + this, &InputPage::getFileName); registerField(QLatin1String("adpFileName"), m_ui.fileLineEdit); } diff --git a/src/assistant/qhelpconverter/outputpage.cpp b/src/assistant/qhelpconverter/outputpage.cpp index 0a667ca39..92948fe24 100644 --- a/src/assistant/qhelpconverter/outputpage.cpp +++ b/src/assistant/qhelpconverter/outputpage.cpp @@ -42,10 +42,10 @@ OutputPage::OutputPage(QWidget *parent) setButtonText(QWizard::NextButton, tr("Convert...")); m_ui.setupUi(this); - connect(m_ui.projectLineEdit, SIGNAL(textChanged(QString)), - this, SIGNAL(completeChanged())); - connect(m_ui.collectionLineEdit, SIGNAL(textChanged(QString)), - this, SIGNAL(completeChanged())); + connect(m_ui.projectLineEdit, &QLineEdit::textChanged, + this, &QWizardPage::completeChanged); + connect(m_ui.collectionLineEdit, &QLineEdit::textChanged, + this, &QWizardPage::completeChanged); registerField(QLatin1String("ProjectFileName"), m_ui.projectLineEdit); diff --git a/src/assistant/qhelpconverter/pathpage.cpp b/src/assistant/qhelpconverter/pathpage.cpp index 977f47dda..261cdd217 100644 --- a/src/assistant/qhelpconverter/pathpage.cpp +++ b/src/assistant/qhelpconverter/pathpage.cpp @@ -41,10 +41,10 @@ PathPage::PathPage(QWidget *parent) "matched by the file filter will be included.")); m_ui.setupUi(this); - connect(m_ui.addButton, SIGNAL(clicked()), - this, SLOT(addPath())); - connect(m_ui.removeButton, SIGNAL(clicked()), - this, SLOT(removePath())); + connect(m_ui.addButton, &QAbstractButton::clicked, + this, &PathPage::addPath); + connect(m_ui.removeButton, &QAbstractButton::clicked, + this, &PathPage::removePath); m_ui.filterLineEdit->setText(QLatin1String("*.html, *.htm, *.png, *.jpg, *.css")); diff --git a/src/assistant/shared/helpgenerator.cpp b/src/assistant/shared/helpgenerator.cpp index 5bdd272c5..3f6aedf50 100644 --- a/src/assistant/shared/helpgenerator.cpp +++ b/src/assistant/shared/helpgenerator.cpp @@ -48,11 +48,11 @@ HelpGenerator::HelpGenerator(bool silent) { generator = new QHelpGenerator(this); if (!silent) { - connect(generator, SIGNAL(statusChanged(QString)), - this, SLOT(printStatus(QString))); + connect(generator, &QHelpGenerator::statusChanged, + this, &HelpGenerator::printStatus); } - connect(generator, SIGNAL(warning(QString)), - this, SLOT(printWarning(QString))); + connect(generator, &QHelpGenerator::warning, + this, &HelpGenerator::printWarning); } bool HelpGenerator::generate(QHelpDataInterface *helpData, diff --git a/src/shared/fontpanel/fontpanel.cpp b/src/shared/fontpanel/fontpanel.cpp index 55cb138bd..6121421fc 100644 --- a/src/shared/fontpanel/fontpanel.cpp +++ b/src/shared/fontpanel/fontpanel.cpp @@ -68,18 +68,22 @@ FontPanel::FontPanel(QWidget *parentWidget) : writingSystems.push_front(QFontDatabase::Any); for (QFontDatabase::WritingSystem ws : qAsConst(writingSystems)) m_writingSystemComboBox->addItem(QFontDatabase::writingSystemName(ws), QVariant(ws)); - connect(m_writingSystemComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotWritingSystemChanged(int))); + connect(m_writingSystemComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &FontPanel::slotWritingSystemChanged); formLayout->addRow(tr("&Writing system"), m_writingSystemComboBox); - connect(m_familyComboBox, SIGNAL(currentFontChanged(QFont)), this, SLOT(slotFamilyChanged(QFont))); + connect(m_familyComboBox, &QFontComboBox::currentFontChanged, + this, &FontPanel::slotFamilyChanged); formLayout->addRow(tr("&Family"), m_familyComboBox); m_styleComboBox->setEditable(false); - connect(m_styleComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotStyleChanged(int))); + connect(m_styleComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &FontPanel::slotStyleChanged); formLayout->addRow(tr("&Style"), m_styleComboBox); m_pointSizeComboBox->setEditable(false); - connect(m_pointSizeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPointSizeChanged(int))); + connect(m_pointSizeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged), + this, &FontPanel::slotPointSizeChanged); formLayout->addRow(tr("&Point size"), m_pointSizeComboBox); m_previewLineEdit->setReadOnly(true); @@ -294,7 +298,8 @@ void FontPanel::delayedPreviewFontUpdate() { if (!m_previewFontUpdateTimer) { m_previewFontUpdateTimer = new QTimer(this); - connect(m_previewFontUpdateTimer, SIGNAL(timeout()), this, SLOT(slotUpdatePreviewFont())); + connect(m_previewFontUpdateTimer, &QTimer::timeout, + this, &FontPanel::slotUpdatePreviewFont); m_previewFontUpdateTimer->setInterval(0); m_previewFontUpdateTimer->setSingleShot(true); } |