From 78700eee5737f2e3ed9de9bc688ac8913aeafff2 Mon Sep 17 00:00:00 2001 From: mpeco Date: Mon, 22 Aug 2022 23:28:58 -0300 Subject: [PATCH] functor-based Qt signal-slot syntax construction set --- apps/opencs/editor.cpp | 55 +++--- apps/opencs/model/doc/document.cpp | 22 ++- apps/opencs/model/doc/documentmanager.cpp | 28 +-- apps/opencs/model/doc/loader.cpp | 2 +- apps/opencs/model/doc/operation.cpp | 2 +- apps/opencs/model/doc/operationholder.cpp | 19 +- apps/opencs/model/doc/runner.cpp | 10 +- apps/opencs/model/prefs/boolsetting.cpp | 2 +- apps/opencs/model/prefs/coloursetting.cpp | 2 +- apps/opencs/model/prefs/doublesetting.cpp | 2 +- apps/opencs/model/prefs/enumsetting.cpp | 2 +- apps/opencs/model/prefs/intsetting.cpp | 2 +- apps/opencs/model/prefs/modifiersetting.cpp | 2 +- apps/opencs/model/prefs/shortcut.cpp | 8 +- .../model/prefs/shortcuteventhandler.cpp | 2 +- apps/opencs/model/prefs/shortcutsetting.cpp | 2 +- apps/opencs/model/prefs/stringsetting.cpp | 2 +- apps/opencs/model/tools/tools.cpp | 23 ++- apps/opencs/model/world/actoradapter.cpp | 36 ++-- apps/opencs/model/world/data.cpp | 9 +- apps/opencs/model/world/idtableproxymodel.cpp | 22 +-- .../model/world/nestedtableproxymodel.cpp | 28 +-- apps/opencs/model/world/regionmap.cpp | 24 +-- apps/opencs/view/doc/filedialog.cpp | 29 +-- apps/opencs/view/doc/filewidget.cpp | 2 +- .../view/doc/globaldebugprofilemenu.cpp | 14 +- apps/opencs/view/doc/loader.cpp | 10 +- apps/opencs/view/doc/newgame.cpp | 9 +- apps/opencs/view/doc/operation.cpp | 2 +- apps/opencs/view/doc/operations.cpp | 2 +- apps/opencs/view/doc/startup.cpp | 8 +- apps/opencs/view/doc/view.cpp | 169 +++++++++--------- apps/opencs/view/doc/viewmanager.cpp | 70 ++++---- apps/opencs/view/filter/editwidget.cpp | 19 +- apps/opencs/view/filter/filterbox.cpp | 5 +- apps/opencs/view/filter/recordfilterbox.cpp | 5 +- apps/opencs/view/prefs/dialogue.cpp | 4 +- apps/opencs/view/prefs/keybindingpage.cpp | 5 +- apps/opencs/view/render/actor.cpp | 4 +- apps/opencs/view/render/cameracontroller.cpp | 64 ++++--- apps/opencs/view/render/cellwater.cpp | 3 +- apps/opencs/view/render/instancemode.cpp | 22 ++- .../view/render/instanceselectionmode.cpp | 4 +- apps/opencs/view/render/orbitcameramode.cpp | 5 +- .../view/render/pagedworldspacewidget.cpp | 59 +++--- .../view/render/pathgridselectionmode.cpp | 4 +- apps/opencs/view/render/previewwidget.cpp | 20 +-- apps/opencs/view/render/scenewidget.cpp | 17 +- apps/opencs/view/render/selectionmode.cpp | 6 +- apps/opencs/view/render/terrainshapemode.cpp | 12 +- .../opencs/view/render/terraintexturemode.cpp | 20 +-- .../view/render/unpagedworldspacewidget.cpp | 12 +- apps/opencs/view/render/worldspacewidget.cpp | 83 +++++---- apps/opencs/view/tools/merge.cpp | 9 +- apps/opencs/view/tools/reportsubview.cpp | 10 +- apps/opencs/view/tools/reporttable.cpp | 12 +- apps/opencs/view/tools/searchbox.cpp | 26 +-- apps/opencs/view/tools/searchsubview.cpp | 26 ++- apps/opencs/view/widget/coloreditor.cpp | 4 +- apps/opencs/view/widget/colorpickerpopup.cpp | 6 +- apps/opencs/view/widget/pushbutton.cpp | 6 +- apps/opencs/view/widget/scenetool.cpp | 2 +- apps/opencs/view/widget/scenetoolbar.cpp | 3 +- apps/opencs/view/widget/scenetoolmode.cpp | 2 +- apps/opencs/view/widget/scenetoolrun.cpp | 3 +- .../view/widget/scenetoolshapebrush.cpp | 17 +- .../view/widget/scenetooltexturebrush.cpp | 17 +- apps/opencs/view/widget/scenetooltoggle.cpp | 2 +- apps/opencs/view/widget/scenetooltoggle2.cpp | 2 +- apps/opencs/view/world/bodypartcreator.cpp | 2 +- apps/opencs/view/world/cellcreator.cpp | 8 +- apps/opencs/view/world/dialoguesubview.cpp | 74 ++++---- .../world/extendedcommandconfigurator.cpp | 10 +- apps/opencs/view/world/genericcreator.cpp | 13 +- apps/opencs/view/world/infocreator.cpp | 2 +- apps/opencs/view/world/landcreator.cpp | 4 +- apps/opencs/view/world/landtexturecreator.cpp | 5 +- apps/opencs/view/world/nestedtable.cpp | 10 +- apps/opencs/view/world/pathgridcreator.cpp | 2 +- apps/opencs/view/world/previewsubview.cpp | 13 +- apps/opencs/view/world/recordbuttonbar.cpp | 30 ++-- .../view/world/referenceablecreator.cpp | 8 +- apps/opencs/view/world/referencecreator.cpp | 2 +- apps/opencs/view/world/regionmap.cpp | 16 +- apps/opencs/view/world/regionmapsubview.cpp | 3 +- apps/opencs/view/world/scenesubview.cpp | 36 ++-- apps/opencs/view/world/scriptedit.cpp | 22 +-- apps/opencs/view/world/scripterrortable.cpp | 6 +- apps/opencs/view/world/scriptsubview.cpp | 28 ++- apps/opencs/view/world/startscriptcreator.cpp | 2 +- apps/opencs/view/world/table.cpp | 48 ++--- apps/opencs/view/world/tablebottombox.cpp | 10 +- apps/opencs/view/world/tablesubview.cpp | 51 +++--- 93 files changed, 774 insertions(+), 772 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 55627178e0..1db49ecf28 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -44,34 +44,31 @@ CS::Editor::Editor (int argc, char **argv) mFileDialog.setLocalData (mLocal); mMerge.setLocalData (mLocal); - connect (&mDocumentManager, SIGNAL (documentAdded (CSMDoc::Document *)), - this, SLOT (documentAdded (CSMDoc::Document *))); - connect (&mDocumentManager, SIGNAL (documentAboutToBeRemoved (CSMDoc::Document *)), - this, SLOT (documentAboutToBeRemoved (CSMDoc::Document *))); - connect (&mDocumentManager, SIGNAL (lastDocumentDeleted()), - this, SLOT (lastDocumentDeleted())); - - connect (mViewManager, SIGNAL (newGameRequest ()), this, SLOT (createGame ())); - connect (mViewManager, SIGNAL (newAddonRequest ()), this, SLOT (createAddon ())); - connect (mViewManager, SIGNAL (loadDocumentRequest ()), this, SLOT (loadDocument ())); - connect (mViewManager, SIGNAL (editSettingsRequest()), this, SLOT (showSettings ())); - connect (mViewManager, SIGNAL (mergeDocument (CSMDoc::Document *)), this, SLOT (mergeDocument (CSMDoc::Document *))); - - connect (&mStartup, SIGNAL (createGame()), this, SLOT (createGame ())); - connect (&mStartup, SIGNAL (createAddon()), this, SLOT (createAddon ())); - connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ())); - connect (&mStartup, SIGNAL (editConfig()), this, SLOT (showSettings ())); - - connect (&mFileDialog, SIGNAL(signalOpenFiles (const boost::filesystem::path&)), - this, SLOT(openFiles (const boost::filesystem::path&))); - - connect (&mFileDialog, SIGNAL(signalCreateNewFile (const boost::filesystem::path&)), - this, SLOT(createNewFile (const boost::filesystem::path&))); - connect (&mFileDialog, SIGNAL (rejected()), this, SLOT (cancelFileDialog ())); - - connect (&mNewGame, SIGNAL (createRequest (const boost::filesystem::path&)), - this, SLOT (createNewGame (const boost::filesystem::path&))); - connect (&mNewGame, SIGNAL (cancelCreateGame()), this, SLOT (cancelCreateGame ())); + connect (&mDocumentManager, &CSMDoc::DocumentManager::documentAdded, + this, &Editor::documentAdded); + connect (&mDocumentManager, &CSMDoc::DocumentManager::documentAboutToBeRemoved, + this, &Editor::documentAboutToBeRemoved); + connect (&mDocumentManager, &CSMDoc::DocumentManager::lastDocumentDeleted, + this, &Editor::lastDocumentDeleted); + + connect (mViewManager, &CSVDoc::ViewManager::newGameRequest, this, &Editor::createGame); + connect (mViewManager, &CSVDoc::ViewManager::newAddonRequest, this, &Editor::createAddon); + connect (mViewManager, &CSVDoc::ViewManager::loadDocumentRequest, this, &Editor::loadDocument); + connect (mViewManager, &CSVDoc::ViewManager::editSettingsRequest, this, &Editor::showSettings); + connect (mViewManager, &CSVDoc::ViewManager::mergeDocument, this, &Editor::mergeDocument); + + connect (&mStartup, &CSVDoc::StartupDialogue::createGame, this, &Editor::createGame); + connect (&mStartup, &CSVDoc::StartupDialogue::createAddon, this, &Editor::createAddon); + connect (&mStartup, &CSVDoc::StartupDialogue::loadDocument, this, &Editor::loadDocument); + connect (&mStartup, &CSVDoc::StartupDialogue::editConfig, this, &Editor::showSettings); + + connect (&mFileDialog, &CSVDoc::FileDialog::signalOpenFiles, + this, [this](const boost::filesystem::path &savePath){ this->openFiles(savePath); }); + connect (&mFileDialog, &CSVDoc::FileDialog::signalCreateNewFile, this, &Editor::createNewFile); + connect (&mFileDialog, &CSVDoc::FileDialog::rejected, this, &Editor::cancelFileDialog); + + connect (&mNewGame, &CSVDoc::NewGameDialogue::createRequest, this, &Editor::createNewGame); + connect (&mNewGame, &CSVDoc::NewGameDialogue::cancelCreateGame, this, &Editor::cancelCreateGame); } CS::Editor::~Editor () @@ -343,7 +340,7 @@ bool CS::Editor::makeIPCServer() if(mServer->listen(mIpcServerName)) { - connect(mServer, SIGNAL(newConnection()), this, SLOT(showStartup())); + connect(mServer, &QLocalServer::newConnection, this, &Editor::showStartup); return true; } diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 034586a60c..bf6858c52e 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -325,22 +325,20 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, addOptionalGlobals(); addOptionalMagicEffects(); - connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool))); + connect (&mUndoStack, &QUndoStack::cleanChanged, this, &Document::modificationStateChanged); - connect (&mTools, SIGNAL (progress (int, int, int)), this, SLOT (progress (int, int, int))); - connect (&mTools, SIGNAL (done (int, bool)), this, SIGNAL (operationDone (int, bool))); - connect (&mTools, SIGNAL (done (int, bool)), this, SLOT (operationDone2 (int, bool))); - connect (&mTools, SIGNAL (mergeDone (CSMDoc::Document*)), - this, SIGNAL (mergeDone (CSMDoc::Document*))); + connect (&mTools, &CSMTools::Tools::progress, this, qOverload(&Document::progress)); + connect (&mTools, &CSMTools::Tools::done, this, &Document::operationDone); + connect (&mTools, &CSMTools::Tools::done, this, &Document::operationDone2); + connect (&mTools, &CSMTools::Tools::mergeDone, this, &Document::mergeDone); - connect (&mSaving, SIGNAL (progress (int, int, int)), this, SLOT (progress (int, int, int))); - connect (&mSaving, SIGNAL (done (int, bool)), this, SLOT (operationDone2 (int, bool))); + connect (&mSaving, &OperationHolder::progress, + this, qOverload(&Document::progress)); + connect (&mSaving, &OperationHolder::done, this, &Document::operationDone2); - connect ( - &mSaving, SIGNAL (reportMessage (const CSMDoc::Message&, int)), - this, SLOT (reportMessage (const CSMDoc::Message&, int))); + connect (&mSaving, &OperationHolder::reportMessage, this, &Document::reportMessage); - connect (&mRunner, SIGNAL (runStateChanged()), this, SLOT (runStateChanged())); + connect (&mRunner, &Runner::runStateChanged, this, &Document::runStateChanged); } CSMDoc::Document::~Document() diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index d70301ac54..23ee0c425c 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -19,20 +19,20 @@ CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& con mLoader.moveToThread (&mLoaderThread); mLoaderThread.start(); - connect (&mLoader, SIGNAL (documentLoaded (Document *)), - this, SLOT (documentLoaded (Document *))); - connect (&mLoader, SIGNAL (documentNotLoaded (Document *, const std::string&)), - this, SLOT (documentNotLoaded (Document *, const std::string&))); - connect (this, SIGNAL (loadRequest (CSMDoc::Document *)), - &mLoader, SLOT (loadDocument (CSMDoc::Document *))); - connect (&mLoader, SIGNAL (nextStage (CSMDoc::Document *, const std::string&, int)), - this, SIGNAL (nextStage (CSMDoc::Document *, const std::string&, int))); - connect (&mLoader, SIGNAL (nextRecord (CSMDoc::Document *, int)), - this, SIGNAL (nextRecord (CSMDoc::Document *, int))); - connect (this, SIGNAL (cancelLoading (CSMDoc::Document *)), - &mLoader, SLOT (abortLoading (CSMDoc::Document *))); - connect (&mLoader, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&)), - this, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&))); + connect (&mLoader, &Loader::documentLoaded, + this, &DocumentManager::documentLoaded); + connect (&mLoader, &Loader::documentNotLoaded, + this, &DocumentManager::documentNotLoaded); + connect (this, &DocumentManager::loadRequest, + &mLoader, &Loader::loadDocument); + connect (&mLoader, &Loader::nextStage, + this, &DocumentManager::nextStage); + connect (&mLoader, &Loader::nextRecord, + this, &DocumentManager::nextRecord); + connect (this, &DocumentManager::cancelLoading, + &mLoader, &Loader::abortLoading); + connect (&mLoader, &Loader::loadMessage, + this, &DocumentManager::loadMessage); } CSMDoc::DocumentManager::~DocumentManager() diff --git a/apps/opencs/model/doc/loader.cpp b/apps/opencs/model/doc/loader.cpp index 9d2f89b8e9..2ec556a018 100644 --- a/apps/opencs/model/doc/loader.cpp +++ b/apps/opencs/model/doc/loader.cpp @@ -14,7 +14,7 @@ CSMDoc::Loader::Loader() { mTimer = new QTimer (this); - connect (mTimer, SIGNAL (timeout()), this, SLOT (load())); + connect (mTimer, &QTimer::timeout, this, &Loader::load); mTimer->start(); } diff --git a/apps/opencs/model/doc/operation.cpp b/apps/opencs/model/doc/operation.cpp index 369c6bb105..21db0e04b9 100644 --- a/apps/opencs/model/doc/operation.cpp +++ b/apps/opencs/model/doc/operation.cpp @@ -45,7 +45,7 @@ void CSMDoc::Operation::run() if (!mConnected) { - connect (mTimer, SIGNAL (timeout()), this, SLOT (executeStage())); + connect (mTimer, &QTimer::timeout, this, &Operation::executeStage); mConnected = true; } diff --git a/apps/opencs/model/doc/operationholder.cpp b/apps/opencs/model/doc/operationholder.cpp index 0fd2bef957..a392a6d73c 100644 --- a/apps/opencs/model/doc/operationholder.cpp +++ b/apps/opencs/model/doc/operationholder.cpp @@ -15,21 +15,18 @@ void CSMDoc::OperationHolder::setOperation (Operation *operation) mOperation = operation; mOperation->moveToThread (&mThread); - connect ( - mOperation, SIGNAL (progress (int, int, int)), - this, SIGNAL (progress (int, int, int))); + connect (mOperation, &Operation::progress, + this, &OperationHolder::progress); - connect ( - mOperation, SIGNAL (reportMessage (const CSMDoc::Message&, int)), - this, SIGNAL (reportMessage (const CSMDoc::Message&, int))); + connect (mOperation, &Operation::reportMessage, + this, &OperationHolder::reportMessage); - connect ( - mOperation, SIGNAL (done (int, bool)), - this, SLOT (doneSlot (int, bool))); + connect (mOperation, &Operation::done, + this, &OperationHolder::doneSlot); - connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort())); + connect (this, &OperationHolder::abortSignal, mOperation, &Operation::abort); - connect (&mThread, SIGNAL (started()), mOperation, SLOT (run())); + connect (&mThread, &QThread::started, mOperation, &Operation::run); } bool CSMDoc::OperationHolder::isRunning() const diff --git a/apps/opencs/model/doc/runner.cpp b/apps/opencs/model/doc/runner.cpp index 3b2178ce7c..3bb5c13662 100644 --- a/apps/opencs/model/doc/runner.cpp +++ b/apps/opencs/model/doc/runner.cpp @@ -10,11 +10,11 @@ CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath) : mRunning (false), mStartup (nullptr), mProjectPath (projectPath) { - connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)), - this, SLOT (finished (int, QProcess::ExitStatus))); + connect (&mProcess, qOverload(&QProcess::finished), + this, &Runner::finished); - connect (&mProcess, SIGNAL (readyReadStandardOutput()), - this, SLOT (readyReadStandardOutput())); + connect (&mProcess, &QProcess::readyReadStandardOutput, + this, &Runner::readyReadStandardOutput); mProcess.setProcessChannelMode (QProcess::MergedChannels); @@ -149,7 +149,7 @@ void CSMDoc::Runner::readyReadStandardOutput() CSMDoc::SaveWatcher::SaveWatcher (Runner *runner, OperationHolder *operation) : QObject (runner), mRunner (runner) { - connect (operation, SIGNAL (done (int, bool)), this, SLOT (saveDone (int, bool))); + connect (operation, &OperationHolder::done, this, &SaveWatcher::saveDone); } void CSMDoc::SaveWatcher::saveDone (int type, bool failed) diff --git a/apps/opencs/model/prefs/boolsetting.cpp b/apps/opencs/model/prefs/boolsetting.cpp index 2ef141b0d3..afd80be99d 100644 --- a/apps/opencs/model/prefs/boolsetting.cpp +++ b/apps/opencs/model/prefs/boolsetting.cpp @@ -30,7 +30,7 @@ std::pair CSMPrefs::BoolSetting::makeWidgets (QWidget *par mWidget->setToolTip (tooltip); } - connect (mWidget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, &QCheckBox::stateChanged, this, &BoolSetting::valueChanged); return std::make_pair (static_cast (nullptr), mWidget); } diff --git a/apps/opencs/model/prefs/coloursetting.cpp b/apps/opencs/model/prefs/coloursetting.cpp index 569a759632..6849d51aad 100644 --- a/apps/opencs/model/prefs/coloursetting.cpp +++ b/apps/opencs/model/prefs/coloursetting.cpp @@ -35,7 +35,7 @@ std::pair CSMPrefs::ColourSetting::makeWidgets (QWidget *p mWidget->setToolTip (tooltip); } - connect (mWidget, SIGNAL (pickingFinished()), this, SLOT (valueChanged())); + connect (mWidget, &CSVWidget::ColorEditor::pickingFinished, this, &ColourSetting::valueChanged); return std::make_pair (label, mWidget); } diff --git a/apps/opencs/model/prefs/doublesetting.cpp b/apps/opencs/model/prefs/doublesetting.cpp index d8253353b5..64e961eb9b 100644 --- a/apps/opencs/model/prefs/doublesetting.cpp +++ b/apps/opencs/model/prefs/doublesetting.cpp @@ -66,7 +66,7 @@ std::pair CSMPrefs::DoubleSetting::makeWidgets (QWidget *p mWidget->setToolTip (tooltip); } - connect (mWidget, SIGNAL (valueChanged (double)), this, SLOT (valueChanged (double))); + connect (mWidget, qOverload(&QDoubleSpinBox::valueChanged), this, &DoubleSetting::valueChanged); return std::make_pair (label, mWidget); } diff --git a/apps/opencs/model/prefs/enumsetting.cpp b/apps/opencs/model/prefs/enumsetting.cpp index 096c9aab38..a11f84a993 100644 --- a/apps/opencs/model/prefs/enumsetting.cpp +++ b/apps/opencs/model/prefs/enumsetting.cpp @@ -97,7 +97,7 @@ std::pair CSMPrefs::EnumSetting::makeWidgets (QWidget *par label->setToolTip (tooltip); } - connect (mWidget, SIGNAL (currentIndexChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, qOverload(&QComboBox::currentIndexChanged), this, &EnumSetting::valueChanged); return std::make_pair (label, mWidget); } diff --git a/apps/opencs/model/prefs/intsetting.cpp b/apps/opencs/model/prefs/intsetting.cpp index b3d4a66334..efc1d954ef 100644 --- a/apps/opencs/model/prefs/intsetting.cpp +++ b/apps/opencs/model/prefs/intsetting.cpp @@ -58,7 +58,7 @@ std::pair CSMPrefs::IntSetting::makeWidgets (QWidget *pare mWidget->setToolTip (tooltip); } - connect (mWidget, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); + connect (mWidget, qOverload(&QSpinBox::valueChanged), this, &IntSetting::valueChanged); return std::make_pair (label, mWidget); } diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index 606cece2bc..aa8b651547 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -40,7 +40,7 @@ namespace CSMPrefs mButton = widget; - connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool))); + connect (widget, &QPushButton::toggled, this, &ModifierSetting::buttonToggled); return std::make_pair(label, widget); } diff --git a/apps/opencs/model/prefs/shortcut.cpp b/apps/opencs/model/prefs/shortcut.cpp index ff7b949a4a..130553a0f2 100644 --- a/apps/opencs/model/prefs/shortcut.cpp +++ b/apps/opencs/model/prefs/shortcut.cpp @@ -176,8 +176,8 @@ namespace CSMPrefs { mAction->setText(mActionText); - disconnect(this, SIGNAL(activated()), mAction, SLOT(trigger())); - disconnect(mAction, SIGNAL(destroyed()), this, SLOT(actionDeleted())); + disconnect(this, qOverload<>(&Shortcut::activated), mAction, &QAction::trigger); + disconnect(mAction, &QAction::destroyed, this, &Shortcut::actionDeleted); } mAction = action; @@ -187,8 +187,8 @@ namespace CSMPrefs mActionText = mAction->text(); mAction->setText(mActionText + "\t" + State::get().getShortcutManager().convertToString(mSequence).data()); - connect(this, SIGNAL(activated()), mAction, SLOT(trigger())); - connect(mAction, SIGNAL(destroyed()), this, SLOT(actionDeleted())); + connect(this, qOverload<>(&Shortcut::activated), mAction, &QAction::trigger); + connect(mAction, &QAction::destroyed, this, &Shortcut::actionDeleted); } } diff --git a/apps/opencs/model/prefs/shortcuteventhandler.cpp b/apps/opencs/model/prefs/shortcuteventhandler.cpp index a4102e1db9..50fd336e8a 100644 --- a/apps/opencs/model/prefs/shortcuteventhandler.cpp +++ b/apps/opencs/model/prefs/shortcuteventhandler.cpp @@ -34,7 +34,7 @@ namespace CSMPrefs // Intercept widget events widget->installEventFilter(this); - connect(widget, SIGNAL(destroyed()), this, SLOT(widgetDestroyed())); + connect(widget, &QWidget::destroyed, this, &ShortcutEventHandler::widgetDestroyed); } // Add to list diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index 622c182dce..0d5f9c039a 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -46,7 +46,7 @@ namespace CSMPrefs mButton = widget; - connect(widget, SIGNAL(toggled(bool)), this, SLOT(buttonToggled(bool))); + connect(widget, &QPushButton::toggled, this, &ShortcutSetting::buttonToggled); return std::make_pair(label, widget); } diff --git a/apps/opencs/model/prefs/stringsetting.cpp b/apps/opencs/model/prefs/stringsetting.cpp index c062e23465..4b3b943904 100644 --- a/apps/opencs/model/prefs/stringsetting.cpp +++ b/apps/opencs/model/prefs/stringsetting.cpp @@ -30,7 +30,7 @@ std::pair CSMPrefs::StringSetting::makeWidgets (QWidget *p mWidget->setToolTip (tooltip); } - connect (mWidget, SIGNAL (textChanged (QString)), this, SLOT (textChanged (QString))); + connect (mWidget, &QLineEdit::textChanged, this, &StringSetting::textChanged); return std::make_pair (static_cast (nullptr), mWidget); } diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index 07e0cc038e..a04332a5ae 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -55,10 +55,10 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier() { mVerifierOperation = new CSMDoc::Operation (CSMDoc::State_Verifying, false); - connect (&mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int))); - connect (&mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool))); - connect (&mVerifier, SIGNAL (reportMessage (const CSMDoc::Message&, int)), - this, SLOT (verifierMessage (const CSMDoc::Message&, int))); + connect (&mVerifier, &CSMDoc::OperationHolder::progress, this, &Tools::progress); + connect (&mVerifier, &CSMDoc::OperationHolder::done, this, &Tools::done); + connect (&mVerifier, &CSMDoc::OperationHolder::reportMessage, + this, &Tools::verifierMessage); std::vector mandatoryIds {"Day", "DaysPassed", "GameHour", "Month", "PCRace"}; @@ -143,13 +143,13 @@ CSMTools::Tools::Tools (CSMDoc::Document& document, ToUTF8::FromType encoding) mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel)); mActiveReports.insert (std::make_pair (CSMDoc::State_Loading, 0)); - connect (&mSearch, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int))); - connect (&mSearch, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool))); - connect (&mSearch, SIGNAL (reportMessage (const CSMDoc::Message&, int)), - this, SLOT (verifierMessage (const CSMDoc::Message&, int))); + connect (&mSearch, &CSMDoc::OperationHolder::progress, this, &Tools::progress); + connect (&mSearch, &CSMDoc::OperationHolder::done, this, &Tools::done); + connect (&mSearch, &CSMDoc::OperationHolder::reportMessage, + this, &Tools::verifierMessage); - connect (&mMerge, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int))); - connect (&mMerge, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool))); + connect (&mMerge, &CSMDoc::OperationHolder::progress, this, &Tools::progress); + connect (&mMerge, &CSMDoc::OperationHolder::done, this, &Tools::done); // don't need to connect report message, since there are no messages for merge } @@ -222,8 +222,7 @@ void CSMTools::Tools::runMerge (std::unique_ptr target) { mMergeOperation = new MergeOperation (mDocument, mEncoding); mMerge.setOperation (mMergeOperation); - connect (mMergeOperation, SIGNAL (mergeDone (CSMDoc::Document*)), - this, SIGNAL (mergeDone (CSMDoc::Document*))); + connect (mMergeOperation, &MergeOperation::mergeDone, this, &Tools::mergeDone); } target->flagAsDirty(); diff --git a/apps/opencs/model/world/actoradapter.cpp b/apps/opencs/model/world/actoradapter.cpp index e6a193b3e0..e1c457943d 100644 --- a/apps/opencs/model/world/actoradapter.cpp +++ b/apps/opencs/model/world/actoradapter.cpp @@ -194,28 +194,28 @@ namespace CSMWorld { // Setup qt slots and signals QAbstractItemModel* refModel = data.getTableModel(UniversalId::Type_Referenceable); - connect(refModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(handleReferenceablesInserted(const QModelIndex&, int, int))); - connect(refModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(handleReferenceableChanged(const QModelIndex&, const QModelIndex&))); - connect(refModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), - this, SLOT(handleReferenceablesAboutToBeRemoved(const QModelIndex&, int, int))); + connect(refModel, &QAbstractItemModel::rowsInserted, + this, &ActorAdapter::handleReferenceablesInserted); + connect(refModel, &QAbstractItemModel::dataChanged, + this, &ActorAdapter::handleReferenceableChanged); + connect(refModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ActorAdapter::handleReferenceablesAboutToBeRemoved); QAbstractItemModel* raceModel = data.getTableModel(UniversalId::Type_Race); - connect(raceModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(handleRacesAboutToBeRemoved(const QModelIndex&, int, int))); - connect(raceModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(handleRaceChanged(const QModelIndex&, const QModelIndex&))); - connect(raceModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), - this, SLOT(handleRacesAboutToBeRemoved(const QModelIndex&, int, int))); + connect(raceModel, &QAbstractItemModel::rowsInserted, + this, &ActorAdapter::handleRacesAboutToBeRemoved); + connect(raceModel, &QAbstractItemModel::dataChanged, + this, &ActorAdapter::handleRaceChanged); + connect(raceModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ActorAdapter::handleRacesAboutToBeRemoved); QAbstractItemModel* partModel = data.getTableModel(UniversalId::Type_BodyPart); - connect(partModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)), - this, SLOT(handleBodyPartsInserted(const QModelIndex&, int, int))); - connect(partModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(handleBodyPartChanged(const QModelIndex&, const QModelIndex&))); - connect(partModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), - this, SLOT(handleBodyPartsAboutToBeRemoved(const QModelIndex&, int, int))); + connect(partModel, &QAbstractItemModel::rowsInserted, + this, &ActorAdapter::handleBodyPartsInserted); + connect(partModel, &QAbstractItemModel::dataChanged, + this, &ActorAdapter::handleBodyPartChanged); + connect(partModel, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &ActorAdapter::handleBodyPartsAboutToBeRemoved); } ActorAdapter::ActorDataPtr ActorAdapter::getActorData(const std::string& id) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 183b7c92e7..d2d6cbdc13 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -38,12 +38,9 @@ void CSMWorld::Data::addModel (QAbstractItemModel *model, UniversalId::Type type if (update) { - connect (model, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (dataChanged (const QModelIndex&, const QModelIndex&))); - connect (model, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (rowsChanged (const QModelIndex&, int, int))); - connect (model, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (rowsChanged (const QModelIndex&, int, int))); + connect (model, &QAbstractItemModel::dataChanged, this, &Data::dataChanged); + connect (model, &QAbstractItemModel::rowsInserted, this, &Data::rowsChanged); + connect (model, &QAbstractItemModel::rowsRemoved, this, &Data::rowsChanged); } } diff --git a/apps/opencs/model/world/idtableproxymodel.cpp b/apps/opencs/model/world/idtableproxymodel.cpp index 7cc00ae29e..d0e7bd8a59 100644 --- a/apps/opencs/model/world/idtableproxymodel.cpp +++ b/apps/opencs/model/world/idtableproxymodel.cpp @@ -26,7 +26,7 @@ void CSMWorld::IdTableProxyModel::updateColumnMap() { std::vector columns = mFilter->getReferencedColumns(); for (std::vector::const_iterator iter (columns.begin()); iter!=columns.end(); ++iter) - mColumnMap.insert (std::make_pair (*iter, + mColumnMap.insert (std::make_pair (*iter, mSourceModel->searchColumnIndex (static_cast (*iter)))); } } @@ -51,7 +51,7 @@ bool CSMWorld::IdTableProxyModel::filterAcceptsRow (int sourceRow, const QModelI } CSMWorld::IdTableProxyModel::IdTableProxyModel (QObject *parent) - : QSortFilterProxyModel (parent), + : QSortFilterProxyModel (parent), mSourceModel(nullptr) { setSortCaseSensitivity (Qt::CaseInsensitive); @@ -69,18 +69,12 @@ void CSMWorld::IdTableProxyModel::setSourceModel(QAbstractItemModel *model) QSortFilterProxyModel::setSourceModel(model); mSourceModel = dynamic_cast(sourceModel()); - connect(mSourceModel, - SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, - SLOT(sourceRowsInserted(const QModelIndex &, int, int))); - connect(mSourceModel, - SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, - SLOT(sourceRowsRemoved(const QModelIndex &, int, int))); - connect(mSourceModel, - SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, - SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &))); + connect(mSourceModel, &IdTableBase::rowsInserted, + this, &IdTableProxyModel::sourceRowsInserted); + connect(mSourceModel, &IdTableBase::rowsRemoved, + this, &IdTableProxyModel::sourceRowsRemoved); + connect(mSourceModel, &IdTableBase::dataChanged, + this, &IdTableProxyModel::sourceDataChanged); } void CSMWorld::IdTableProxyModel::setFilter (const std::shared_ptr& filter) diff --git a/apps/opencs/model/world/nestedtableproxymodel.cpp b/apps/opencs/model/world/nestedtableproxymodel.cpp index edcc7a0706..bb918ee685 100644 --- a/apps/opencs/model/world/nestedtableproxymodel.cpp +++ b/apps/opencs/model/world/nestedtableproxymodel.cpp @@ -15,26 +15,26 @@ CSMWorld::NestedTableProxyModel::NestedTableProxyModel(const QModelIndex& parent QAbstractProxyModel::setSourceModel(parentModel); - connect(mMainModel, SIGNAL(rowsAboutToBeInserted(const QModelIndex &, int, int)), - this, SLOT(forwardRowsAboutToInserted(const QModelIndex &, int, int))); + connect(mMainModel, &IdTree::rowsAboutToBeInserted, + this, &NestedTableProxyModel::forwardRowsAboutToInserted); - connect(mMainModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(forwardRowsInserted(const QModelIndex &, int, int))); + connect(mMainModel, &IdTree::rowsInserted, + this, &NestedTableProxyModel::forwardRowsInserted); - connect(mMainModel, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)), - this, SLOT(forwardRowsAboutToRemoved(const QModelIndex &, int, int))); + connect(mMainModel, &IdTree::rowsAboutToBeRemoved, + this, &NestedTableProxyModel::forwardRowsAboutToRemoved); - connect(mMainModel, SIGNAL(rowsRemoved(const QModelIndex &, int, int)), - this, SLOT(forwardRowsRemoved(const QModelIndex &, int, int))); + connect(mMainModel, &IdTree::rowsRemoved, + this, &NestedTableProxyModel::forwardRowsRemoved); - connect(mMainModel, SIGNAL(resetStart(const QString&)), - this, SLOT(forwardResetStart(const QString&))); + connect(mMainModel, &IdTree::resetStart, + this, &NestedTableProxyModel::forwardResetStart); - connect(mMainModel, SIGNAL(resetEnd(const QString&)), - this, SLOT(forwardResetEnd(const QString&))); + connect(mMainModel, &IdTree::resetEnd, + this, &NestedTableProxyModel::forwardResetEnd); - connect(mMainModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(forwardDataChanged(const QModelIndex &, const QModelIndex &))); + connect(mMainModel, &IdTree::dataChanged, + this, &NestedTableProxyModel::forwardDataChanged); } QModelIndex CSMWorld::NestedTableProxyModel::mapFromSource(const QModelIndex& sourceIndex) const diff --git a/apps/opencs/model/world/regionmap.cpp b/apps/opencs/model/world/regionmap.cpp index 39a2fefadd..de1c34a5cc 100644 --- a/apps/opencs/model/world/regionmap.cpp +++ b/apps/opencs/model/world/regionmap.cpp @@ -280,21 +280,21 @@ CSMWorld::RegionMap::RegionMap (Data& data) : mData (data) QAbstractItemModel *regions = data.getTableModel (UniversalId (UniversalId::Type_Regions)); - connect (regions, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (regionsAboutToBeRemoved (const QModelIndex&, int, int))); - connect (regions, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (regionsInserted (const QModelIndex&, int, int))); - connect (regions, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (regionsChanged (const QModelIndex&, const QModelIndex&))); + connect (regions, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &RegionMap::regionsAboutToBeRemoved); + connect (regions, &QAbstractItemModel::rowsInserted, + this, &RegionMap::regionsInserted); + connect (regions, &QAbstractItemModel::dataChanged, + this, &RegionMap::regionsChanged); QAbstractItemModel *cells = data.getTableModel (UniversalId (UniversalId::Type_Cells)); - connect (cells, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (cellsAboutToBeRemoved (const QModelIndex&, int, int))); - connect (cells, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (cellsInserted (const QModelIndex&, int, int))); - connect (cells, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (cellsChanged (const QModelIndex&, const QModelIndex&))); + connect (cells, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &RegionMap::cellsAboutToBeRemoved); + connect (cells, &QAbstractItemModel::rowsInserted, + this, &RegionMap::cellsInserted); + connect (cells, &QAbstractItemModel::dataChanged, + this, &RegionMap::cellsChanged); } int CSMWorld::RegionMap::rowCount (const QModelIndex& parent) const diff --git a/apps/opencs/view/doc/filedialog.cpp b/apps/opencs/view/doc/filedialog.cpp index 1eca8d68a6..97ef0505c1 100644 --- a/apps/opencs/view/doc/filedialog.cpp +++ b/apps/opencs/view/doc/filedialog.cpp @@ -80,10 +80,10 @@ void CSVDoc::FileDialog::showDialog (ContentAction action) if(!mDialogBuilt) { //connections common to both dialog view flavors - connect (mSelector, SIGNAL (signalCurrentGamefileIndexChanged (int)), - this, SLOT (slotUpdateAcceptButton (int))); + connect (mSelector, &ContentSelectorView::ContentSelector::signalCurrentGamefileIndexChanged, + this, qOverload(&FileDialog::slotUpdateAcceptButton)); - connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected())); + connect (ui.projectButtonBox, &QDialogButtonBox::rejected, this, &FileDialog::slotRejected); mDialogBuilt = true; } @@ -107,16 +107,16 @@ void CSVDoc::FileDialog::buildNewFileView() mFileWidget->setType (true); mFileWidget->extensionLabelIsVisible(true); - connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)), - mAdjusterWidget, SLOT (setName (const QString&, bool))); + connect (mFileWidget, &FileWidget::nameChanged, + mAdjusterWidget, &AdjusterWidget::setName); - connect (mFileWidget, SIGNAL (nameChanged(const QString &, bool)), - this, SLOT (slotUpdateAcceptButton(const QString &, bool))); + connect (mFileWidget, &FileWidget::nameChanged, + this, qOverload(&FileDialog::slotUpdateAcceptButton)); } ui.projectGroupBoxLayout->insertWidget (0, mFileWidget); - connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile())); + connect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotNewFile); } void CSVDoc::FileDialog::buildOpenFileView() @@ -131,9 +131,10 @@ void CSVDoc::FileDialog::buildOpenFileView() if(!mDialogBuilt) { - connect (mSelector, SIGNAL (signalAddonDataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT (slotAddonDataChanged(const QModelIndex&, const QModelIndex&))); + connect (mSelector, &ContentSelectorView::ContentSelector::signalAddonDataChanged, + this, &FileDialog::slotAddonDataChanged); } - connect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile())); + connect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotOpenFile); } void CSVDoc::FileDialog::slotAddonDataChanged(const QModelIndex &topleft, const QModelIndex &bottomright) @@ -181,8 +182,8 @@ QString CSVDoc::FileDialog::filename() const void CSVDoc::FileDialog::slotRejected() { emit rejected(); - disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile())); - disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile())); + disconnect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotNewFile); + disconnect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotOpenFile); if(mFileWidget) { delete mFileWidget; @@ -199,7 +200,7 @@ void CSVDoc::FileDialog::slotNewFile() delete mFileWidget; mFileWidget = nullptr; } - disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile())); + disconnect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotNewFile); close(); } @@ -210,6 +211,6 @@ void CSVDoc::FileDialog::slotOpenFile() mAdjusterWidget->setName (file->filePath(), !file->isGameFile()); emit signalOpenFiles (mAdjusterWidget->getPath()); - disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotOpenFile())); + disconnect (ui.projectButtonBox, &QDialogButtonBox::accepted, this, &FileDialog::slotOpenFile); close(); } diff --git a/apps/opencs/view/doc/filewidget.cpp b/apps/opencs/view/doc/filewidget.cpp index 9e9acdfbe6..45ce08daad 100644 --- a/apps/opencs/view/doc/filewidget.cpp +++ b/apps/opencs/view/doc/filewidget.cpp @@ -23,7 +23,7 @@ CSVDoc::FileWidget::FileWidget (QWidget *parent) : QWidget (parent), mAddon (fal layout ->addWidget (mType); - connect (mInput, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&))); + connect (mInput, &QLineEdit::textChanged, this, &FileWidget::textChanged); setLayout (layout); } diff --git a/apps/opencs/view/doc/globaldebugprofilemenu.cpp b/apps/opencs/view/doc/globaldebugprofilemenu.cpp index c898b819c2..5990c179f3 100644 --- a/apps/opencs/view/doc/globaldebugprofilemenu.cpp +++ b/apps/opencs/view/doc/globaldebugprofilemenu.cpp @@ -36,7 +36,7 @@ void CSVDoc::GlobalDebugProfileMenu::rebuild() } mActions = new QActionGroup (this); - connect (mActions, SIGNAL (triggered (QAction *)), this, SLOT (actionTriggered (QAction *))); + connect (mActions, &QActionGroup::triggered, this, &GlobalDebugProfileMenu::actionTriggered); std::sort (ids.begin(), ids.end()); @@ -52,14 +52,14 @@ CSVDoc::GlobalDebugProfileMenu::GlobalDebugProfileMenu (CSMWorld::IdTable *debug { rebuild(); - connect (mDebugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (profileAboutToBeRemoved (const QModelIndex&, int, int))); + connect (mDebugProfiles, &CSMWorld::IdTable::rowsAboutToBeRemoved, + this, &GlobalDebugProfileMenu::profileAboutToBeRemoved); - connect (mDebugProfiles, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (profileInserted (const QModelIndex&, int, int))); + connect (mDebugProfiles, &CSMWorld::IdTable::rowsInserted, + this, &GlobalDebugProfileMenu::profileInserted); - connect (mDebugProfiles, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (profileChanged (const QModelIndex&, const QModelIndex&))); + connect (mDebugProfiles, &CSMWorld::IdTable::dataChanged, + this, &GlobalDebugProfileMenu::profileChanged); } void CSVDoc::GlobalDebugProfileMenu::updateActions (bool running) diff --git a/apps/opencs/view/doc/loader.cpp b/apps/opencs/view/doc/loader.cpp index 2420b87c6c..a33aa900fe 100644 --- a/apps/opencs/view/doc/loader.cpp +++ b/apps/opencs/view/doc/loader.cpp @@ -70,7 +70,7 @@ CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document) show(); - connect (mButtons, SIGNAL (rejected()), this, SLOT (cancel())); + connect (mButtons, &QDialogButtonBox::rejected, this, qOverload<>(&LoadingDocument::cancel)); } void CSVDoc::LoadingDocument::nextStage (const std::string& name, int fileRecords) @@ -146,10 +146,10 @@ void CSVDoc::Loader::add (CSMDoc::Document *document) LoadingDocument *loading = new LoadingDocument (document); mDocuments.insert (std::make_pair (document, loading)); - connect (loading, SIGNAL (cancel (CSMDoc::Document *)), - this, SIGNAL (cancel (CSMDoc::Document *))); - connect (loading, SIGNAL (close (CSMDoc::Document *)), - this, SIGNAL (close (CSMDoc::Document *))); + connect (loading, qOverload(&LoadingDocument::cancel), + this, &Loader::cancel); + connect (loading, &LoadingDocument::close, + this, &Loader::close); } void CSVDoc::Loader::loadingStopped (CSMDoc::Document *document, bool completed, diff --git a/apps/opencs/view/doc/newgame.cpp b/apps/opencs/view/doc/newgame.cpp index dc7e12423e..2ae3b5fe48 100644 --- a/apps/opencs/view/doc/newgame.cpp +++ b/apps/opencs/view/doc/newgame.cpp @@ -40,11 +40,10 @@ CSVDoc::NewGameDialogue::NewGameDialogue() setLayout (layout); - connect (mAdjusterWidget, SIGNAL (stateChanged (bool)), this, SLOT (stateChanged (bool))); - connect (mCreate, SIGNAL (clicked()), this, SLOT (create())); - connect (cancel, SIGNAL (clicked()), this, SLOT (reject())); - connect (mFileWidget, SIGNAL (nameChanged (const QString&, bool)), - mAdjusterWidget, SLOT (setName (const QString&, bool))); + connect (mAdjusterWidget, &AdjusterWidget::stateChanged, this, &NewGameDialogue::stateChanged); + connect (mCreate, &QPushButton::clicked, this, &NewGameDialogue::create); + connect (cancel, &QPushButton::clicked, this, &NewGameDialogue::reject); + connect (mFileWidget, &FileWidget::nameChanged, mAdjusterWidget, &AdjusterWidget::setName); QRect scr = QGuiApplication::primaryScreen()->geometry(); QRect rect = geometry(); diff --git a/apps/opencs/view/doc/operation.cpp b/apps/opencs/view/doc/operation.cpp index fe9ccf457f..6b0165b475 100644 --- a/apps/opencs/view/doc/operation.cpp +++ b/apps/opencs/view/doc/operation.cpp @@ -63,7 +63,7 @@ void CSVDoc::Operation::initWidgets() mLayout->addWidget (mProgressBar); mLayout->addWidget (mAbortButton); - connect (mAbortButton, SIGNAL (clicked()), this, SLOT (abortOperation())); + connect (mAbortButton, &QPushButton::clicked, this, qOverload<>(&Operation::abortOperation)); } void CSVDoc::Operation::setProgress (int current, int max, int threads) diff --git a/apps/opencs/view/doc/operations.cpp b/apps/opencs/view/doc/operations.cpp index 2177679b00..585184ae67 100644 --- a/apps/opencs/view/doc/operations.cpp +++ b/apps/opencs/view/doc/operations.cpp @@ -33,7 +33,7 @@ void CSVDoc::Operations::setProgress (int current, int max, int type, int thread int newCount = oldCount + 1; Operation *operation = new Operation (type, this); - connect (operation, SIGNAL (abortOperation (int)), this, SIGNAL (abortOperation (int))); + connect (operation, qOverload(&Operation::abortOperation), this, &Operations::abortOperation); mLayout->addLayout (operation->getLayout()); mOperations.push_back (operation); diff --git a/apps/opencs/view/doc/startup.cpp b/apps/opencs/view/doc/startup.cpp index df4701d8c1..4676284a17 100644 --- a/apps/opencs/view/doc/startup.cpp +++ b/apps/opencs/view/doc/startup.cpp @@ -41,13 +41,13 @@ QWidget *CSVDoc::StartupDialogue::createButtons() /// \todo add icons QPushButton *loadDocument = addButton ("Edit A Content File", QIcon (":startup/edit-content")); - connect (loadDocument, SIGNAL (clicked()), this, SIGNAL (loadDocument())); + connect (loadDocument, &QPushButton::clicked, this, &StartupDialogue::loadDocument); QPushButton *createAddon = addButton ("Create A New Addon", QIcon (":startup/create-addon")); - connect (createAddon, SIGNAL (clicked()), this, SIGNAL (createAddon())); + connect (createAddon, &QPushButton::clicked, this, &StartupDialogue::createAddon); QPushButton *createGame = addButton ("Create A New Game", QIcon (":startup/create-game")); - connect (createGame, SIGNAL (clicked()), this, SIGNAL (createGame())); + connect (createGame, &QPushButton::clicked, this, &StartupDialogue::createGame); for (int i=0; i<3; ++i) mLayout->setColumnMinimumWidth (i, mWidth); @@ -88,7 +88,7 @@ QWidget *CSVDoc::StartupDialogue::createTools() widget->setLayout (layout); - connect (config, SIGNAL (clicked()), this, SIGNAL (editConfig())); + connect (config, &QPushButton::clicked, this, &StartupDialogue::editConfig); return widget; } diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 3f29e69a23..31c8c1f274 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -54,43 +54,43 @@ void CSVDoc::View::setupFileMenu() QMenu *file = menuBar()->addMenu (tr ("File")); QAction* newGame = createMenuEntry("New Game", ":./menu-new-game.png", file, "document-file-newgame"); - connect (newGame, SIGNAL (triggered()), this, SIGNAL (newGameRequest())); + connect (newGame, &QAction::triggered, this, &View::newGameRequest); QAction* newAddon = createMenuEntry("New Addon", ":./menu-new-addon.png", file, "document-file-newaddon"); - connect (newAddon, SIGNAL (triggered()), this, SIGNAL (newAddonRequest())); + connect (newAddon, &QAction::triggered, this, &View::newAddonRequest); QAction* open = createMenuEntry("Open", ":./menu-open.png", file, "document-file-open"); - connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest())); + connect (open, &QAction::triggered, this, &View::loadDocumentRequest); QAction* save = createMenuEntry("Save", ":./menu-save.png", file, "document-file-save"); - connect (save, SIGNAL (triggered()), this, SLOT (save())); + connect (save, &QAction::triggered, this, &View::save); mSave = save; - + file->addSeparator(); QAction* verify = createMenuEntry("Verify", ":./menu-verify.png", file, "document-file-verify"); - connect (verify, SIGNAL (triggered()), this, SLOT (verify())); + connect (verify, &QAction::triggered, this, &View::verify); mVerify = verify; QAction* merge = createMenuEntry("Merge", ":./menu-merge.png", file, "document-file-merge"); - connect (merge, SIGNAL (triggered()), this, SLOT (merge())); + connect (merge, &QAction::triggered, this, &View::merge); mMerge = merge; QAction* loadErrors = createMenuEntry("Error Log", ":./error-log.png", file, "document-file-errorlog"); - connect (loadErrors, SIGNAL (triggered()), this, SLOT (loadErrorLog())); + connect (loadErrors, &QAction::triggered, this, &View::loadErrorLog); QAction* meta = createMenuEntry(CSMWorld::UniversalId::Type_MetaDatas, file, "document-file-metadata"); - connect (meta, SIGNAL (triggered()), this, SLOT (addMetaDataSubView())); + connect (meta, &QAction::triggered, this, &View::addMetaDataSubView); file->addSeparator(); - + QAction* close = createMenuEntry("Close", ":./menu-close.png", file, "document-file-close"); - connect (close, SIGNAL (triggered()), this, SLOT (close())); + connect (close, &QAction::triggered, this, &View::close); QAction* exit = createMenuEntry("Exit", ":./menu-exit.png", file, "document-file-exit"); - connect (exit, SIGNAL (triggered()), this, SLOT (exit())); + connect (exit, &QAction::triggered, this, &View::exit); - connect (this, SIGNAL(exitApplicationRequest(CSVDoc::View *)), &mViewManager, SLOT(exitApplication(CSVDoc::View *))); + connect (this, &View::exitApplicationRequest, &mViewManager, &ViewManager::exitApplication); } namespace @@ -121,21 +121,21 @@ void CSVDoc::View::setupEditMenu() mUndo = mDocument->getUndoStack().createUndoAction (this, tr("Undo")); setupShortcut("document-edit-undo", mUndo); - connect(mUndo, SIGNAL (changed ()), this, SLOT (undoActionChanged ())); + connect(mUndo, &QAction::changed, this, &View::undoActionChanged); mUndo->setIcon(QIcon(QString::fromStdString(":./menu-undo.png"))); edit->addAction (mUndo); mRedo = mDocument->getUndoStack().createRedoAction (this, tr("Redo")); - connect(mRedo, SIGNAL (changed ()), this, SLOT (redoActionChanged ())); + connect(mRedo, &QAction::changed, this, &View::redoActionChanged); setupShortcut("document-edit-redo", mRedo); mRedo->setIcon(QIcon(QString::fromStdString(":./menu-redo.png"))); edit->addAction (mRedo); QAction* userSettings = createMenuEntry("Preferences", ":./menu-preferences.png", edit, "document-edit-preferences"); - connect (userSettings, SIGNAL (triggered()), this, SIGNAL (editSettingsRequest())); + connect (userSettings, &QAction::triggered, this, &View::editSettingsRequest); QAction* search = createMenuEntry(CSMWorld::UniversalId::Type_Search, edit, "document-edit-search"); - connect (search, SIGNAL (triggered()), this, SLOT (addSearchSubView())); + connect (search, &QAction::triggered, this, &View::addSearchSubView); } void CSVDoc::View::setupViewMenu() @@ -143,17 +143,17 @@ void CSVDoc::View::setupViewMenu() QMenu *view = menuBar()->addMenu (tr ("View")); QAction *newWindow = createMenuEntry("New View", ":./menu-new-window.png", view, "document-view-newview"); - connect (newWindow, SIGNAL (triggered()), this, SLOT (newView())); + connect (newWindow, &QAction::triggered, this, &View::newView); mShowStatusBar = createMenuEntry("Toggle Status Bar", ":./menu-status-bar.png", view, "document-view-statusbar"); - connect (mShowStatusBar, SIGNAL (toggled (bool)), this, SLOT (toggleShowStatusBar (bool))); + connect (mShowStatusBar, &QAction::toggled, this, &View::toggleShowStatusBar); mShowStatusBar->setCheckable (true); mShowStatusBar->setChecked (CSMPrefs::get()["Windows"]["show-statusbar"].isTrue()); view->addAction (mShowStatusBar); QAction *filters = createMenuEntry(CSMWorld::UniversalId::Type_Filters, view, "document-mechanics-filters"); - connect (filters, SIGNAL (triggered()), this, SLOT (addFiltersSubView())); + connect (filters, &QAction::triggered, this, &View::addFiltersSubView); } void CSVDoc::View::setupWorldMenu() @@ -161,32 +161,32 @@ void CSVDoc::View::setupWorldMenu() QMenu *world = menuBar()->addMenu (tr ("World")); QAction* referenceables = createMenuEntry(CSMWorld::UniversalId::Type_Referenceables, world, "document-world-referencables"); - connect (referenceables, SIGNAL (triggered()), this, SLOT (addReferenceablesSubView())); + connect (referenceables, &QAction::triggered, this, &View::addReferenceablesSubView); QAction* references = createMenuEntry(CSMWorld::UniversalId::Type_References, world, "document-world-references"); - connect (references, SIGNAL (triggered()), this, SLOT (addReferencesSubView())); - + connect (references, &QAction::triggered, this, &View::addReferencesSubView); + world->addSeparator(); QAction* cells = createMenuEntry(CSMWorld::UniversalId::Type_Cells, world, "document-world-cells"); - connect (cells, SIGNAL (triggered()), this, SLOT (addCellsSubView())); + connect (cells, &QAction::triggered, this, &View::addCellsSubView); QAction *lands = createMenuEntry(CSMWorld::UniversalId::Type_Lands, world, "document-world-lands"); - connect (lands, SIGNAL (triggered()), this, SLOT (addLandsSubView())); + connect (lands, &QAction::triggered, this, &View::addLandsSubView); QAction *landTextures = createMenuEntry(CSMWorld::UniversalId::Type_LandTextures, world, "document-world-landtextures"); - connect (landTextures, SIGNAL (triggered()), this, SLOT (addLandTexturesSubView())); + connect (landTextures, &QAction::triggered, this, &View::addLandTexturesSubView); QAction *grid = createMenuEntry(CSMWorld::UniversalId::Type_Pathgrids, world, "document-world-pathgrid"); - connect (grid, SIGNAL (triggered()), this, SLOT (addPathgridSubView())); + connect (grid, &QAction::triggered, this, &View::addPathgridSubView); world->addSeparator(); QAction* regions = createMenuEntry(CSMWorld::UniversalId::Type_Regions, world, "document-world-regions"); - connect (regions, SIGNAL (triggered()), this, SLOT (addRegionsSubView())); + connect (regions, &QAction::triggered, this, &View::addRegionsSubView); QAction *regionMap = createMenuEntry(CSMWorld::UniversalId::Type_RegionMap, world, "document-world-regionmap"); - connect (regionMap, SIGNAL (triggered()), this, SLOT (addRegionMapSubView())); + connect (regionMap, &QAction::triggered, this, &View::addRegionMapSubView); } void CSVDoc::View::setupMechanicsMenu() @@ -194,27 +194,27 @@ void CSVDoc::View::setupMechanicsMenu() QMenu *mechanics = menuBar()->addMenu (tr ("Mechanics")); QAction* scripts = createMenuEntry(CSMWorld::UniversalId::Type_Scripts, mechanics, "document-mechanics-scripts"); - connect (scripts, SIGNAL (triggered()), this, SLOT (addScriptsSubView())); + connect (scripts, &QAction::triggered, this, &View::addScriptsSubView); QAction* startScripts = createMenuEntry(CSMWorld::UniversalId::Type_StartScripts, mechanics, "document-mechanics-startscripts"); - connect (startScripts, SIGNAL (triggered()), this, SLOT (addStartScriptsSubView())); + connect (startScripts, &QAction::triggered, this, &View::addStartScriptsSubView); QAction* globals = createMenuEntry(CSMWorld::UniversalId::Type_Globals, mechanics, "document-mechanics-globals"); - connect (globals, SIGNAL (triggered()), this, SLOT (addGlobalsSubView())); + connect (globals, &QAction::triggered, this, &View::addGlobalsSubView); QAction* gmsts = createMenuEntry(CSMWorld::UniversalId::Type_Gmsts, mechanics, "document-mechanics-gamesettings"); - connect (gmsts, SIGNAL (triggered()), this, SLOT (addGmstsSubView())); - + connect (gmsts, &QAction::triggered, this, &View::addGmstsSubView); + mechanics->addSeparator(); QAction* spells = createMenuEntry(CSMWorld::UniversalId::Type_Spells, mechanics, "document-mechanics-spells"); - connect (spells, SIGNAL (triggered()), this, SLOT (addSpellsSubView())); + connect (spells, &QAction::triggered, this, &View::addSpellsSubView); QAction* enchantments = createMenuEntry(CSMWorld::UniversalId::Type_Enchantments, mechanics, "document-mechanics-enchantments"); - connect (enchantments, SIGNAL (triggered()), this, SLOT (addEnchantmentsSubView())); + connect (enchantments, &QAction::triggered, this, &View::addEnchantmentsSubView); QAction* magicEffects = createMenuEntry(CSMWorld::UniversalId::Type_MagicEffects, mechanics, "document-mechanics-magiceffects"); - connect (magicEffects, SIGNAL (triggered()), this, SLOT (addMagicEffectsSubView())); + connect (magicEffects, &QAction::triggered, this, &View::addMagicEffectsSubView); } void CSVDoc::View::setupCharacterMenu() @@ -222,38 +222,38 @@ void CSVDoc::View::setupCharacterMenu() QMenu *characters = menuBar()->addMenu (tr ("Characters")); QAction* skills = createMenuEntry(CSMWorld::UniversalId::Type_Skills, characters, "document-character-skills"); - connect (skills, SIGNAL (triggered()), this, SLOT (addSkillsSubView())); + connect (skills, &QAction::triggered, this, &View::addSkillsSubView); QAction* classes = createMenuEntry(CSMWorld::UniversalId::Type_Classes, characters, "document-character-classes"); - connect (classes, SIGNAL (triggered()), this, SLOT (addClassesSubView())); + connect (classes, &QAction::triggered, this, &View::addClassesSubView); QAction* factions = createMenuEntry(CSMWorld::UniversalId::Type_Faction, characters, "document-character-factions"); - connect (factions, SIGNAL (triggered()), this, SLOT (addFactionsSubView())); + connect (factions, &QAction::triggered, this, &View::addFactionsSubView); QAction* races = createMenuEntry(CSMWorld::UniversalId::Type_Races, characters, "document-character-races"); - connect (races, SIGNAL (triggered()), this, SLOT (addRacesSubView())); + connect (races, &QAction::triggered, this, &View::addRacesSubView); QAction* birthsigns = createMenuEntry(CSMWorld::UniversalId::Type_Birthsigns, characters, "document-character-birthsigns"); - connect (birthsigns, SIGNAL (triggered()), this, SLOT (addBirthsignsSubView())); - + connect (birthsigns, &QAction::triggered, this, &View::addBirthsignsSubView); + QAction* bodyParts = createMenuEntry(CSMWorld::UniversalId::Type_BodyParts, characters, "document-character-bodyparts"); - connect (bodyParts, SIGNAL (triggered()), this, SLOT (addBodyPartsSubView())); + connect (bodyParts, &QAction::triggered, this, &View::addBodyPartsSubView); characters->addSeparator(); - + QAction* topics = createMenuEntry(CSMWorld::UniversalId::Type_Topics, characters, "document-character-topics"); - connect (topics, SIGNAL (triggered()), this, SLOT (addTopicsSubView())); + connect (topics, &QAction::triggered, this, &View::addTopicsSubView); QAction* topicInfos = createMenuEntry(CSMWorld::UniversalId::Type_TopicInfos, characters, "document-character-topicinfos"); - connect (topicInfos, SIGNAL (triggered()), this, SLOT (addTopicInfosSubView())); - + connect (topicInfos, &QAction::triggered, this, &View::addTopicInfosSubView); + characters->addSeparator(); - + QAction* journals = createMenuEntry(CSMWorld::UniversalId::Type_Journals, characters, "document-character-journals"); - connect (journals, SIGNAL (triggered()), this, SLOT (addJournalsSubView())); + connect (journals, &QAction::triggered, this, &View::addJournalsSubView); QAction* journalInfos = createMenuEntry(CSMWorld::UniversalId::Type_JournalInfos, characters, "document-character-journalinfos"); - connect (journalInfos, SIGNAL (triggered()), this, SLOT (addJournalInfosSubView())); + connect (journalInfos, &QAction::triggered, this, &View::addJournalInfosSubView); } void CSVDoc::View::setupAssetsMenu() @@ -266,30 +266,30 @@ void CSVDoc::View::setupAssetsMenu() assets->addSeparator(); QAction* sounds = createMenuEntry(CSMWorld::UniversalId::Type_Sounds, assets, "document-assets-sounds"); - connect (sounds, SIGNAL (triggered()), this, SLOT (addSoundsSubView())); + connect (sounds, &QAction::triggered, this, &View::addSoundsSubView); QAction* soundGens = createMenuEntry(CSMWorld::UniversalId::Type_SoundGens, assets, "document-assets-soundgens"); - connect (soundGens, SIGNAL (triggered()), this, SLOT (addSoundGensSubView())); + connect (soundGens, &QAction::triggered, this, &View::addSoundGensSubView); assets->addSeparator(); // resources follow here QAction* meshes = createMenuEntry(CSMWorld::UniversalId::Type_Meshes, assets, "document-assets-meshes"); - connect (meshes, SIGNAL (triggered()), this, SLOT (addMeshesSubView())); + connect (meshes, &QAction::triggered, this, &View::addMeshesSubView); QAction* icons = createMenuEntry(CSMWorld::UniversalId::Type_Icons, assets, "document-assets-icons"); - connect (icons, SIGNAL (triggered()), this, SLOT (addIconsSubView())); + connect (icons, &QAction::triggered, this, &View::addIconsSubView); QAction* musics = createMenuEntry(CSMWorld::UniversalId::Type_Musics, assets, "document-assets-musics"); - connect (musics, SIGNAL (triggered()), this, SLOT (addMusicsSubView())); + connect (musics, &QAction::triggered, this, &View::addMusicsSubView); QAction* soundFiles = createMenuEntry(CSMWorld::UniversalId::Type_SoundsRes, assets, "document-assets-soundres"); - connect (soundFiles, SIGNAL (triggered()), this, SLOT (addSoundsResSubView())); + connect (soundFiles, &QAction::triggered, this, &View::addSoundsResSubView); QAction* textures = createMenuEntry(CSMWorld::UniversalId::Type_Textures, assets, "document-assets-textures"); - connect (textures, SIGNAL (triggered()), this, SLOT (addTexturesSubView())); + connect (textures, &QAction::triggered, this, &View::addTexturesSubView); QAction* videos = createMenuEntry(CSMWorld::UniversalId::Type_Videos, assets, "document-assets-videos"); - connect (videos, SIGNAL (triggered()), this, SLOT (addVideosSubView())); + connect (videos, &QAction::triggered, this, &View::addVideosSubView); } void CSVDoc::View::setupDebugMenu() @@ -297,7 +297,7 @@ void CSVDoc::View::setupDebugMenu() QMenu *debug = menuBar()->addMenu (tr ("Debug")); QAction* profiles = createMenuEntry(CSMWorld::UniversalId::Type_DebugProfiles, debug, "document-debug-profiles"); - connect (profiles, SIGNAL (triggered()), this, SLOT (addDebugProfilesSubView())); + connect (profiles, &QAction::triggered, this, &View::addDebugProfilesSubView); debug->addSeparator(); @@ -305,8 +305,8 @@ void CSVDoc::View::setupDebugMenu() &dynamic_cast (*mDocument->getData().getTableModel ( CSMWorld::UniversalId::Type_DebugProfiles)), this); - connect (mGlobalDebugProfileMenu, SIGNAL (triggered (const std::string&)), - this, SLOT (run (const std::string&))); + connect (mGlobalDebugProfileMenu, &GlobalDebugProfileMenu::triggered, + this, [this](const std::string &profile){ this->run(profile, ""); }); QAction *runDebug = debug->addMenu (mGlobalDebugProfileMenu); runDebug->setText (tr ("Run OpenMW")); @@ -314,11 +314,11 @@ void CSVDoc::View::setupDebugMenu() runDebug->setIcon(QIcon(QString::fromStdString(":./run-openmw.png"))); QAction* stopDebug = createMenuEntry("Stop OpenMW", ":./stop-openmw.png", debug, "document-debug-shutdown"); - connect (stopDebug, SIGNAL (triggered()), this, SLOT (stop())); + connect (stopDebug, &QAction::triggered, this, &View::stop); mStopDebug = stopDebug; QAction* runLog = createMenuEntry(CSMWorld::UniversalId::Type_RunLog, debug, "document-debug-runlog"); - connect (runLog, SIGNAL (triggered()), this, SLOT (addRunLogSubView())); + connect (runLog, &QAction::triggered, this, &View::addRunLogSubView); } void CSVDoc::View::setupHelpMenu() @@ -326,16 +326,16 @@ void CSVDoc::View::setupHelpMenu() QMenu *help = menuBar()->addMenu (tr ("Help")); QAction* helpInfo = createMenuEntry("Help", ":/info.png", help, "document-help-help"); - connect (helpInfo, SIGNAL (triggered()), this, SLOT (openHelp())); + connect (helpInfo, &QAction::triggered, this, &View::openHelp); QAction* tutorial = createMenuEntry("Tutorial", ":/info.png", help, "document-help-tutorial"); - connect (tutorial, SIGNAL (triggered()), this, SLOT (tutorial())); + connect (tutorial, &QAction::triggered, this, &View::tutorial); QAction* about = createMenuEntry("About OpenMW-CS", ":./info.png", help, "document-help-about"); - connect (about, SIGNAL (triggered()), this, SLOT (infoAbout())); + connect (about, &QAction::triggered, this, &View::infoAbout); QAction* aboutQt = createMenuEntry("About Qt", ":./qt.png", help, "document-help-qt"); - connect (aboutQt, SIGNAL (triggered()), this, SLOT (infoAboutQt())); + connect (aboutQt, &QAction::triggered, this, &View::infoAboutQt); } QAction* CSVDoc::View::createMenuEntry(CSMWorld::UniversalId::Type type, QMenu* menu, const char* shortcutName) @@ -501,10 +501,10 @@ CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int to mSubViewFactory.add (CSMWorld::UniversalId::Type_RunLog, new SubViewFactory); - connect (mOperations, SIGNAL (abortOperation (int)), this, SLOT (abortOperation (int))); + connect (mOperations, &Operations::abortOperation, this, &View::abortOperation); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &View::settingChanged); } CSVDoc::View::~View() @@ -584,8 +584,8 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin } if (mScroll) - QObject::connect(mScroll->horizontalScrollBar(), - SIGNAL(rangeChanged(int,int)), this, SLOT(moveScrollBarToEnd(int,int))); + QObject::connect(mScroll->horizontalScrollBar(), &QScrollBar::rangeChanged, + this, &View::moveScrollBarToEnd); // User setting for limiting the number of sub views per top level view. // Automatically open a new top level view if this number is exceeded @@ -637,28 +637,27 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin updateSubViewIndices(); - connect (view, SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&)), this, - SLOT (addSubView (const CSMWorld::UniversalId&, const std::string&))); + connect (view, &SubView::focusId, this, &View::addSubView); - connect (view, SIGNAL (closeRequest (SubView *)), this, SLOT (closeRequest (SubView *))); + connect (view, qOverload(&SubView::closeRequest), + this, &View::closeRequest); - connect (view, SIGNAL (updateTitle()), this, SLOT (updateTitle())); + connect (view, &SubView::updateTitle, this, &View::updateTitle); - connect (view, SIGNAL (updateSubViewIndices (SubView *)), - this, SLOT (updateSubViewIndices (SubView *))); + connect (view, &SubView::updateSubViewIndices, this, &View::updateSubViewIndices); CSVWorld::TableSubView* tableView = dynamic_cast(view); if (tableView) { - connect (this, SIGNAL (requestFocus (const std::string&)), - tableView, SLOT (requestFocus (const std::string&))); + connect (this, &View::requestFocus, + tableView, &CSVWorld::TableSubView::requestFocus); } CSVWorld::SceneSubView* sceneView = dynamic_cast(view); if (sceneView) { - connect(sceneView, SIGNAL(requestFocus(const std::string&)), - this, SLOT(onRequestFocus(const std::string&))); + connect(sceneView, &CSVWorld::SceneSubView::requestFocus, + this, &View::onRequestFocus); } if (CSMPrefs::State::get()["ID Tables"]["subview-new-window"].isTrue()) @@ -684,8 +683,8 @@ void CSVDoc::View::moveScrollBarToEnd(int min, int max) { mScroll->horizontalScrollBar()->setValue(max); - QObject::disconnect(mScroll->horizontalScrollBar(), - SIGNAL(rangeChanged(int,int)), this, SLOT(moveScrollBarToEnd(int,int))); + QObject::disconnect(mScroll->horizontalScrollBar(), &QScrollBar::rangeChanged, + this, &View::moveScrollBarToEnd); } } diff --git a/apps/opencs/view/doc/viewmanager.cpp b/apps/opencs/view/doc/viewmanager.cpp index f8fc67de9a..c1fd21d246 100644 --- a/apps/opencs/view/doc/viewmanager.cpp +++ b/apps/opencs/view/doc/viewmanager.cpp @@ -117,32 +117,26 @@ CSVDoc::ViewManager::ViewManager (CSMDoc::DocumentManager& documentManager) mDelegateFactories->add (sMapping[i].mDisplay, new CSVWorld::EnumDelegateFactory ( CSMWorld::Columns::getEnums (sMapping[i].mColumnId), sMapping[i].mAllowNone)); - connect (&mDocumentManager, SIGNAL (loadRequest (CSMDoc::Document *)), - &mLoader, SLOT (add (CSMDoc::Document *))); + connect (&mDocumentManager, &CSMDoc::DocumentManager::loadRequest, + &mLoader, &Loader::add); - connect ( - &mDocumentManager, SIGNAL (loadingStopped (CSMDoc::Document *, bool, const std::string&)), - &mLoader, SLOT (loadingStopped (CSMDoc::Document *, bool, const std::string&))); + connect (&mDocumentManager, &CSMDoc::DocumentManager::loadingStopped, + &mLoader, &Loader::loadingStopped); - connect ( - &mDocumentManager, SIGNAL (nextStage (CSMDoc::Document *, const std::string&, int)), - &mLoader, SLOT (nextStage (CSMDoc::Document *, const std::string&, int))); + connect (&mDocumentManager, &CSMDoc::DocumentManager::nextStage, + &mLoader, &Loader::nextStage); - connect ( - &mDocumentManager, SIGNAL (nextRecord (CSMDoc::Document *, int)), - &mLoader, SLOT (nextRecord (CSMDoc::Document *, int))); + connect (&mDocumentManager, &CSMDoc::DocumentManager::nextRecord, + &mLoader, &Loader::nextRecord); - connect ( - &mDocumentManager, SIGNAL (loadMessage (CSMDoc::Document *, const std::string&)), - &mLoader, SLOT (loadMessage (CSMDoc::Document *, const std::string&))); + connect (&mDocumentManager, &CSMDoc::DocumentManager::loadMessage, + &mLoader, &Loader::loadMessage); - connect ( - &mLoader, SIGNAL (cancel (CSMDoc::Document *)), - &mDocumentManager, SIGNAL (cancelLoading (CSMDoc::Document *))); + connect (&mLoader, &Loader::cancel, + &mDocumentManager, &CSMDoc::DocumentManager::cancelLoading); - connect ( - &mLoader, SIGNAL (close (CSMDoc::Document *)), - &mDocumentManager, SLOT (removeDocument (CSMDoc::Document *))); + connect (&mLoader, &Loader::close, + &mDocumentManager, &CSMDoc::DocumentManager::removeDocument); } CSVDoc::ViewManager::~ViewManager() @@ -158,11 +152,11 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document) if (countViews (document)==0) { // new document - connect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), - this, SLOT (documentStateChanged (int, CSMDoc::Document *))); + connect (document, &CSMDoc::Document::stateChanged, + this, &ViewManager::documentStateChanged); - connect (document, SIGNAL (progress (int, int, int, int, CSMDoc::Document *)), - this, SLOT (progress (int, int, int, int, CSMDoc::Document *))); + connect (document, qOverload(&CSMDoc::Document::progress), + this, &ViewManager::progress); } View *view = new View (*this, document, countViews (document)+1); @@ -172,11 +166,11 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document) view->toggleStatusBar (CSMPrefs::get()["Windows"]["show-statusbar"].isTrue()); view->show(); - connect (view, SIGNAL (newGameRequest ()), this, SIGNAL (newGameRequest())); - connect (view, SIGNAL (newAddonRequest ()), this, SIGNAL (newAddonRequest())); - connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest())); - connect (view, SIGNAL (editSettingsRequest()), this, SIGNAL (editSettingsRequest())); - connect (view, SIGNAL (mergeDocument (CSMDoc::Document *)), this, SIGNAL (mergeDocument (CSMDoc::Document *))); + connect (view, &View::newGameRequest, this, &ViewManager::newGameRequest); + connect (view, &View::newAddonRequest, this, &ViewManager::newAddonRequest); + connect (view, &View::loadDocumentRequest, this, &ViewManager::loadDocumentRequest); + connect (view, &View::editSettingsRequest, this, &ViewManager::editSettingsRequest); + connect (view, &View::mergeDocument, this, &ViewManager::mergeDocument); updateIndices(); @@ -278,9 +272,9 @@ bool CSVDoc::ViewManager::showModifiedDocumentMessageBox (CSVDoc::View *view) bool retVal = true; - connect (this, SIGNAL (closeMessageBox()), &messageBox, SLOT (close())); + connect (this, &ViewManager::closeMessageBox, &messageBox, &QMessageBox::close); - connect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); + connect (document, &CSMDoc::Document::stateChanged, this, &ViewManager::onExitWarningHandler); mUserWarned = true; int response = messageBox.exec(); @@ -297,13 +291,15 @@ bool CSVDoc::ViewManager::showModifiedDocumentMessageBox (CSVDoc::View *view) case QMessageBox::Discard: - disconnect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); + disconnect (document, &CSMDoc::Document::stateChanged, + this, &ViewManager::onExitWarningHandler); break; case QMessageBox::Cancel: //disconnect to prevent unintended view closures - disconnect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); + disconnect (document, &CSMDoc::Document::stateChanged, + this, &ViewManager::onExitWarningHandler); retVal = false; break; @@ -332,8 +328,8 @@ bool CSVDoc::ViewManager::showSaveInProgressMessageBox (CSVDoc::View *view) bool retVal = true; //Connections shut down message box if operation ends before user makes a decision. - connect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); - connect (this, SIGNAL (closeMessageBox()), &messageBox, SLOT (close())); + connect (document, &CSMDoc::Document::stateChanged, this, &ViewManager::onExitWarningHandler); + connect (this, &ViewManager::closeMessageBox, &messageBox, &QMessageBox::close); //set / clear the user warned flag to indicate whether or not the message box is currently active. mUserWarned = true; @@ -351,7 +347,7 @@ bool CSVDoc::ViewManager::showSaveInProgressMessageBox (CSVDoc::View *view) else if (messageBox.clickedButton() == closeButton) { //disconnect to avoid segmentation fault - disconnect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); + disconnect (document, &CSMDoc::Document::stateChanged, this, &ViewManager::onExitWarningHandler); view->abortOperation(CSMDoc::State_Saving); mExitOnSaveStateChange = true; @@ -362,7 +358,7 @@ bool CSVDoc::ViewManager::showSaveInProgressMessageBox (CSVDoc::View *view) //abort shutdown, allow save to complete //disconnection to prevent unintended view closures mExitOnSaveStateChange = false; - disconnect (document, SIGNAL (stateChanged (int, CSMDoc::Document *)), this, SLOT (onExitWarningHandler(int, CSMDoc::Document *))); + disconnect (document, &CSMDoc::Document::stateChanged, this, &ViewManager::onExitWarningHandler); retVal = false; } diff --git a/apps/opencs/view/filter/editwidget.cpp b/apps/opencs/view/filter/editwidget.cpp index 6db8751a0c..7dc92c3dc4 100644 --- a/apps/opencs/view/filter/editwidget.cpp +++ b/apps/opencs/view/filter/editwidget.cpp @@ -19,26 +19,23 @@ CSVFilter::EditWidget::EditWidget (CSMWorld::Data& data, QWidget *parent) : QLineEdit (parent), mParser (data), mIsEmpty(true) { mPalette = palette(); - connect (this, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&))); + connect (this, &QLineEdit::textChanged, this, &EditWidget::textChanged); const CSMWorld::IdTableBase *model = static_cast (data.getTableModel (CSMWorld::UniversalId::Type_Filters)); - connect (model, SIGNAL (dataChanged (const QModelIndex &, const QModelIndex&)), - this, SLOT (filterDataChanged (const QModelIndex &, const QModelIndex&)), - Qt::QueuedConnection); - connect (model, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (filterRowsRemoved (const QModelIndex&, int, int)), - Qt::QueuedConnection); - connect (model, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (filterRowsInserted (const QModelIndex&, int, int)), - Qt::QueuedConnection); + connect (model, &CSMWorld::IdTableBase::dataChanged, + this, &EditWidget::filterDataChanged, Qt::QueuedConnection); + connect (model, &CSMWorld::IdTableBase::rowsRemoved, + this, &EditWidget::filterRowsRemoved, Qt::QueuedConnection); + connect (model, &CSMWorld::IdTableBase::rowsInserted, + this, &EditWidget::filterRowsInserted, Qt::QueuedConnection); mStateColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Modification); mDescColumnIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Description); mHelpAction = new QAction (tr ("Help"), this); - connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp())); + connect (mHelpAction, &QAction::triggered, this, &EditWidget::openHelp); mHelpAction->setIcon(QIcon(":/info.png")); addAction (mHelpAction); auto* openHelpShortcut = new CSMPrefs::Shortcut("help", this); diff --git a/apps/opencs/view/filter/filterbox.cpp b/apps/opencs/view/filter/filterbox.cpp index 461b131dbf..30c22c2f51 100644 --- a/apps/opencs/view/filter/filterbox.cpp +++ b/apps/opencs/view/filter/filterbox.cpp @@ -20,9 +20,8 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent) setLayout (layout); - connect (mRecordFilterBox, - SIGNAL (filterChanged (std::shared_ptr)), - this, SIGNAL (recordFilterChanged (std::shared_ptr))); + connect (mRecordFilterBox, &RecordFilterBox::filterChanged, + this, &FilterBox::recordFilterChanged); setAcceptDrops(true); } diff --git a/apps/opencs/view/filter/recordfilterbox.cpp b/apps/opencs/view/filter/recordfilterbox.cpp index d244658971..face275ef6 100644 --- a/apps/opencs/view/filter/recordfilterbox.cpp +++ b/apps/opencs/view/filter/recordfilterbox.cpp @@ -22,9 +22,8 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare setLayout (layout); - connect ( - mEdit, SIGNAL (filterChanged (std::shared_ptr)), - this, SIGNAL (filterChanged (std::shared_ptr))); + connect (mEdit, &EditWidget::filterChanged, + this, &RecordFilterBox::filterChanged); } void CSVFilter::RecordFilterBox::setFilter (const std::string& filter) diff --git a/apps/opencs/view/prefs/dialogue.cpp b/apps/opencs/view/prefs/dialogue.cpp index 2dd92901ea..369c23eb62 100644 --- a/apps/opencs/view/prefs/dialogue.cpp +++ b/apps/opencs/view/prefs/dialogue.cpp @@ -40,8 +40,8 @@ void CSVPrefs::Dialogue::buildCategorySelector (QSplitter *main) list->setMaximumWidth (maxWidth + 10); - connect (list, SIGNAL (currentItemChanged (QListWidgetItem *, QListWidgetItem *)), - this, SLOT (selectionChanged (QListWidgetItem *, QListWidgetItem *))); + connect (list, &ContextMenuList::currentItemChanged, + this, &Dialogue::selectionChanged); } void CSVPrefs::Dialogue::buildContentArea (QSplitter *main) diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index 39c9f78ec1..37315d3fbc 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -29,7 +29,8 @@ namespace CSVPrefs mStackedLayout = new QStackedLayout(stackedWidget); mPageSelector = new QComboBox(); - connect(mPageSelector, SIGNAL(currentIndexChanged(int)), mStackedLayout, SLOT(setCurrentIndex(int))); + connect(mPageSelector, qOverload(&QComboBox::currentIndexChanged), + mStackedLayout, &QStackedLayout::setCurrentIndex); QFrame* lineSeparator = new QFrame(topWidget); lineSeparator->setFrameShape(QFrame::HLine); @@ -37,7 +38,7 @@ namespace CSVPrefs // Reset key bindings button QPushButton* resetButton = new QPushButton ("Reset to Defaults", topWidget); - connect(resetButton, SIGNAL(clicked()), this, SLOT(resetKeyBindings())); + connect(resetButton, &QPushButton::clicked, this, &KeyBindingPage::resetKeyBindings); topLayout->addWidget(mPageSelector); topLayout->addWidget(stackedWidget); diff --git a/apps/opencs/view/render/actor.cpp b/apps/opencs/view/render/actor.cpp index d33c6f3f28..99b2b342ff 100644 --- a/apps/opencs/view/render/actor.cpp +++ b/apps/opencs/view/render/actor.cpp @@ -23,8 +23,8 @@ namespace CSVRender , mSkeleton(nullptr) { mActorData = mData.getActorAdapter()->getActorData(mId); - connect(mData.getActorAdapter(), SIGNAL(actorChanged(const std::string&)), - this, SLOT(handleActorChanged(const std::string&))); + connect(mData.getActorAdapter(), &CSMWorld::ActorAdapter::actorChanged, + this, &Actor::handleActorChanged); } osg::Group* Actor::getBaseNode() diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index f21224d73d..32d0b4268a 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -179,57 +179,67 @@ namespace CSVRender { CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget); naviPrimaryShortcut->enable(false); - connect(naviPrimaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviPrimary(bool))); + connect(naviPrimaryShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::naviPrimary); addShortcut(naviPrimaryShortcut); CSMPrefs::Shortcut* naviSecondaryShortcut = new CSMPrefs::Shortcut("scene-navi-secondary", widget); naviSecondaryShortcut->enable(false); - connect(naviSecondaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviSecondary(bool))); + connect(naviSecondaryShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::naviSecondary); addShortcut(naviSecondaryShortcut); CSMPrefs::Shortcut* forwardShortcut = new CSMPrefs::Shortcut("free-forward", "scene-speed-modifier", CSMPrefs::Shortcut::SM_Detach, widget); forwardShortcut->enable(false); - connect(forwardShortcut, SIGNAL(activated(bool)), this, SLOT(forward(bool))); - connect(forwardShortcut, SIGNAL(secondary(bool)), this, SLOT(alternateFast(bool))); + connect(forwardShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::forward); + connect(forwardShortcut, qOverload(&CSMPrefs::Shortcut::secondary), + this, &FreeCameraController::alternateFast); addShortcut(forwardShortcut); CSMPrefs::Shortcut* leftShortcut = new CSMPrefs::Shortcut("free-left", widget); leftShortcut->enable(false); - connect(leftShortcut, SIGNAL(activated(bool)), this, SLOT(left(bool))); + connect(leftShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::left); addShortcut(leftShortcut); CSMPrefs::Shortcut* backShortcut = new CSMPrefs::Shortcut("free-backward", widget); backShortcut->enable(false); - connect(backShortcut, SIGNAL(activated(bool)), this, SLOT(backward(bool))); + connect(backShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::backward); addShortcut(backShortcut); CSMPrefs::Shortcut* rightShortcut = new CSMPrefs::Shortcut("free-right", widget); rightShortcut->enable(false); - connect(rightShortcut, SIGNAL(activated(bool)), this, SLOT(right(bool))); + connect(rightShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::right); addShortcut(rightShortcut); CSMPrefs::Shortcut* rollLeftShortcut = new CSMPrefs::Shortcut("free-roll-left", widget); rollLeftShortcut->enable(false); - connect(rollLeftShortcut, SIGNAL(activated(bool)), this, SLOT(rollLeft(bool))); + connect(rollLeftShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::rollLeft); addShortcut(rollLeftShortcut); CSMPrefs::Shortcut* rollRightShortcut = new CSMPrefs::Shortcut("free-roll-right", widget); rollRightShortcut->enable(false); - connect(rollRightShortcut, SIGNAL(activated(bool)), this, SLOT(rollRight(bool))); + connect(rollRightShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::rollRight); addShortcut(rollRightShortcut); CSMPrefs::Shortcut* speedModeShortcut = new CSMPrefs::Shortcut("free-speed-mode", widget); speedModeShortcut->enable(false); - connect(speedModeShortcut, SIGNAL(activated()), this, SLOT(swapSpeedMode())); + connect(speedModeShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &FreeCameraController::swapSpeedMode); addShortcut(speedModeShortcut); } @@ -467,57 +477,67 @@ namespace CSVRender { CSMPrefs::Shortcut* naviPrimaryShortcut = new CSMPrefs::Shortcut("scene-navi-primary", widget); naviPrimaryShortcut->enable(false); - connect(naviPrimaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviPrimary(bool))); + connect(naviPrimaryShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::naviPrimary); addShortcut(naviPrimaryShortcut); CSMPrefs::Shortcut* naviSecondaryShortcut = new CSMPrefs::Shortcut("scene-navi-secondary", widget); naviSecondaryShortcut->enable(false); - connect(naviSecondaryShortcut, SIGNAL(activated(bool)), this, SLOT(naviSecondary(bool))); + connect(naviSecondaryShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::naviSecondary); addShortcut(naviSecondaryShortcut); CSMPrefs::Shortcut* upShortcut = new CSMPrefs::Shortcut("orbit-up", "scene-speed-modifier", CSMPrefs::Shortcut::SM_Detach, widget); upShortcut->enable(false); - connect(upShortcut, SIGNAL(activated(bool)), this, SLOT(up(bool))); - connect(upShortcut, SIGNAL(secondary(bool)), this, SLOT(alternateFast(bool))); + connect(upShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::up); + connect(upShortcut, qOverload(&CSMPrefs::Shortcut::secondary), + this, &OrbitCameraController::alternateFast); addShortcut(upShortcut); CSMPrefs::Shortcut* leftShortcut = new CSMPrefs::Shortcut("orbit-left", widget); leftShortcut->enable(false); - connect(leftShortcut, SIGNAL(activated(bool)), this, SLOT(left(bool))); + connect(leftShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::left); addShortcut(leftShortcut); CSMPrefs::Shortcut* downShortcut = new CSMPrefs::Shortcut("orbit-down", widget); downShortcut->enable(false); - connect(downShortcut, SIGNAL(activated(bool)), this, SLOT(down(bool))); + connect(downShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::down); addShortcut(downShortcut); CSMPrefs::Shortcut* rightShortcut = new CSMPrefs::Shortcut("orbit-right", widget); rightShortcut->enable(false); - connect(rightShortcut, SIGNAL(activated(bool)), this, SLOT(right(bool))); + connect(rightShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::right); addShortcut(rightShortcut); CSMPrefs::Shortcut* rollLeftShortcut = new CSMPrefs::Shortcut("orbit-roll-left", widget); rollLeftShortcut->enable(false); - connect(rollLeftShortcut, SIGNAL(activated(bool)), this, SLOT(rollLeft(bool))); + connect(rollLeftShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::rollLeft); addShortcut(rollLeftShortcut); CSMPrefs::Shortcut* rollRightShortcut = new CSMPrefs::Shortcut("orbit-roll-right", widget); rollRightShortcut->enable(false); - connect(rollRightShortcut, SIGNAL(activated(bool)), this, SLOT(rollRight(bool))); + connect(rollRightShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::rollRight); addShortcut(rollRightShortcut); CSMPrefs::Shortcut* speedModeShortcut = new CSMPrefs::Shortcut("orbit-speed-mode", widget); speedModeShortcut->enable(false); - connect(speedModeShortcut, SIGNAL(activated()), this, SLOT(swapSpeedMode())); + connect(speedModeShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraController::swapSpeedMode); addShortcut(speedModeShortcut); } @@ -669,7 +689,7 @@ namespace CSVRender mInitialized = true; } - + void OrbitCameraController::setConstRoll(bool enabled) { mConstRoll = enabled; @@ -702,7 +722,7 @@ namespace CSVRender osg::Quat rotation = osg::Quat(value,axis); osg::Vec3d oldOffset = eye - mCenter; osg::Vec3d newOffset = rotation * oldOffset; - + if (mConstRoll) up = rotation * up; diff --git a/apps/opencs/view/render/cellwater.cpp b/apps/opencs/view/render/cellwater.cpp index 0f7b8670f2..74eb4dddfc 100644 --- a/apps/opencs/view/render/cellwater.cpp +++ b/apps/opencs/view/render/cellwater.cpp @@ -51,8 +51,7 @@ namespace CSVRender // Keep water existence/height up to date QAbstractItemModel* cells = mData.getTableModel(CSMWorld::UniversalId::Type_Cells); - connect(cells, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)), - this, SLOT(cellDataChanged(const QModelIndex&, const QModelIndex&))); + connect(cells, &QAbstractItemModel::dataChanged, this, &CellWater::cellDataChanged); } CellWater::~CellWater() diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index 39eb27f23b..0f5696b472 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -134,21 +134,26 @@ CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, osg: parent), mSubMode (nullptr), mSubModeId ("move"), mSelectionMode (nullptr), mDragMode (DragMode_None), mDragAxis (-1), mLocked (false), mUnitScaleDist(1), mParentNode (parentNode) { - connect(this, SIGNAL(requestFocus(const std::string&)), - worldspaceWidget, SIGNAL(requestFocus(const std::string&))); + connect(this, &InstanceMode::requestFocus, + worldspaceWidget, &WorldspaceWidget::requestFocus); CSMPrefs::Shortcut* deleteShortcut = new CSMPrefs::Shortcut("scene-delete", worldspaceWidget); - connect(deleteShortcut, SIGNAL(activated(bool)), this, SLOT(deleteSelectedInstances(bool))); + connect(deleteShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &InstanceMode::deleteSelectedInstances); // Following classes could be simplified by using QSignalMapper, which is obsolete in Qt5.10, but not in Qt4.8 and Qt5.14 CSMPrefs::Shortcut* dropToCollisionShortcut = new CSMPrefs::Shortcut("scene-instance-drop-collision", worldspaceWidget); - connect(dropToCollisionShortcut, SIGNAL(activated()), this, SLOT(dropSelectedInstancesToCollision())); + connect(dropToCollisionShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &InstanceMode::dropSelectedInstancesToCollision); CSMPrefs::Shortcut* dropToTerrainLevelShortcut = new CSMPrefs::Shortcut("scene-instance-drop-terrain", worldspaceWidget); - connect(dropToTerrainLevelShortcut, SIGNAL(activated()), this, SLOT(dropSelectedInstancesToTerrain())); + connect(dropToTerrainLevelShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &InstanceMode::dropSelectedInstancesToTerrain); CSMPrefs::Shortcut* dropToCollisionShortcut2 = new CSMPrefs::Shortcut("scene-instance-drop-collision-separately", worldspaceWidget); - connect(dropToCollisionShortcut2, SIGNAL(activated()), this, SLOT(dropSelectedInstancesToCollisionSeparately())); + connect(dropToCollisionShortcut2, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &InstanceMode::dropSelectedInstancesToCollisionSeparately); CSMPrefs::Shortcut* dropToTerrainLevelShortcut2 = new CSMPrefs::Shortcut("scene-instance-drop-terrain-separately", worldspaceWidget); - connect(dropToTerrainLevelShortcut2, SIGNAL(activated()), this, SLOT(dropSelectedInstancesToTerrainSeparately())); + connect(dropToTerrainLevelShortcut2, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &InstanceMode::dropSelectedInstancesToTerrainSeparately); } void CSVRender::InstanceMode::activate (CSVWidget::SceneToolbar *toolbar) @@ -172,8 +177,7 @@ void CSVRender::InstanceMode::activate (CSVWidget::SceneToolbar *toolbar) mSubMode->setButton (mSubModeId); - connect (mSubMode, SIGNAL (modeChanged (const std::string&)), - this, SLOT (subModeChanged (const std::string&))); + connect (mSubMode, &CSVWidget::SceneToolMode::modeChanged, this, &InstanceMode::subModeChanged); } if (!mSelectionMode) diff --git a/apps/opencs/view/render/instanceselectionmode.cpp b/apps/opencs/view/render/instanceselectionmode.cpp index 545d35d93b..beabec7aad 100644 --- a/apps/opencs/view/render/instanceselectionmode.cpp +++ b/apps/opencs/view/render/instanceselectionmode.cpp @@ -24,8 +24,8 @@ namespace CSVRender mSelectSame = new QAction("Extend selection to instances with same object ID", this); mDeleteSelection = new QAction("Delete selected instances", this); - connect(mSelectSame, SIGNAL(triggered()), this, SLOT(selectSame())); - connect(mDeleteSelection, SIGNAL(triggered()), this, SLOT(deleteSelection())); + connect(mSelectSame, &QAction::triggered, this, &InstanceSelectionMode::selectSame); + connect(mDeleteSelection, &QAction::triggered, this, &InstanceSelectionMode::deleteSelection); } InstanceSelectionMode::~InstanceSelectionMode() diff --git a/apps/opencs/view/render/orbitcameramode.cpp b/apps/opencs/view/render/orbitcameramode.cpp index c81402ed1e..612efc3b01 100644 --- a/apps/opencs/view/render/orbitcameramode.cpp +++ b/apps/opencs/view/render/orbitcameramode.cpp @@ -16,7 +16,8 @@ namespace CSVRender { mCenterShortcut = new CSMPrefs::Shortcut("orbit-center-selection", worldspaceWidget); mCenterShortcut->enable(false); - connect(mCenterShortcut, SIGNAL(activated()), this, SLOT(centerSelection())); + connect(mCenterShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &OrbitCameraMode::centerSelection); } OrbitCameraMode::~OrbitCameraMode() @@ -27,7 +28,7 @@ namespace CSVRender { mCenterOnSelection = new QAction("Center on selected object", this); mCenterShortcut->associateAction(mCenterOnSelection); - connect(mCenterOnSelection, SIGNAL(triggered()), this, SLOT(centerSelection())); + connect(mCenterOnSelection, &QAction::triggered, this, &OrbitCameraMode::centerSelection); mCenterShortcut->enable(true); } diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index f0299c5ace..6e58af24da 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -524,49 +524,54 @@ CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc QAbstractItemModel *cells = document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells); - connect (cells, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (cellDataChanged (const QModelIndex&, const QModelIndex&))); - connect (cells, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (cellRemoved (const QModelIndex&, int, int))); - connect (cells, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (cellAdded (const QModelIndex&, int, int))); + connect (cells, &QAbstractItemModel::dataChanged, + this, &PagedWorldspaceWidget::cellDataChanged); + connect (cells, &QAbstractItemModel::rowsRemoved, + this, &PagedWorldspaceWidget::cellRemoved); + connect (cells, &QAbstractItemModel::rowsInserted, + this, &PagedWorldspaceWidget::cellAdded); - connect (&document.getData(), SIGNAL (assetTablesChanged ()), - this, SLOT (assetTablesChanged ())); + connect (&document.getData(), &CSMWorld::Data::assetTablesChanged, + this, &PagedWorldspaceWidget::assetTablesChanged); QAbstractItemModel *lands = document.getData().getTableModel (CSMWorld::UniversalId::Type_Lands); - connect (lands, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (landDataChanged (const QModelIndex&, const QModelIndex&))); - connect (lands, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (landAboutToBeRemoved (const QModelIndex&, int, int))); - connect (lands, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (landAdded (const QModelIndex&, int, int))); + connect (lands, &QAbstractItemModel::dataChanged, + this, &PagedWorldspaceWidget::landDataChanged); + connect (lands, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &PagedWorldspaceWidget::landAboutToBeRemoved); + connect (lands, &QAbstractItemModel::rowsInserted, + this, &PagedWorldspaceWidget::landAdded); QAbstractItemModel *ltexs = document.getData().getTableModel (CSMWorld::UniversalId::Type_LandTextures); - connect (ltexs, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (landTextureDataChanged (const QModelIndex&, const QModelIndex&))); - connect (ltexs, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (landTextureAboutToBeRemoved (const QModelIndex&, int, int))); - connect (ltexs, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (landTextureAdded (const QModelIndex&, int, int))); + connect (ltexs, &QAbstractItemModel::dataChanged, + this, &PagedWorldspaceWidget::landTextureDataChanged); + connect (ltexs, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &PagedWorldspaceWidget::landTextureAboutToBeRemoved); + connect (ltexs, &QAbstractItemModel::rowsInserted, + this, &PagedWorldspaceWidget::landTextureAdded); // Shortcuts CSMPrefs::Shortcut* loadCameraCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-cell", this); - connect(loadCameraCellShortcut, SIGNAL(activated()), this, SLOT(loadCameraCell())); + connect(loadCameraCellShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &PagedWorldspaceWidget::loadCameraCell); CSMPrefs::Shortcut* loadCameraEastCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-eastcell", this); - connect(loadCameraEastCellShortcut, SIGNAL(activated()), this, SLOT(loadEastCell())); + connect(loadCameraEastCellShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &PagedWorldspaceWidget::loadEastCell); CSMPrefs::Shortcut* loadCameraNorthCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-northcell", this); - connect(loadCameraNorthCellShortcut, SIGNAL(activated()), this, SLOT(loadNorthCell())); + connect(loadCameraNorthCellShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &PagedWorldspaceWidget::loadNorthCell); CSMPrefs::Shortcut* loadCameraWestCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-westcell", this); - connect(loadCameraWestCellShortcut, SIGNAL(activated()), this, SLOT(loadWestCell())); + connect(loadCameraWestCellShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &PagedWorldspaceWidget::loadWestCell); CSMPrefs::Shortcut* loadCameraSouthCellShortcut = new CSMPrefs::Shortcut("scene-load-cam-southcell", this); - connect(loadCameraSouthCellShortcut, SIGNAL(activated()), this, SLOT(loadSouthCell())); + connect(loadCameraSouthCellShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &PagedWorldspaceWidget::loadSouthCell); } CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget() @@ -888,8 +893,8 @@ CSVWidget::SceneToolToggle2 *CSVRender::PagedWorldspaceWidget::makeControlVisibi mControlElements->setSelectionMask (0xffffffff); - connect (mControlElements, SIGNAL (selectionChanged()), - this, SLOT (elementSelectionChanged())); + connect (mControlElements, &CSVWidget::SceneToolToggle2::selectionChanged, + this, &PagedWorldspaceWidget::elementSelectionChanged); return mControlElements; } diff --git a/apps/opencs/view/render/pathgridselectionmode.cpp b/apps/opencs/view/render/pathgridselectionmode.cpp index db41faf50d..6f101add8a 100644 --- a/apps/opencs/view/render/pathgridselectionmode.cpp +++ b/apps/opencs/view/render/pathgridselectionmode.cpp @@ -18,8 +18,8 @@ namespace CSVRender mRemoveSelectedNodes = new QAction("Remove selected nodes", this); mRemoveSelectedEdges = new QAction("Remove edges between selected nodes", this); - connect(mRemoveSelectedNodes, SIGNAL(triggered()), this, SLOT(removeSelectedNodes())); - connect(mRemoveSelectedEdges, SIGNAL(triggered()), this, SLOT(removeSelectedEdges())); + connect(mRemoveSelectedNodes, &QAction::triggered, this, &PathgridSelectionMode::removeSelectedNodes); + connect(mRemoveSelectedEdges, &QAction::triggered, this, &PathgridSelectionMode::removeSelectedEdges); } bool PathgridSelectionMode::createContextMenu(QMenu* menu) diff --git a/apps/opencs/view/render/previewwidget.cpp b/apps/opencs/view/render/previewwidget.cpp index 522534adb6..ee1299dc66 100644 --- a/apps/opencs/view/render/previewwidget.cpp +++ b/apps/opencs/view/render/previewwidget.cpp @@ -12,13 +12,13 @@ CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data, QAbstractItemModel *referenceables = mData.getTableModel (CSMWorld::UniversalId::Type_Referenceables); - connect (referenceables, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (referenceableDataChanged (const QModelIndex&, const QModelIndex&))); - connect (referenceables, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (referenceableAboutToBeRemoved (const QModelIndex&, int, int))); + connect (referenceables, &QAbstractItemModel::dataChanged, + this, &PreviewWidget::referenceableDataChanged); + connect (referenceables, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &PreviewWidget::referenceableAboutToBeRemoved); - connect (&mData, SIGNAL (assetTablesChanged ()), - this, SLOT (assetTablesChanged ())); + connect (&mData, &CSMWorld::Data::assetTablesChanged, + this, &PreviewWidget::assetTablesChanged); setExterior(false); @@ -27,10 +27,10 @@ CSVRender::PreviewWidget::PreviewWidget (CSMWorld::Data& data, QAbstractItemModel *references = mData.getTableModel (CSMWorld::UniversalId::Type_References); - connect (references, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (referenceDataChanged (const QModelIndex&, const QModelIndex&))); - connect (references, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (referenceAboutToBeRemoved (const QModelIndex&, int, int))); + connect (references, &QAbstractItemModel::dataChanged, + this, &PreviewWidget::referenceDataChanged); + connect (references, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &PreviewWidget::referenceAboutToBeRemoved); } } diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index 5d875f4829..070259075a 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -146,7 +146,7 @@ CompositeViewer::CompositeViewer() //setRunFrameScheme(osgViewer::ViewerBase::ON_DEMAND); setRunFrameScheme(osgViewer::ViewerBase::CONTINUOUS); - connect( &mTimer, SIGNAL(timeout()), this, SLOT(update()) ); + connect(&mTimer, &QTimer::timeout, this, &CompositeViewer::update); mTimer.start( 10 ); int frameRateLimit = CSMPrefs::get()["Rendering"]["framerate-limit"].toInt(); @@ -227,8 +227,8 @@ SceneWidget::SceneWidget(std::shared_ptr resourceSyste setMouseTracking(true); setFocusPolicy(Qt::ClickFocus); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &SceneWidget::settingChanged); // TODO update this outside of the constructor where virtual methods can be used if (retrieveInput) @@ -237,14 +237,16 @@ SceneWidget::SceneWidget(std::shared_ptr resourceSyste CSMPrefs::get()["Tooltips"].update(); } - connect (&CompositeViewer::get(), SIGNAL (simulationUpdated(double)), this, SLOT (update(double))); + connect (&CompositeViewer::get(), &CompositeViewer::simulationUpdated, this, &SceneWidget::update); // Shortcuts CSMPrefs::Shortcut* focusToolbarShortcut = new CSMPrefs::Shortcut("scene-focus-toolbar", this); - connect(focusToolbarShortcut, SIGNAL(activated()), this, SIGNAL(focusToolbarRequest())); + connect(focusToolbarShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &SceneWidget::focusToolbarRequest); CSMPrefs::Shortcut* renderStatsShortcut = new CSMPrefs::Shortcut("scene-render-stats", this); - connect(renderStatsShortcut, SIGNAL(activated()), this, SLOT(toggleRenderStats())); + connect(renderStatsShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &SceneWidget::toggleRenderStats); } SceneWidget::~SceneWidget() @@ -430,8 +432,7 @@ CSVWidget::SceneToolMode *SceneWidget::makeLightingSelector (CSVWidget::SceneToo "
  • Maximum ambient
  • " "
  • Strong directional light source
"); - connect (tool, SIGNAL (modeChanged (const std::string&)), - this, SLOT (selectLightingMode (const std::string&))); + connect (tool, &CSVWidget::SceneToolMode::modeChanged, this, &SceneWidget::selectLightingMode); return tool; } diff --git a/apps/opencs/view/render/selectionmode.cpp b/apps/opencs/view/render/selectionmode.cpp index e7e7d47b5a..431181d5e7 100644 --- a/apps/opencs/view/render/selectionmode.cpp +++ b/apps/opencs/view/render/selectionmode.cpp @@ -41,9 +41,9 @@ namespace CSVRender mDeselectAll = new QAction("Clear selection", this); mInvertSelection = new QAction("Invert selection", this); - connect(mSelectAll, SIGNAL(triggered()), this, SLOT(selectAll())); - connect(mDeselectAll, SIGNAL(triggered()), this, SLOT(clearSelection())); - connect(mInvertSelection, SIGNAL(triggered()), this, SLOT(invertSelection())); + connect(mSelectAll, &QAction::triggered, this, &SelectionMode::selectAll); + connect(mDeselectAll, &QAction::triggered, this, &SelectionMode::clearSelection); + connect(mInvertSelection, &QAction::triggered, this, &SelectionMode::invertSelection); } WorldspaceWidget& SelectionMode::getWorldspaceWidget() diff --git a/apps/opencs/view/render/terrainshapemode.cpp b/apps/opencs/view/render/terrainshapemode.cpp index 3666dd835d..af39d23cf5 100644 --- a/apps/opencs/view/render/terrainshapemode.cpp +++ b/apps/opencs/view/render/terrainshapemode.cpp @@ -47,12 +47,12 @@ void CSVRender::TerrainShapeMode::activate(CSVWidget::SceneToolbar* toolbar) if(!mShapeBrushScenetool) { mShapeBrushScenetool = new CSVWidget::SceneToolShapeBrush (toolbar, "scenetoolshapebrush", getWorldspaceWidget().getDocument()); - connect(mShapeBrushScenetool, SIGNAL (clicked()), mShapeBrushScenetool, SLOT (activate())); - connect(mShapeBrushScenetool->mShapeBrushWindow, SIGNAL(passBrushSize(int)), this, SLOT(setBrushSize(int))); - connect(mShapeBrushScenetool->mShapeBrushWindow, SIGNAL(passBrushShape(CSVWidget::BrushShape)), this, SLOT(setBrushShape(CSVWidget::BrushShape))); - connect(mShapeBrushScenetool->mShapeBrushWindow->mSizeSliders->mBrushSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(setBrushSize(int))); - connect(mShapeBrushScenetool->mShapeBrushWindow->mToolSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(setShapeEditTool(int))); - connect(mShapeBrushScenetool->mShapeBrushWindow->mToolStrengthSlider, SIGNAL(valueChanged(int)), this, SLOT(setShapeEditToolStrength(int))); + connect(mShapeBrushScenetool, &CSVWidget::SceneTool::clicked, mShapeBrushScenetool, &CSVWidget::SceneToolShapeBrush::activate); + connect(mShapeBrushScenetool->mShapeBrushWindow, &CSVWidget::ShapeBrushWindow::passBrushSize, this, &TerrainShapeMode::setBrushSize); + connect(mShapeBrushScenetool->mShapeBrushWindow, &CSVWidget::ShapeBrushWindow::passBrushShape, this, &TerrainShapeMode::setBrushShape); + connect(mShapeBrushScenetool->mShapeBrushWindow->mSizeSliders->mBrushSizeSlider, &QSlider::valueChanged, this, &TerrainShapeMode::setBrushSize); + connect(mShapeBrushScenetool->mShapeBrushWindow->mToolSelector, qOverload(&QComboBox::currentIndexChanged), this, &TerrainShapeMode::setShapeEditTool); + connect(mShapeBrushScenetool->mShapeBrushWindow->mToolStrengthSlider, &QSlider::valueChanged, this, &TerrainShapeMode::setShapeEditToolStrength); } if (!mBrushDraw) diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index 3127306522..2494e4378c 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -47,16 +47,16 @@ void CSVRender::TerrainTextureMode::activate(CSVWidget::SceneToolbar* toolbar) if(!mTextureBrushScenetool) { mTextureBrushScenetool = new CSVWidget::SceneToolTextureBrush (toolbar, "scenetooltexturebrush", getWorldspaceWidget().getDocument()); - connect(mTextureBrushScenetool, SIGNAL (clicked()), mTextureBrushScenetool, SLOT (activate())); - connect(mTextureBrushScenetool->mTextureBrushWindow, SIGNAL(passBrushSize(int)), this, SLOT(setBrushSize(int))); - connect(mTextureBrushScenetool->mTextureBrushWindow, SIGNAL(passBrushShape(CSVWidget::BrushShape)), this, SLOT(setBrushShape(CSVWidget::BrushShape))); - connect(mTextureBrushScenetool->mTextureBrushWindow->mSizeSliders->mBrushSizeSlider, SIGNAL(valueChanged(int)), this, SLOT(setBrushSize(int))); - connect(mTextureBrushScenetool, SIGNAL(passTextureId(std::string)), this, SLOT(setBrushTexture(std::string))); - connect(mTextureBrushScenetool->mTextureBrushWindow, SIGNAL(passTextureId(std::string)), this, SLOT(setBrushTexture(std::string))); - - connect(mTextureBrushScenetool, SIGNAL(passEvent(QDropEvent*)), this, SLOT(handleDropEvent(QDropEvent*))); - connect(this, SIGNAL(passBrushTexture(std::string)), mTextureBrushScenetool->mTextureBrushWindow, SLOT(setBrushTexture(std::string))); - connect(this, SIGNAL(passBrushTexture(std::string)), mTextureBrushScenetool, SLOT(updateBrushHistory(std::string))); + connect(mTextureBrushScenetool, &CSVWidget::SceneTool::clicked, mTextureBrushScenetool, &CSVWidget::SceneToolTextureBrush::activate); + connect(mTextureBrushScenetool->mTextureBrushWindow, &CSVWidget::TextureBrushWindow::passBrushSize, this, &TerrainTextureMode::setBrushSize); + connect(mTextureBrushScenetool->mTextureBrushWindow, &CSVWidget::TextureBrushWindow::passBrushShape, this, &TerrainTextureMode::setBrushShape); + connect(mTextureBrushScenetool->mTextureBrushWindow->mSizeSliders->mBrushSizeSlider, &QSlider::valueChanged, this, &TerrainTextureMode::setBrushSize); + connect(mTextureBrushScenetool, &CSVWidget::SceneToolTextureBrush::passTextureId, this, &TerrainTextureMode::setBrushTexture); + connect(mTextureBrushScenetool->mTextureBrushWindow, &CSVWidget::TextureBrushWindow::passTextureId, this, &TerrainTextureMode::setBrushTexture); + + connect(mTextureBrushScenetool, qOverload(&CSVWidget::SceneToolTextureBrush::passEvent), this, &TerrainTextureMode::handleDropEvent); + connect(this, &TerrainTextureMode::passBrushTexture, mTextureBrushScenetool->mTextureBrushWindow, &CSVWidget::TextureBrushWindow::setBrushTexture); + connect(this, &TerrainTextureMode::passBrushTexture, mTextureBrushScenetool, &CSVWidget::SceneToolTextureBrush::updateBrushHistory); } if (!mTerrainTextureSelection) diff --git a/apps/opencs/view/render/unpagedworldspacewidget.cpp b/apps/opencs/view/render/unpagedworldspacewidget.cpp index d9ba551ccb..eb0d5ce38d 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.cpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.cpp @@ -44,13 +44,13 @@ CSVRender::UnpagedWorldspaceWidget::UnpagedWorldspaceWidget (const std::string& mReferenceablesModel = &dynamic_cast ( *document.getData().getTableModel (CSMWorld::UniversalId::Type_Referenceables)); - connect (mCellsModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (cellDataChanged (const QModelIndex&, const QModelIndex&))); - connect (mCellsModel, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (cellRowsAboutToBeRemoved (const QModelIndex&, int, int))); + connect (mCellsModel, &CSMWorld::IdTable::dataChanged, + this, &UnpagedWorldspaceWidget::cellDataChanged); + connect (mCellsModel, &CSMWorld::IdTable::rowsAboutToBeRemoved, + this, &UnpagedWorldspaceWidget::cellRowsAboutToBeRemoved); - connect (&document.getData(), SIGNAL (assetTablesChanged ()), - this, SLOT (assetTablesChanged ())); + connect (&document.getData(), &CSMWorld::Data::assetTablesChanged, + this, &UnpagedWorldspaceWidget::assetTablesChanged); update(); diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 50e2968251..11fe7c6717 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -55,42 +55,42 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg QAbstractItemModel *referenceables = document.getData().getTableModel (CSMWorld::UniversalId::Type_Referenceables); - connect (referenceables, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (referenceableDataChanged (const QModelIndex&, const QModelIndex&))); - connect (referenceables, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (referenceableAboutToBeRemoved (const QModelIndex&, int, int))); - connect (referenceables, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (referenceableAdded (const QModelIndex&, int, int))); + connect (referenceables, &QAbstractItemModel::dataChanged, + this, &WorldspaceWidget::referenceableDataChanged); + connect (referenceables, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &WorldspaceWidget::referenceableAboutToBeRemoved); + connect (referenceables, &QAbstractItemModel::rowsInserted, + this, &WorldspaceWidget::referenceableAdded); QAbstractItemModel *references = document.getData().getTableModel (CSMWorld::UniversalId::Type_References); - connect (references, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (referenceDataChanged (const QModelIndex&, const QModelIndex&))); - connect (references, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (referenceAboutToBeRemoved (const QModelIndex&, int, int))); - connect (references, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (referenceAdded (const QModelIndex&, int, int))); + connect (references, &QAbstractItemModel::dataChanged, + this, &WorldspaceWidget::referenceDataChanged); + connect (references, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &WorldspaceWidget::referenceAboutToBeRemoved); + connect (references, &QAbstractItemModel::rowsInserted, + this, &WorldspaceWidget::referenceAdded); QAbstractItemModel *pathgrids = document.getData().getTableModel (CSMWorld::UniversalId::Type_Pathgrids); - connect (pathgrids, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (pathgridDataChanged (const QModelIndex&, const QModelIndex&))); - connect (pathgrids, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (pathgridAboutToBeRemoved (const QModelIndex&, int, int))); - connect (pathgrids, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (pathgridAdded (const QModelIndex&, int, int))); + connect (pathgrids, &QAbstractItemModel::dataChanged, + this, &WorldspaceWidget::pathgridDataChanged); + connect (pathgrids, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &WorldspaceWidget::pathgridAboutToBeRemoved); + connect (pathgrids, &QAbstractItemModel::rowsInserted, + this, &WorldspaceWidget::pathgridAdded); QAbstractItemModel *debugProfiles = document.getData().getTableModel (CSMWorld::UniversalId::Type_DebugProfiles); - connect (debugProfiles, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (debugProfileDataChanged (const QModelIndex&, const QModelIndex&))); - connect (debugProfiles, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (debugProfileAboutToBeRemoved (const QModelIndex&, int, int))); + connect (debugProfiles, &QAbstractItemModel::dataChanged, + this, &WorldspaceWidget::debugProfileDataChanged); + connect (debugProfiles, &QAbstractItemModel::rowsAboutToBeRemoved, + this, &WorldspaceWidget::debugProfileAboutToBeRemoved); mToolTipDelayTimer.setSingleShot (true); - connect (&mToolTipDelayTimer, SIGNAL (timeout()), this, SLOT (showToolTip())); + connect (&mToolTipDelayTimer, &QTimer::timeout, this, &WorldspaceWidget::showToolTip); CSMPrefs::get()["3D Scene Input"].update(); CSMPrefs::get()["Tooltips"].update(); @@ -100,21 +100,28 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidg CSMPrefs::Shortcut::SM_Detach, this); CSMPrefs::Shortcut* primaryOpenShortcut = new CSMPrefs::Shortcut("scene-open-primary", this); - connect(primaryOpenShortcut, SIGNAL(activated(bool)), this, SLOT(primaryOpen(bool))); - connect(primaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(primaryEdit(bool))); - connect(primaryEditShortcut, SIGNAL(secondary(bool)), this, SLOT(speedMode(bool))); + connect(primaryOpenShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::primaryOpen); + connect(primaryEditShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::primaryEdit); + connect(primaryEditShortcut, qOverload(&CSMPrefs::Shortcut::secondary), + this, &WorldspaceWidget::speedMode); CSMPrefs::Shortcut* secondaryEditShortcut = new CSMPrefs::Shortcut("scene-edit-secondary", this); - connect(secondaryEditShortcut, SIGNAL(activated(bool)), this, SLOT(secondaryEdit(bool))); + connect(secondaryEditShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::secondaryEdit); CSMPrefs::Shortcut* primarySelectShortcut = new CSMPrefs::Shortcut("scene-select-primary", this); - connect(primarySelectShortcut, SIGNAL(activated(bool)), this, SLOT(primarySelect(bool))); + connect(primarySelectShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::primarySelect); CSMPrefs::Shortcut* secondarySelectShortcut = new CSMPrefs::Shortcut("scene-select-secondary", this); - connect(secondarySelectShortcut, SIGNAL(activated(bool)), this, SLOT(secondarySelect(bool))); + connect(secondarySelectShortcut, qOverload(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::secondarySelect); CSMPrefs::Shortcut* abortShortcut = new CSMPrefs::Shortcut("scene-edit-abort", this); - connect(abortShortcut, SIGNAL(activated()), this, SLOT(abortDrag())); + connect(abortShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &WorldspaceWidget::abortDrag); mInConstructor = false; } @@ -209,8 +216,8 @@ CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeNavigationSelector ( "", tool), "orbit"); - connect (tool, SIGNAL (modeChanged (const std::string&)), - this, SLOT (selectNavigationMode (const std::string&))); + connect (tool, &CSVWidget::SceneToolMode::modeChanged, + this, &WorldspaceWidget::selectNavigationMode); return tool; } @@ -224,8 +231,8 @@ CSVWidget::SceneToolToggle2 *CSVRender::WorldspaceWidget::makeSceneVisibilitySel mSceneElements->setSelectionMask (0xffffffff); - connect (mSceneElements, SIGNAL (selectionChanged()), - this, SLOT (elementSelectionChanged())); + connect (mSceneElements, &CSVWidget::SceneToolToggle2::selectionChanged, + this, &WorldspaceWidget::elementSelectionChanged); return mSceneElements; } @@ -261,8 +268,8 @@ CSVWidget::SceneToolRun *CSVRender::WorldspaceWidget::makeRunTool ( mRun = new CSVWidget::SceneToolRun (parent, "Run OpenMW from the current camera position", ":scenetoolbar/play", profiles); - connect (mRun, SIGNAL (runRequest (const std::string&)), - this, SLOT (runRequest (const std::string&))); + connect (mRun, &CSVWidget::SceneToolRun::runRequest, + this, &WorldspaceWidget::runRequest); return mRun; } @@ -274,8 +281,8 @@ CSVWidget::SceneToolMode *CSVRender::WorldspaceWidget::makeEditModeSelector ( addEditModeSelectorButtons (mEditMode); - connect (mEditMode, SIGNAL (modeChanged (const std::string&)), - this, SLOT (editModeChanged (const std::string&))); + connect (mEditMode, &CSVWidget::SceneToolMode::modeChanged, + this, &WorldspaceWidget::editModeChanged); return mEditMode; } diff --git a/apps/opencs/view/tools/merge.cpp b/apps/opencs/view/tools/merge.cpp index 2f94ef0ed5..74daa7d8b9 100644 --- a/apps/opencs/view/tools/merge.cpp +++ b/apps/opencs/view/tools/merge.cpp @@ -72,17 +72,16 @@ CSVTools::Merge::Merge (CSMDoc::DocumentManager& documentManager, QWidget *paren rightLayout->addWidget (mAdjuster); - connect (mNewFile, SIGNAL (nameChanged (const QString&, bool)), - mAdjuster, SLOT (setName (const QString&, bool))); - connect (mAdjuster, SIGNAL (stateChanged (bool)), this, SLOT (stateChanged (bool))); + connect (mNewFile, &CSVDoc::FileWidget::nameChanged, mAdjuster, &CSVDoc::AdjusterWidget::setName); + connect (mAdjuster, &CSVDoc::AdjusterWidget::stateChanged, this, &Merge::stateChanged); // buttons QDialogButtonBox *buttons = new QDialogButtonBox (QDialogButtonBox::Cancel, Qt::Horizontal, this); - connect (buttons->button (QDialogButtonBox::Cancel), SIGNAL (clicked()), this, SLOT (cancel())); + connect (buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &Merge::cancel); mOkay = new QPushButton ("Merge", this); - connect (mOkay, SIGNAL (clicked()), this, SLOT (accept())); + connect (mOkay, &QPushButton::clicked, this, &Merge::accept); mOkay->setDefault (true); buttons->addButton (mOkay, QDialogButtonBox::AcceptRole); diff --git a/apps/opencs/view/tools/reportsubview.cpp b/apps/opencs/view/tools/reportsubview.cpp index e3d08bd87b..c505ce7e31 100644 --- a/apps/opencs/view/tools/reportsubview.cpp +++ b/apps/opencs/view/tools/reportsubview.cpp @@ -13,15 +13,13 @@ CSVTools::ReportSubView::ReportSubView (const CSMWorld::UniversalId& id, CSMDoc: setWidget (mTable = new ReportTable (document, id, false, mRefreshState, this)); - connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)), - SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&))); - + connect (mTable, &ReportTable::editRequest, this, &ReportSubView::focusId); + if (mRefreshState==CSMDoc::State_Verifying) { - connect (mTable, SIGNAL (refreshRequest()), this, SLOT (refreshRequest())); + connect (mTable, &ReportTable::refreshRequest, this, &ReportSubView::refreshRequest); - connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)), - mTable, SLOT (stateChanged (int, CSMDoc::Document *))); + connect (&document, &CSMDoc::Document::stateChanged, mTable, &ReportTable::stateChanged); } } diff --git a/apps/opencs/view/tools/reporttable.cpp b/apps/opencs/view/tools/reporttable.cpp index c1297d475b..4c61c574cd 100644 --- a/apps/opencs/view/tools/reporttable.cpp +++ b/apps/opencs/view/tools/reporttable.cpp @@ -168,19 +168,19 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document, setItemDelegateForColumn (mModel->columnCount()-1, new RichTextDelegate (this)); mShowAction = new QAction (tr ("Show"), this); - connect (mShowAction, SIGNAL (triggered()), this, SLOT (showSelection())); + connect (mShowAction, &QAction::triggered, this, &ReportTable::showSelection); addAction (mShowAction); CSMPrefs::Shortcut* showShortcut = new CSMPrefs::Shortcut("reporttable-show", this); showShortcut->associateAction(mShowAction); mRemoveAction = new QAction (tr ("Remove from list"), this); - connect (mRemoveAction, SIGNAL (triggered()), this, SLOT (removeSelection())); + connect (mRemoveAction, &QAction::triggered, this, &ReportTable::removeSelection); addAction (mRemoveAction); CSMPrefs::Shortcut* removeShortcut = new CSMPrefs::Shortcut("reporttable-remove", this); removeShortcut->associateAction(mRemoveAction); mReplaceAction = new QAction (tr ("Replace"), this); - connect (mReplaceAction, SIGNAL (triggered()), this, SIGNAL (replaceRequest())); + connect (mReplaceAction, &QAction::triggered, this, &ReportTable::replaceRequest); addAction (mReplaceAction); CSMPrefs::Shortcut* replaceShortcut = new CSMPrefs::Shortcut("reporttable-replace", this); replaceShortcut->associateAction(mReplaceAction); @@ -189,7 +189,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document, { mRefreshAction = new QAction (tr ("Refresh"), this); mRefreshAction->setEnabled (!(mDocument.getState() & mRefreshState)); - connect (mRefreshAction, SIGNAL (triggered()), this, SIGNAL (refreshRequest())); + connect (mRefreshAction, &QAction::triggered, this, &ReportTable::refreshRequest); addAction (mRefreshAction); CSMPrefs::Shortcut* refreshShortcut = new CSMPrefs::Shortcut("reporttable-refresh", this); refreshShortcut->associateAction(mRefreshAction); @@ -199,8 +199,8 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document, mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier, Action_Remove)); mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_EditAndRemove)); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &ReportTable::settingChanged); CSMPrefs::get()["Reports"].update(); } diff --git a/apps/opencs/view/tools/searchbox.cpp b/apps/opencs/view/tools/searchbox.cpp index f89f82ef79..880060ac25 100644 --- a/apps/opencs/view/tools/searchbox.cpp +++ b/apps/opencs/view/tools/searchbox.cpp @@ -45,17 +45,17 @@ CSVTools::SearchBox::SearchBox (QWidget *parent) for (std::vector>::const_iterator iter (states.begin()); iter!=states.end(); ++iter) mRecordState.addItem (QString::fromUtf8 (iter->second.c_str())); - + mMode.addItem (tr("Text")); mMode.addItem (tr("Text (RegEx)")); mMode.addItem (tr("ID")); mMode.addItem (tr("ID (RegEx)")); mMode.addItem (tr("Record State")); - connect (&mMode, SIGNAL (activated (int)), this, SLOT (modeSelected (int))); + connect (&mMode, qOverload(&QComboBox::activated), this, &SearchBox::modeSelected); mLayout->addWidget (&mMode, 0, 0); - connect (&mText, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&))); - connect (&mText, SIGNAL (returnPressed()), this, SLOT (startSearch())); + connect (&mText, &QLineEdit::textChanged, this, &SearchBox::textChanged); + connect (&mText, &QLineEdit::returnPressed, this, [this](){ this->startSearch(false); }); mInput.insertWidget (0, &mText); mInput.insertWidget (1, &mRecordState); @@ -64,7 +64,7 @@ CSVTools::SearchBox::SearchBox (QWidget *parent) mCaseSensitive.setText (tr ("Case")); mLayout->addWidget (&mCaseSensitive, 0, 2); - connect (&mSearch, SIGNAL (clicked (bool)), this, SLOT (startSearch (bool))); + connect (&mSearch, &QPushButton::clicked, this, qOverload(&SearchBox::startSearch)); mLayout->addWidget (&mSearch, 0, 3); // replace panel @@ -74,15 +74,15 @@ CSVTools::SearchBox::SearchBox (QWidget *parent) mLayout->addWidget (&mReplaceInput, 1, 1); mLayout->addWidget (&mReplace, 1, 3); - + // layout adjustments mLayout->setColumnMinimumWidth (2, 50); mLayout->setColumnStretch (1, 1); mLayout->setContentsMargins (0, 0, 0, 0); - connect (&mReplace, (SIGNAL (clicked (bool))), this, SLOT (replaceAll (bool))); - + connect (&mReplace, &QPushButton::clicked, this, qOverload(&SearchBox::replaceAll)); + // update modeSelected (0); @@ -97,7 +97,7 @@ void CSVTools::SearchBox::setSearchMode (bool enabled) CSMTools::Search CSVTools::SearchBox::getSearch() const { - CSMTools::Search::Type type = static_cast (mMode.currentIndex()); + CSMTools::Search::Type type = static_cast (mMode.currentIndex()); bool caseSensitive = mCaseSensitive.isChecked(); switch (type) @@ -106,12 +106,12 @@ CSMTools::Search CSVTools::SearchBox::getSearch() const case CSMTools::Search::Type_Id: return CSMTools::Search (type, caseSensitive, std::string (mText.text().toUtf8().data())); - + case CSMTools::Search::Type_TextRegEx: case CSMTools::Search::Type_IdRegEx: return CSMTools::Search (type, caseSensitive, QRegExp (mText.text().toUtf8().data(), Qt::CaseInsensitive)); - + case CSMTools::Search::Type_RecordState: return CSMTools::Search (type, caseSensitive, mRecordState.currentIndex()); @@ -127,7 +127,7 @@ CSMTools::Search CSVTools::SearchBox::getSearch() const std::string CSVTools::SearchBox::getReplaceText() const { CSMTools::Search::Type type = static_cast (mMode.currentIndex()); - + switch (type) { case CSMTools::Search::Type_Text: @@ -173,7 +173,7 @@ void CSVTools::SearchBox::modeSelected (int index) } mInput.currentWidget()->setFocus(); - + updateSearchButton(); } diff --git a/apps/opencs/view/tools/searchsubview.cpp b/apps/opencs/view/tools/searchsubview.cpp index d687cbeb3f..64e0e133d0 100644 --- a/apps/opencs/view/tools/searchsubview.cpp +++ b/apps/opencs/view/tools/searchsubview.cpp @@ -88,27 +88,25 @@ CSVTools::SearchSubView::SearchSubView (const CSMWorld::UniversalId& id, CSMDoc: stateChanged (document.getState(), &document); - connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)), - SIGNAL (focusId (const CSMWorld::UniversalId&, const std::string&))); + connect (mTable, &ReportTable::editRequest, this, &SearchSubView::focusId); - connect (mTable, SIGNAL (replaceRequest()), this, SLOT (replaceRequest())); + connect (mTable, &ReportTable::replaceRequest, this, &SearchSubView::replaceRequest); - connect (&document, SIGNAL (stateChanged (int, CSMDoc::Document *)), - this, SLOT (stateChanged (int, CSMDoc::Document *))); + connect (&document, &CSMDoc::Document::stateChanged, this, &SearchSubView::stateChanged); - connect (&mSearchBox, SIGNAL (startSearch (const CSMTools::Search&)), - this, SLOT (startSearch (const CSMTools::Search&))); + connect (&mSearchBox, qOverload(&SearchBox::startSearch), + this, &SearchSubView::startSearch); - connect (&mSearchBox, SIGNAL (replaceAll()), this, SLOT (replaceAllRequest())); + connect (&mSearchBox, qOverload<>(&SearchBox::replaceAll), this, + &SearchSubView::replaceAllRequest); - connect (document.getReport (id), SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (tableSizeUpdate())); + connect (document.getReport(id), &CSMTools::ReportModel::rowsRemoved, + this, &SearchSubView::tableSizeUpdate); - connect (document.getReport (id), SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (tableSizeUpdate())); + connect (document.getReport(id), &CSMTools::ReportModel::rowsInserted, + this, &SearchSubView::tableSizeUpdate); - connect (&document, SIGNAL (operationDone (int, bool)), - this, SLOT (operationDone (int, bool))); + connect (&document, &CSMDoc::Document::operationDone, this, &SearchSubView::operationDone); } void CSVTools::SearchSubView::setEditLock (bool locked) diff --git a/apps/opencs/view/widget/coloreditor.cpp b/apps/opencs/view/widget/coloreditor.cpp index 1d1f4af1ce..460c3fc707 100644 --- a/apps/opencs/view/widget/coloreditor.cpp +++ b/apps/opencs/view/widget/coloreditor.cpp @@ -24,8 +24,8 @@ CSVWidget::ColorEditor::ColorEditor(QWidget *parent, const bool popupOnStart) mColorPicker(new ColorPickerPopup(this)), mPopupOnStart(popupOnStart) { - connect(this, SIGNAL(clicked()), this, SLOT(showPicker())); - connect(mColorPicker, SIGNAL(colorChanged(const QColor &)), this, SLOT(pickerColorChanged(const QColor &))); + connect(this, &ColorEditor::clicked, this, &ColorEditor::showPicker); + connect(mColorPicker, &ColorPickerPopup::colorChanged, this, &ColorEditor::pickerColorChanged); } void CSVWidget::ColorEditor::paintEvent(QPaintEvent *event) diff --git a/apps/opencs/view/widget/colorpickerpopup.cpp b/apps/opencs/view/widget/colorpickerpopup.cpp index 0c98698ea6..5a48b87f39 100644 --- a/apps/opencs/view/widget/colorpickerpopup.cpp +++ b/apps/opencs/view/widget/colorpickerpopup.cpp @@ -18,10 +18,8 @@ CSVWidget::ColorPickerPopup::ColorPickerPopup(QWidget *parent) mColorPicker->setWindowFlags(Qt::Widget); mColorPicker->setOptions(QColorDialog::NoButtons | QColorDialog::DontUseNativeDialog); mColorPicker->installEventFilter(this); - connect(mColorPicker, - SIGNAL(currentColorChanged(const QColor &)), - this, - SIGNAL(colorChanged(const QColor &))); + connect(mColorPicker, &QColorDialog::currentColorChanged, + this, &ColorPickerPopup::colorChanged); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(mColorPicker); diff --git a/apps/opencs/view/widget/pushbutton.cpp b/apps/opencs/view/widget/pushbutton.cpp index c4e6a41442..31fdf5a19f 100644 --- a/apps/opencs/view/widget/pushbutton.cpp +++ b/apps/opencs/view/widget/pushbutton.cpp @@ -82,14 +82,14 @@ CSVWidget::PushButton::PushButton (const QIcon& icon, Type type, const QString& if (type==Type_Mode || type==Type_Toggle) { setCheckable (true); - connect (this, SIGNAL (toggled (bool)), this, SLOT (checkedStateChanged (bool))); + connect (this, &PushButton::toggled, this, &PushButton::checkedStateChanged); } setCheckable (type==Type_Mode || type==Type_Toggle); processShortcuts(); setExtendedToolTip(); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &PushButton::settingChanged); } CSVWidget::PushButton::PushButton (Type type, const QString& tooltip, QWidget *parent) diff --git a/apps/opencs/view/widget/scenetool.cpp b/apps/opencs/view/widget/scenetool.cpp index 796b985678..9923c26e96 100644 --- a/apps/opencs/view/widget/scenetool.cpp +++ b/apps/opencs/view/widget/scenetool.cpp @@ -11,7 +11,7 @@ CSVWidget::SceneTool::SceneTool (SceneToolbar *parent, Type type) setIconSize (QSize (parent->getIconSize(), parent->getIconSize())); setFixedSize (parent->getButtonSize(), parent->getButtonSize()); - connect (this, SIGNAL (clicked()), this, SLOT (openRequest())); + connect (this, &SceneTool::clicked, this, &SceneTool::openRequest); } void CSVWidget::SceneTool::activate() {} diff --git a/apps/opencs/view/widget/scenetoolbar.cpp b/apps/opencs/view/widget/scenetoolbar.cpp index a2458397f7..81155150b8 100644 --- a/apps/opencs/view/widget/scenetoolbar.cpp +++ b/apps/opencs/view/widget/scenetoolbar.cpp @@ -27,7 +27,8 @@ CSVWidget::SceneToolbar::SceneToolbar (int buttonSize, QWidget *parent) setLayout (mLayout); CSMPrefs::Shortcut* focusSceneShortcut = new CSMPrefs::Shortcut("scene-focus-toolbar", this); - connect(focusSceneShortcut, SIGNAL(activated()), this, SIGNAL(focusSceneRequest())); + connect(focusSceneShortcut, qOverload<>(&CSMPrefs::Shortcut::activated), + this, &SceneToolbar::focusSceneRequest); } void CSVWidget::SceneToolbar::addTool (SceneTool *tool, SceneTool *insertPoint) diff --git a/apps/opencs/view/widget/scenetoolmode.cpp b/apps/opencs/view/widget/scenetoolmode.cpp index ae923f5b37..90b6c36e31 100644 --- a/apps/opencs/view/widget/scenetoolmode.cpp +++ b/apps/opencs/view/widget/scenetoolmode.cpp @@ -100,7 +100,7 @@ void CSVWidget::SceneToolMode::addButton (ModeButton *button, const std::string& mButtons.insert (std::make_pair (button, id)); - connect (button, SIGNAL (clicked()), this, SLOT (selected())); + connect (button, &ModeButton::clicked, this, &SceneToolMode::selected); if (mButtons.size()==1) { diff --git a/apps/opencs/view/widget/scenetoolrun.cpp b/apps/opencs/view/widget/scenetoolrun.cpp index 24bcf3f136..5dde1a2ccd 100644 --- a/apps/opencs/view/widget/scenetoolrun.cpp +++ b/apps/opencs/view/widget/scenetoolrun.cpp @@ -70,8 +70,7 @@ CSVWidget::SceneToolRun::SceneToolRun (SceneToolbar *parent, const QString& tool layout->addWidget (mTable); - connect (mTable, SIGNAL (clicked (const QModelIndex&)), - this, SLOT (clicked (const QModelIndex&))); + connect (mTable, &QTableWidget::clicked, this, &SceneToolRun::clicked); } void CSVWidget::SceneToolRun::showPanel (const QPoint& position) diff --git a/apps/opencs/view/widget/scenetoolshapebrush.cpp b/apps/opencs/view/widget/scenetoolshapebrush.cpp index dcb2fe8e41..834f739e2f 100644 --- a/apps/opencs/view/widget/scenetoolshapebrush.cpp +++ b/apps/opencs/view/widget/scenetoolshapebrush.cpp @@ -39,8 +39,8 @@ CSVWidget::ShapeBrushSizeControls::ShapeBrushSizeControls(const QString &title, layoutSliderSize->addWidget(mBrushSizeSlider); layoutSliderSize->addWidget(mBrushSizeSpinBox); - connect(mBrushSizeSlider, SIGNAL(valueChanged(int)), mBrushSizeSpinBox, SLOT(setValue(int))); - connect(mBrushSizeSpinBox, SIGNAL(valueChanged(int)), mBrushSizeSlider, SLOT(setValue(int))); + connect(mBrushSizeSlider, &QSlider::valueChanged, mBrushSizeSpinBox, &QSpinBox::setValue); + connect(mBrushSizeSpinBox, qOverload(&QSpinBox::valueChanged), mBrushSizeSlider, &QSlider::setValue); setLayout(layoutSliderSize); } @@ -115,10 +115,10 @@ CSVWidget::ShapeBrushWindow::ShapeBrushWindow(CSMDoc::Document& document, QWidge setLayout(layoutMain); - connect(mButtonPoint, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonSquare, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonCircle, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonCustom, SIGNAL(clicked()), this, SLOT(setBrushShape())); + connect(mButtonPoint, &QPushButton::clicked, this, &ShapeBrushWindow::setBrushShape); + connect(mButtonSquare, &QPushButton::clicked, this, &ShapeBrushWindow::setBrushShape); + connect(mButtonCircle, &QPushButton::clicked, this, &ShapeBrushWindow::setBrushShape); + connect(mButtonCustom, &QPushButton::clicked, this, &ShapeBrushWindow::setBrushShape); } void CSVWidget::ShapeBrushWindow::configureButtonInitialSettings(QPushButton *button) @@ -156,7 +156,7 @@ CSVWidget::SceneToolShapeBrush::SceneToolShapeBrush (SceneToolbar *parent, const mShapeBrushWindow(new ShapeBrushWindow(document, this)) { setAcceptDrops(true); - connect(mShapeBrushWindow, SIGNAL(passBrushShape(CSVWidget::BrushShape)), this, SLOT(setButtonIcon(CSVWidget::BrushShape))); + connect(mShapeBrushWindow, &ShapeBrushWindow::passBrushShape, this, &SceneToolShapeBrush::setButtonIcon); setButtonIcon(mShapeBrushWindow->mBrushShape); mPanel = new QFrame (this, Qt::Popup); @@ -176,8 +176,7 @@ CSVWidget::SceneToolShapeBrush::SceneToolShapeBrush (SceneToolbar *parent, const layout->addWidget (mTable); - connect (mTable, SIGNAL (clicked (const QModelIndex&)), - this, SLOT (clicked (const QModelIndex&))); + connect (mTable, &QTableWidget::clicked, this, &SceneToolShapeBrush::clicked); } diff --git a/apps/opencs/view/widget/scenetooltexturebrush.cpp b/apps/opencs/view/widget/scenetooltexturebrush.cpp index e412392dfc..2ba0d3bcb0 100644 --- a/apps/opencs/view/widget/scenetooltexturebrush.cpp +++ b/apps/opencs/view/widget/scenetooltexturebrush.cpp @@ -44,8 +44,8 @@ CSVWidget::BrushSizeControls::BrushSizeControls(const QString &title, QWidget *p mLayoutSliderSize->addWidget(mBrushSizeSlider); mLayoutSliderSize->addWidget(mBrushSizeSpinBox); - connect(mBrushSizeSlider, SIGNAL(valueChanged(int)), mBrushSizeSpinBox, SLOT(setValue(int))); - connect(mBrushSizeSpinBox, SIGNAL(valueChanged(int)), mBrushSizeSlider, SLOT(setValue(int))); + connect(mBrushSizeSlider, &QSlider::valueChanged, mBrushSizeSpinBox, &QSpinBox::setValue); + connect(mBrushSizeSpinBox, qOverload(&QSpinBox::valueChanged), mBrushSizeSlider, &QSlider::setValue); setLayout(mLayoutSliderSize); } @@ -117,10 +117,10 @@ CSVWidget::TextureBrushWindow::TextureBrushWindow(CSMDoc::Document& document, QW setLayout(layoutMain); - connect(mButtonPoint, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonSquare, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonCircle, SIGNAL(clicked()), this, SLOT(setBrushShape())); - connect(mButtonCustom, SIGNAL(clicked()), this, SLOT(setBrushShape())); + connect(mButtonPoint, &QPushButton::clicked, this, &TextureBrushWindow::setBrushShape); + connect(mButtonSquare, &QPushButton::clicked, this, &TextureBrushWindow::setBrushShape); + connect(mButtonCircle, &QPushButton::clicked, this, &TextureBrushWindow::setBrushShape); + connect(mButtonCustom, &QPushButton::clicked, this, &TextureBrushWindow::setBrushShape); } void CSVWidget::TextureBrushWindow::configureButtonInitialSettings(QPushButton *button) @@ -224,7 +224,7 @@ CSVWidget::SceneToolTextureBrush::SceneToolTextureBrush (SceneToolbar *parent, c mBrushHistory[0] = "L0#0"; setAcceptDrops(true); - connect(mTextureBrushWindow, SIGNAL(passBrushShape(CSVWidget::BrushShape)), this, SLOT(setButtonIcon(CSVWidget::BrushShape))); + connect(mTextureBrushWindow, &TextureBrushWindow::passBrushShape, this, &SceneToolTextureBrush::setButtonIcon); setButtonIcon(mTextureBrushWindow->mBrushShape); mPanel = new QFrame (this, Qt::Popup); @@ -244,8 +244,7 @@ CSVWidget::SceneToolTextureBrush::SceneToolTextureBrush (SceneToolbar *parent, c layout->addWidget (mTable); - connect (mTable, SIGNAL (clicked (const QModelIndex&)), - this, SLOT (clicked (const QModelIndex&))); + connect (mTable, &QTableWidget::clicked, this, &SceneToolTextureBrush::clicked); } diff --git a/apps/opencs/view/widget/scenetooltoggle.cpp b/apps/opencs/view/widget/scenetooltoggle.cpp index 04ac3322bf..c9bdaba6db 100644 --- a/apps/opencs/view/widget/scenetooltoggle.cpp +++ b/apps/opencs/view/widget/scenetooltoggle.cpp @@ -158,7 +158,7 @@ void CSVWidget::SceneToolToggle::addButton (const std::string& icon, unsigned in mButtons.insert (std::make_pair (button, desc)); - connect (button, SIGNAL (clicked()), this, SLOT (selected())); + connect (button, &PushButton::clicked, this, &SceneToolToggle::selected); if (mButtons.size()==1) mFirst = button; diff --git a/apps/opencs/view/widget/scenetooltoggle2.cpp b/apps/opencs/view/widget/scenetooltoggle2.cpp index 4042c1fccb..53f4ece105 100644 --- a/apps/opencs/view/widget/scenetooltoggle2.cpp +++ b/apps/opencs/view/widget/scenetooltoggle2.cpp @@ -102,7 +102,7 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id, unsigned int mask, mButtons.insert (std::make_pair (button, desc)); - connect (button, SIGNAL (clicked()), this, SLOT (selected())); + connect (button, &QPushButton::clicked, this, &SceneToolToggle2::selected); if (mButtons.size()==1 && !disabled) mFirst = button; diff --git a/apps/opencs/view/world/bodypartcreator.cpp b/apps/opencs/view/world/bodypartcreator.cpp index a9fc3e063f..29061ae1dc 100644 --- a/apps/opencs/view/world/bodypartcreator.cpp +++ b/apps/opencs/view/world/bodypartcreator.cpp @@ -26,7 +26,7 @@ CSVWorld::BodyPartCreator::BodyPartCreator( mFirstPerson = new QCheckBox("First Person", this); insertBeforeButtons(mFirstPerson, false); - connect(mFirstPerson, SIGNAL(clicked(bool)), this, SLOT(checkboxClicked())); + connect(mFirstPerson, &QCheckBox::clicked, this, &BodyPartCreator::checkboxClicked); } std::string CSVWorld::BodyPartCreator::getErrors() const diff --git a/apps/opencs/view/world/cellcreator.cpp b/apps/opencs/view/world/cellcreator.cpp index 22c27c3d74..9f721aa51d 100644 --- a/apps/opencs/view/world/cellcreator.cpp +++ b/apps/opencs/view/world/cellcreator.cpp @@ -39,7 +39,7 @@ CSVWorld::CellCreator::CellCreator (CSMWorld::Data& data, QUndoStack& undoStack, mY->setVisible (false); mY->setMinimum (std::numeric_limits::min()); mY->setMaximum (std::numeric_limits::max()); - connect (mY, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); + connect (mY, qOverload(&QSpinBox::valueChanged), this, &CellCreator::valueChanged); insertAtBeginning (mY, true); mYLabel = new QLabel ("Y", this); @@ -50,7 +50,7 @@ CSVWorld::CellCreator::CellCreator (CSMWorld::Data& data, QUndoStack& undoStack, mX->setVisible (false); mX->setMinimum (std::numeric_limits::min()); mX->setMaximum (std::numeric_limits::max()); - connect (mX, SIGNAL (valueChanged (int)), this, SLOT (valueChanged (int))); + connect (mX, qOverload(&QSpinBox::valueChanged), this, &CellCreator::valueChanged); insertAtBeginning (mX, true); mXLabel = new QLabel ("X", this); @@ -62,7 +62,7 @@ CSVWorld::CellCreator::CellCreator (CSMWorld::Data& data, QUndoStack& undoStack, mType->addItem ("Interior Cell"); mType->addItem ("Exterior Cell"); - connect (mType, SIGNAL (currentIndexChanged (int)), this, SLOT (setType (int))); + connect (mType, qOverload(&QComboBox::currentIndexChanged), this, &CellCreator::setType); insertAtBeginning (mType, false); } @@ -99,7 +99,7 @@ void CSVWorld::CellCreator::valueChanged (int index) update(); } -void CSVWorld::CellCreator::cloneMode(const std::string& originId, +void CSVWorld::CellCreator::cloneMode(const std::string& originId, const CSMWorld::UniversalId::Type type) { CSVWorld::GenericCreator::cloneMode(originId, type); diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 459f55780a..8d7fa875f1 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -270,36 +270,42 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase:: // is required here if (qobject_cast(editor)) { - connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &CSVWidget::DropLineEdit::editingFinished, + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); - connect(editor, SIGNAL(tableMimeDataDropped(const CSMWorld::UniversalId&, const CSMDoc::Document*)), - proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &CSVWidget::DropLineEdit::tableMimeDataDropped, + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else if (qobject_cast(editor)) { - connect(editor, SIGNAL(stateChanged(int)), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &QCheckBox::stateChanged, + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else if (qobject_cast(editor)) { - connect(editor, SIGNAL(textChanged()), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &QPlainTextEdit::textChanged, proxy, + qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else if (qobject_cast(editor)) { - connect(editor, SIGNAL(currentIndexChanged (int)), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), qOverload(&QComboBox::currentIndexChanged), + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else if (qobject_cast(editor) || qobject_cast(editor)) { - connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &QAbstractSpinBox::editingFinished, + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else if (qobject_cast(editor)) { - connect(editor, SIGNAL(pickingFinished()), proxy, SLOT(editorDataCommited())); + connect(static_cast(editor), &CSVWidget::ColorEditor::pickingFinished, + proxy, qOverload<>(&DialogueDelegateDispatcherProxy::editorDataCommited)); } else // throw an exception because this is a coding error throw std::logic_error ("Dialogue editor type missing"); - connect(proxy, SIGNAL(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)), - this, SLOT(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display))); + connect(proxy, qOverload(&DialogueDelegateDispatcherProxy::editorDataCommited), + this, &DialogueDelegateDispatcher::editorDataCommited); mProxys.push_back(proxy); //deleted in the destructor } @@ -325,13 +331,12 @@ CSVWorld::IdContextMenu::IdContextMenu(QWidget *widget, CSMWorld::ColumnBase::Di Q_ASSERT(mIdType != CSMWorld::UniversalId::Type_None); mWidget->setContextMenuPolicy(Qt::CustomContextMenu); - connect(mWidget, - SIGNAL(customContextMenuRequested(const QPoint &)), - this, - SLOT(showContextMenu(const QPoint &))); + connect(mWidget, &QWidget::customContextMenuRequested, + this, &IdContextMenu::showContextMenu); mEditIdAction = new QAction(this); - connect(mEditIdAction, SIGNAL(triggered()), this, SLOT(editIdRequest())); + connect(mEditIdAction, &QAction::triggered, + this, qOverload<>(&IdContextMenu::editIdRequest)); QLineEdit *lineEdit = qobject_cast(mWidget); if (lineEdit != nullptr) @@ -442,10 +447,8 @@ void CSVWorld::EditWidget::createEditorContextMenu(QWidget *editor, IdContextMenu *menu = new IdContextMenu(editor, display); // Current ID is already opened, so no need to create Edit 'ID' action for it menu->excludeId(id.toUtf8().constData()); - connect(menu, - SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)), - this, - SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &))); + connect(menu, qOverload(&IdContextMenu::editIdRequest), + this, &EditWidget::editIdRequest); } } @@ -598,10 +601,8 @@ void CSVWorld::EditWidget::remake(int row) tablesLayout->addWidget(label); tablesLayout->addWidget(table); - connect(table, - SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)), - this, - SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &))); + connect(table, &NestedTable::editRequest, + this, &EditWidget::editIdRequest); } } else if (!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List)) @@ -744,8 +745,8 @@ CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::Universa mDocument(document), mCommandDispatcher (document, CSMWorld::UniversalId::getParentType (id.getType())) { - connect(mTable, SIGNAL(dataChanged (const QModelIndex&, const QModelIndex&)), this, SLOT(dataChanged(const QModelIndex&))); - connect(mTable, SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), this, SLOT(rowsAboutToBeRemoved(const QModelIndex&, int, int))); + connect(mTable, &CSMWorld::IdTable::dataChanged, this, &SimpleDialogueSubView::dataChanged); + connect(mTable, &CSMWorld::IdTable::rowsAboutToBeRemoved, this, &SimpleDialogueSubView::rowsAboutToBeRemoved); updateCurrentId(); @@ -764,10 +765,8 @@ CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::Universa dataChanged(mTable->getModelIndex (getUniversalId().getId(), idColumn)); - connect(mEditWidget, - SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)), - this, - SIGNAL(focusId(const CSMWorld::UniversalId &, const std::string &))); + connect(mEditWidget, &EditWidget::editIdRequest, + this, &SimpleDialogueSubView::focusId); } void CSVWorld::SimpleDialogueSubView::setEditLock (bool locked) @@ -864,12 +863,12 @@ void CSVWorld::DialogueSubView::addButtonBar() getMainLayout().insertWidget (1, mButtons); // connections - connect (mButtons, SIGNAL (showPreview()), this, SLOT (showPreview())); - connect (mButtons, SIGNAL (viewRecord()), this, SLOT (viewRecord())); - connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int))); + connect (mButtons, &RecordButtonBar::showPreview, this, &DialogueSubView::showPreview); + connect (mButtons, &RecordButtonBar::viewRecord, this, &DialogueSubView::viewRecord); + connect (mButtons, &RecordButtonBar::switchToRow, this, &DialogueSubView::switchToRow); - connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)), - mButtons, SLOT (universalIdChanged (const CSMWorld::UniversalId&))); + connect (this, &DialogueSubView::universalIdChanged, + mButtons, &RecordButtonBar::universalIdChanged); } CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, @@ -879,14 +878,13 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, // bottom box mBottom = new TableBottomBox (creatorFactory, document, id, this); - connect (mBottom, SIGNAL (requestFocus (const std::string&)), - this, SLOT (requestFocus (const std::string&))); + connect (mBottom, &TableBottomBox::requestFocus, this, &DialogueSubView::requestFocus); // layout getMainLayout().addWidget (mBottom); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &DialogueSubView::settingChanged); CSMPrefs::get()["ID Dialogues"].update(); } diff --git a/apps/opencs/view/world/extendedcommandconfigurator.cpp b/apps/opencs/view/world/extendedcommandconfigurator.cpp index d7ed39e19e..10dd49781e 100644 --- a/apps/opencs/view/world/extendedcommandconfigurator.cpp +++ b/apps/opencs/view/world/extendedcommandconfigurator.cpp @@ -24,16 +24,16 @@ CSVWorld::ExtendedCommandConfigurator::ExtendedCommandConfigurator(CSMDoc::Docum { mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this); - connect(&mData, SIGNAL(idListChanged()), this, SLOT(dataIdListChanged())); + connect(&mData, &CSMWorld::Data::idListChanged, this, &ExtendedCommandConfigurator::dataIdListChanged); mPerformButton = new QPushButton(this); mPerformButton->setDefault(true); mPerformButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(mPerformButton, SIGNAL(clicked(bool)), this, SLOT(performExtendedCommand())); + connect(mPerformButton, &QPushButton::clicked, this, &ExtendedCommandConfigurator::performExtendedCommand); mCancelButton = new QPushButton("Cancel", this); mCancelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - connect(mCancelButton, SIGNAL(clicked(bool)), this, SIGNAL(done())); + connect(mCancelButton, &QPushButton::clicked, this, &ExtendedCommandConfigurator::done); mTypeGroup = new QGroupBox(this); @@ -128,7 +128,7 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector 0; --i) { QCheckBox *checkBox = new QCheckBox(mTypeGroup); - connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(checkBoxStateChanged(int))); + connect(checkBox, &QCheckBox::stateChanged, this, &ExtendedCommandConfigurator::checkBoxStateChanged); mTypeCheckBoxes.insert(std::make_pair(checkBox, CSMWorld::UniversalId::Type_None)); } } @@ -170,7 +170,7 @@ void CSVWorld::ExtendedCommandConfigurator::lockWidgets(bool locked) void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand() { std::vector types; - + CheckBoxMap::const_iterator current = mTypeCheckBoxes.begin(); CheckBoxMap::const_iterator end = mTypeCheckBoxes.end(); for (; current != end; ++current) diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index 9aae777954..48a4aa445b 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -175,13 +175,13 @@ CSVWorld::GenericCreator::GenericCreator (CSMWorld::Data& data, QUndoStack& undo setLayout (mLayout); - connect (mCancel, SIGNAL (clicked (bool)), this, SIGNAL (done())); - connect (mCreate, SIGNAL (clicked (bool)), this, SLOT (create())); + connect (mCancel, &QPushButton::clicked, this, &GenericCreator::done); + connect (mCreate, &QPushButton::clicked, this, &GenericCreator::create); - connect (mId, SIGNAL (textChanged (const QString&)), this, SLOT (textChanged (const QString&))); - connect (mId, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); + connect (mId, &QLineEdit::textChanged, this, &GenericCreator::textChanged); + connect (mId, &QLineEdit::returnPressed, this, &GenericCreator::inputReturnPressed); - connect (&mData, SIGNAL (idListChanged()), this, SLOT (dataIdListChanged())); + connect (&mData, &CSMWorld::Data::idListChanged, this, &GenericCreator::dataIdListChanged); } void CSVWorld::GenericCreator::setEditorMaxLength (int length) @@ -317,7 +317,8 @@ void CSVWorld::GenericCreator::setScope (unsigned int scope) "Record will be created in the reserved namespace \"session\".

" "Record is not available when running OpenMW via OpenCS."); - connect (mScope, SIGNAL (currentIndexChanged (int)), this, SLOT (scopeChanged (int))); + connect (mScope, qOverload(&QComboBox::currentIndexChanged), + this, &GenericCreator::scopeChanged); mScopeLabel = new QLabel ("Scope", this); insertAtBeginning (mScopeLabel, false); diff --git a/apps/opencs/view/world/infocreator.cpp b/apps/opencs/view/world/infocreator.cpp index d05a88098b..6c3995477f 100644 --- a/apps/opencs/view/world/infocreator.cpp +++ b/apps/opencs/view/world/infocreator.cpp @@ -84,7 +84,7 @@ CSVWorld::InfoCreator::InfoCreator (CSMWorld::Data& data, QUndoStack& undoStack, setManualEditing (false); - connect (mTopic, SIGNAL (textChanged (const QString&)), this, SLOT (topicChanged())); + connect (mTopic, &CSVWidget::DropLineEdit::textChanged, this, &InfoCreator::topicChanged); connect (mTopic, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); } diff --git a/apps/opencs/view/world/landcreator.cpp b/apps/opencs/view/world/landcreator.cpp index 2ebfe18698..8d98f1b0a6 100644 --- a/apps/opencs/view/world/landcreator.cpp +++ b/apps/opencs/view/world/landcreator.cpp @@ -37,8 +37,8 @@ namespace CSVWorld insertBeforeButtons(mYLabel, false); insertBeforeButtons(mY, true); - connect (mX, SIGNAL(valueChanged(int)), this, SLOT(coordChanged(int))); - connect (mY, SIGNAL(valueChanged(int)), this, SLOT(coordChanged(int))); + connect (mX, qOverload(&QSpinBox::valueChanged), this, &LandCreator::coordChanged); + connect (mY, qOverload(&QSpinBox::valueChanged), this, &LandCreator::coordChanged); } void LandCreator::cloneMode(const std::string& originId, const CSMWorld::UniversalId::Type type) diff --git a/apps/opencs/view/world/landtexturecreator.cpp b/apps/opencs/view/world/landtexturecreator.cpp index 43d911e50d..bc577378fe 100644 --- a/apps/opencs/view/world/landtexturecreator.cpp +++ b/apps/opencs/view/world/landtexturecreator.cpp @@ -35,8 +35,9 @@ namespace CSVWorld mIndexBox->setMaximum(MaxIndex); insertBeforeButtons(mIndexBox, true); - connect(mNameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(nameChanged(const QString&))); - connect(mIndexBox, SIGNAL(valueChanged(int)), this, SLOT(indexChanged(int))); + connect(mNameEdit, &QLineEdit::textChanged, this, &LandTextureCreator::nameChanged); + connect(mIndexBox, qOverload(&QSpinBox::valueChanged), + this, &LandTextureCreator::indexChanged); } void LandTextureCreator::cloneMode(const std::string& originId, const CSMWorld::UniversalId::Type type) diff --git a/apps/opencs/view/world/nestedtable.cpp b/apps/opencs/view/world/nestedtable.cpp index c69913f0ac..997dbc2927 100644 --- a/apps/opencs/view/world/nestedtable.cpp +++ b/apps/opencs/view/world/nestedtable.cpp @@ -57,20 +57,20 @@ CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document, if (!fixedRows) { mAddNewRowAction = new QAction (tr ("Add new row"), this); - connect(mAddNewRowAction, SIGNAL(triggered()), - this, SLOT(addNewRowActionTriggered())); + connect(mAddNewRowAction, &QAction::triggered, + this, &NestedTable::addNewRowActionTriggered); CSMPrefs::Shortcut* addRowShortcut = new CSMPrefs::Shortcut("table-add", this); addRowShortcut->associateAction(mAddNewRowAction); mRemoveRowAction = new QAction (tr ("Remove rows"), this); - connect(mRemoveRowAction, SIGNAL(triggered()), - this, SLOT(removeRowActionTriggered())); + connect(mRemoveRowAction, &QAction::triggered, + this, &NestedTable::removeRowActionTriggered); CSMPrefs::Shortcut* removeRowShortcut = new CSMPrefs::Shortcut("table-remove", this); removeRowShortcut->associateAction(mRemoveRowAction); } mEditIdAction = new TableEditIdAction(*this, this); - connect(mEditIdAction, SIGNAL(triggered()), this, SLOT(editCell())); + connect(mEditIdAction, &QAction::triggered, this, &NestedTable::editCell); } } diff --git a/apps/opencs/view/world/pathgridcreator.cpp b/apps/opencs/view/world/pathgridcreator.cpp index 95628a5d96..5469ee9aba 100644 --- a/apps/opencs/view/world/pathgridcreator.cpp +++ b/apps/opencs/view/world/pathgridcreator.cpp @@ -42,7 +42,7 @@ CSVWorld::PathgridCreator::PathgridCreator( mCell->setCompleter(completionManager.getCompleter(displayType).get()); insertBeforeButtons(mCell, true); - connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged())); + connect(mCell, &CSVWidget::DropLineEdit::textChanged, this, &PathgridCreator::cellChanged); connect(mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); } diff --git a/apps/opencs/view/world/previewsubview.cpp b/apps/opencs/view/world/previewsubview.cpp index 9cc1b8aeed..151824790a 100644 --- a/apps/opencs/view/world/previewsubview.cpp +++ b/apps/opencs/view/world/previewsubview.cpp @@ -44,11 +44,14 @@ CSVWorld::PreviewSubView::PreviewSubView (const CSMWorld::UniversalId& id, CSMDo setWidget (widget); - connect (mScene, SIGNAL (closeRequest()), this, SLOT (closeRequest())); - connect (mScene, SIGNAL (referenceableIdChanged (const std::string&)), - this, SLOT (referenceableIdChanged (const std::string&))); - connect (mScene, SIGNAL (focusToolbarRequest()), toolbar, SLOT (setFocus())); - connect (toolbar, SIGNAL (focusSceneRequest()), mScene, SLOT (setFocus())); + connect (mScene, &CSVRender::PreviewWidget::closeRequest, + this, qOverload<>(&PreviewSubView::closeRequest)); + connect (mScene, &CSVRender::PreviewWidget::referenceableIdChanged, + this, &PreviewSubView::referenceableIdChanged); + connect (mScene, &CSVRender::PreviewWidget::focusToolbarRequest, + toolbar, qOverload<>(&CSVWidget::SceneToolbar::setFocus)); + connect (toolbar, &CSVWidget::SceneToolbar::focusSceneRequest, + mScene, qOverload<>(&CSVRender::PreviewWidget::setFocus)); } void CSVWorld::PreviewSubView::setEditLock (bool locked) {} diff --git a/apps/opencs/view/world/recordbuttonbar.cpp b/apps/opencs/view/world/recordbuttonbar.cpp index 9fea7b303c..5df012144b 100644 --- a/apps/opencs/view/world/recordbuttonbar.cpp +++ b/apps/opencs/view/world/recordbuttonbar.cpp @@ -75,7 +75,7 @@ CSVWorld::RecordButtonBar::RecordButtonBar (const CSMWorld::UniversalId& id, previewButton->setIcon(QIcon(":edit-preview")); previewButton->setToolTip ("Open a preview of this record"); buttonsLayout->addWidget(previewButton); - connect (previewButton, SIGNAL(clicked()), this, SIGNAL (showPreview())); + connect (previewButton, &QToolButton::clicked, this, &RecordButtonBar::showPreview); } if (mTable.getFeatures() & CSMWorld::IdTable::Feature_View) @@ -84,7 +84,7 @@ CSVWorld::RecordButtonBar::RecordButtonBar (const CSMWorld::UniversalId& id, viewButton->setIcon(QIcon(":/cell.png")); viewButton->setToolTip ("Open a scene view of the cell this record is located in"); buttonsLayout->addWidget(viewButton); - connect (viewButton, SIGNAL(clicked()), this, SIGNAL (viewRecord())); + connect (viewButton, &QToolButton::clicked, this, &RecordButtonBar::viewRecord); } // right section @@ -113,26 +113,28 @@ CSVWorld::RecordButtonBar::RecordButtonBar (const CSMWorld::UniversalId& id, // connections if(mBottom && mBottom->canCreateAndDelete()) { - connect (mAddButton, SIGNAL (clicked()), mBottom, SLOT (createRequest())); - connect (mCloneButton, SIGNAL (clicked()), this, SLOT (cloneRequest())); + connect (mAddButton, &QToolButton::clicked, mBottom, &TableBottomBox::createRequest); + connect (mCloneButton, &QToolButton::clicked, this, &RecordButtonBar::cloneRequest); } - connect (mNextButton, SIGNAL (clicked()), this, SLOT (nextId())); - connect (mPrevButton, SIGNAL (clicked()), this, SLOT (prevId())); + connect (mNextButton, &QToolButton::clicked, this, &RecordButtonBar::nextId); + connect (mPrevButton, &QToolButton::clicked, this, &RecordButtonBar::prevId); if (mCommandDispatcher) { - connect (mRevertButton, SIGNAL (clicked()), mCommandDispatcher, SLOT (executeRevert())); - connect (mDeleteButton, SIGNAL (clicked()), mCommandDispatcher, SLOT (executeDelete())); + connect (mRevertButton, &QToolButton::clicked, + mCommandDispatcher, &CSMWorld::CommandDispatcher::executeRevert); + connect (mDeleteButton, &QToolButton::clicked, + mCommandDispatcher, &CSMWorld::CommandDispatcher::executeDelete); } - connect (&mTable, SIGNAL (rowsInserted (const QModelIndex&, int, int)), - this, SLOT (rowNumberChanged (const QModelIndex&, int, int))); - connect (&mTable, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (rowNumberChanged (const QModelIndex&, int, int))); + connect (&mTable, &CSMWorld::IdTable::rowsInserted, + this, &RecordButtonBar::rowNumberChanged); + connect (&mTable, &CSMWorld::IdTable::rowsRemoved, + this, &RecordButtonBar::rowNumberChanged); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &RecordButtonBar::settingChanged); updateModificationButtons(); updatePrevNextButtons(); diff --git a/apps/opencs/view/world/referenceablecreator.cpp b/apps/opencs/view/world/referenceablecreator.cpp index 6bc0126b3e..eb699fd777 100644 --- a/apps/opencs/view/world/referenceablecreator.cpp +++ b/apps/opencs/view/world/referenceablecreator.cpp @@ -23,7 +23,7 @@ CSVWorld::ReferenceableCreator::ReferenceableCreator (CSMWorld::Data& data, QUnd mType = new QComboBox (this); mType->setMaxVisibleItems(20); - + for (std::vector::const_iterator iter (types.begin()); iter!=types.end(); ++iter) { @@ -32,12 +32,12 @@ CSVWorld::ReferenceableCreator::ReferenceableCreator (CSMWorld::Data& data, QUnd mType->addItem (QIcon (id2.getIcon().c_str()), id2.getTypeName().c_str(), static_cast (id2.getType())); } - + mType->model()->sort(0); - + insertBeforeButtons (mType, false); - connect (mType, SIGNAL (currentIndexChanged (int)), this, SLOT (setType (int))); + connect (mType, qOverload(&QComboBox::currentIndexChanged), this, &ReferenceableCreator::setType); } void CSVWorld::ReferenceableCreator::reset() diff --git a/apps/opencs/view/world/referencecreator.cpp b/apps/opencs/view/world/referencecreator.cpp index e939b9baf0..3ec356d6d4 100644 --- a/apps/opencs/view/world/referencecreator.cpp +++ b/apps/opencs/view/world/referencecreator.cpp @@ -43,7 +43,7 @@ CSVWorld::ReferenceCreator::ReferenceCreator (CSMWorld::Data& data, QUndoStack& setManualEditing (false); - connect (mCell, SIGNAL (textChanged (const QString&)), this, SLOT (cellChanged())); + connect (mCell, &CSVWidget::DropLineEdit::textChanged, this, &ReferenceCreator::cellChanged); connect (mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); } diff --git a/apps/opencs/view/world/regionmap.cpp b/apps/opencs/view/world/regionmap.cpp index d2d4fbd237..143b291074 100644 --- a/apps/opencs/view/world/regionmap.cpp +++ b/apps/opencs/view/world/regionmap.cpp @@ -189,35 +189,35 @@ CSVWorld::RegionMap::RegionMap (const CSMWorld::UniversalId& universalId, resizeRowsToContents(); mSelectAllAction = new QAction (tr ("Select All"), this); - connect (mSelectAllAction, SIGNAL (triggered()), this, SLOT (selectAll())); + connect (mSelectAllAction, &QAction::triggered, this, &RegionMap::selectAll); addAction (mSelectAllAction); mClearSelectionAction = new QAction (tr ("Clear Selection"), this); - connect (mClearSelectionAction, SIGNAL (triggered()), this, SLOT (clearSelection())); + connect (mClearSelectionAction, &QAction::triggered, this, &RegionMap::clearSelection); addAction (mClearSelectionAction); mSelectRegionsAction = new QAction (tr ("Select Regions"), this); - connect (mSelectRegionsAction, SIGNAL (triggered()), this, SLOT (selectRegions())); + connect (mSelectRegionsAction, &QAction::triggered, this, &RegionMap::selectRegions); addAction (mSelectRegionsAction); mCreateCellsAction = new QAction (tr ("Create Cells Action"), this); - connect (mCreateCellsAction, SIGNAL (triggered()), this, SLOT (createCells())); + connect (mCreateCellsAction, &QAction::triggered, this, &RegionMap::createCells); addAction (mCreateCellsAction); mSetRegionAction = new QAction (tr ("Set Region"), this); - connect (mSetRegionAction, SIGNAL (triggered()), this, SLOT (setRegion())); + connect (mSetRegionAction, &QAction::triggered, this, qOverload<>(&RegionMap::setRegion)); addAction (mSetRegionAction); mUnsetRegionAction = new QAction (tr ("Unset Region"), this); - connect (mUnsetRegionAction, SIGNAL (triggered()), this, SLOT (unsetRegion())); + connect (mUnsetRegionAction, &QAction::triggered, this, &RegionMap::unsetRegion); addAction (mUnsetRegionAction); mViewAction = new QAction (tr ("View Cells"), this); - connect (mViewAction, SIGNAL (triggered()), this, SLOT (view())); + connect (mViewAction, &QAction::triggered, this, &RegionMap::view); addAction (mViewAction); mViewInTableAction = new QAction (tr ("View Cells in Table"), this); - connect (mViewInTableAction, SIGNAL (triggered()), this, SLOT (viewInTable())); + connect (mViewInTableAction, &QAction::triggered, this, &RegionMap::viewInTable); addAction (mViewInTableAction); setAcceptDrops(true); diff --git a/apps/opencs/view/world/regionmapsubview.cpp b/apps/opencs/view/world/regionmapsubview.cpp index 996d1dc8b8..659c7597f0 100644 --- a/apps/opencs/view/world/regionmapsubview.cpp +++ b/apps/opencs/view/world/regionmapsubview.cpp @@ -10,8 +10,7 @@ CSVWorld::RegionMapSubView::RegionMapSubView (CSMWorld::UniversalId universalId, setWidget (mRegionMap); - connect (mRegionMap, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)), - this, SLOT (editRequest (const CSMWorld::UniversalId&, const std::string&))); + connect (mRegionMap, &RegionMap::editRequest, this, &RegionMapSubView::editRequest); } void CSVWorld::RegionMapSubView::setEditLock (bool locked) diff --git a/apps/opencs/view/world/scenesubview.cpp b/apps/opencs/view/world/scenesubview.cpp index 58d159a178..414ab7183f 100644 --- a/apps/opencs/view/world/scenesubview.cpp +++ b/apps/opencs/view/world/scenesubview.cpp @@ -75,30 +75,32 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D void CSVWorld::SceneSubView::makeConnections (CSVRender::UnpagedWorldspaceWidget* widget) { - connect (widget, SIGNAL (closeRequest()), this, SLOT (closeRequest())); + connect(widget, &CSVRender::UnpagedWorldspaceWidget::closeRequest, + this, qOverload<>(&SceneSubView::closeRequest)); - connect(widget, SIGNAL(dataDropped(const std::vector&)), - this, SLOT(handleDrop(const std::vector&))); + connect(widget, &CSVRender::UnpagedWorldspaceWidget::dataDropped, + this, &SceneSubView::handleDrop); - connect(widget, SIGNAL(cellChanged(const CSMWorld::UniversalId&)), - this, SLOT(cellSelectionChanged(const CSMWorld::UniversalId&))); + connect(widget, &CSVRender::UnpagedWorldspaceWidget::cellChanged, + this, qOverload(&SceneSubView::cellSelectionChanged)); - connect(widget, SIGNAL(requestFocus (const std::string&)), - this, SIGNAL(requestFocus (const std::string&))); + connect(widget, &CSVRender::UnpagedWorldspaceWidget::requestFocus, + this, &SceneSubView::requestFocus); } void CSVWorld::SceneSubView::makeConnections (CSVRender::PagedWorldspaceWidget* widget) { - connect (widget, SIGNAL (closeRequest()), this, SLOT (closeRequest())); + connect(widget, &CSVRender::PagedWorldspaceWidget::closeRequest, + this, qOverload<>(&SceneSubView::closeRequest)); - connect(widget, SIGNAL(dataDropped(const std::vector&)), - this, SLOT(handleDrop(const std::vector&))); + connect(widget, &CSVRender::PagedWorldspaceWidget::dataDropped, + this, &SceneSubView::handleDrop); - connect (widget, SIGNAL (cellSelectionChanged (const CSMWorld::CellSelection&)), - this, SLOT (cellSelectionChanged (const CSMWorld::CellSelection&))); + connect(widget, &CSVRender::PagedWorldspaceWidget::cellSelectionChanged, + this, qOverload(&SceneSubView::cellSelectionChanged)); - connect(widget, SIGNAL(requestFocus (const std::string&)), - this, SIGNAL(requestFocus (const std::string&))); + connect(widget, &CSVRender::PagedWorldspaceWidget::requestFocus, + this, &SceneSubView::requestFocus); } CSVWidget::SceneToolbar* CSVWorld::SceneSubView::makeToolbar (CSVRender::WorldspaceWidget* widget, widgetType type) @@ -244,8 +246,10 @@ void CSVWorld::SceneSubView::replaceToolbarAndWorldspace (CSVRender::WorldspaceW mScene = widget; mToolbar = toolbar; - connect (mScene, SIGNAL (focusToolbarRequest()), mToolbar, SLOT (setFocus())); - connect (mToolbar, SIGNAL (focusSceneRequest()), mScene, SLOT (setFocus())); + connect (mScene, &CSVRender::WorldspaceWidget::focusToolbarRequest, + mToolbar, qOverload<>(&CSVWidget::SceneToolbar::setFocus)); + connect (mToolbar, &CSVWidget::SceneToolbar::focusSceneRequest, + mScene, qOverload<>(&CSVRender::WorldspaceWidget::setFocus)); mLayout->addWidget (mToolbar, 0); mLayout->addWidget (mScene, 1); diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 1217d36f64..547553dbf5 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -88,26 +88,26 @@ CSVWorld::ScriptEdit::ScriptEdit( <associateAction(mCommentAction); mUncommentAction = new QAction (tr ("Uncomment Selection"), this); - connect(mUncommentAction, SIGNAL (triggered()), this, SLOT (uncommentSelection())); + connect(mUncommentAction, &QAction::triggered, this, &ScriptEdit::uncommentSelection); CSMPrefs::Shortcut *uncommentShortcut = new CSMPrefs::Shortcut("script-editor-uncomment", this); uncommentShortcut->associateAction(mUncommentAction); mHighlighter = new ScriptHighlighter (document.getData(), mode, ScriptEdit::document()); - connect (&document.getData(), SIGNAL (idListChanged()), this, SLOT (idListChanged())); + connect (&document.getData(), &CSMWorld::Data::idListChanged, this, &ScriptEdit::idListChanged); - connect (&mUpdateTimer, SIGNAL (timeout()), this, SLOT (updateHighlighting())); + connect (&mUpdateTimer, &QTimer::timeout, this, &ScriptEdit::updateHighlighting); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &ScriptEdit::settingChanged); { ChangeLock lock (*this); CSMPrefs::get()["Scripts"].update(); @@ -121,8 +121,8 @@ CSVWorld::ScriptEdit::ScriptEdit( mLineNumberArea = new LineNumberArea(this); updateLineNumberAreaWidth(0); - connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int))); - connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int))); + connect(this, &ScriptEdit::blockCountChanged, this, &ScriptEdit::updateLineNumberAreaWidth); + connect(this, &ScriptEdit::updateRequest, this, &ScriptEdit::updateLineNumberArea); updateHighlighting(); } @@ -313,9 +313,9 @@ void CSVWorld::ScriptEdit::markOccurrences() // prevent infinite recursion with cursor.select(), // which ends up calling this function again // could be fixed with blockSignals, but mDocument is const - disconnect(this, SIGNAL(cursorPositionChanged()), this, nullptr); + disconnect(this, &ScriptEdit::cursorPositionChanged, this, nullptr); cursor.select(QTextCursor::WordUnderCursor); - connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(markOccurrences())); + connect(this, &ScriptEdit::cursorPositionChanged, this, &ScriptEdit::markOccurrences); QString word = cursor.selectedText(); mHighlighter->setMarkedWord(word.toStdString()); diff --git a/apps/opencs/view/world/scripterrortable.cpp b/apps/opencs/view/world/scripterrortable.cpp index a331820a2b..aefddd354b 100644 --- a/apps/opencs/view/world/scripterrortable.cpp +++ b/apps/opencs/view/world/scripterrortable.cpp @@ -96,11 +96,11 @@ CSVWorld::ScriptErrorTable::ScriptErrorTable (const CSMDoc::Document& document, Compiler::registerExtensions (mExtensions); mContext.setExtensions (&mExtensions); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &ScriptErrorTable::settingChanged); CSMPrefs::get()["Scripts"].update(); - connect (this, SIGNAL (cellClicked (int, int)), this, SLOT (cellClicked (int, int))); + connect (this, &QTableWidget::cellClicked, this, &ScriptErrorTable::cellClicked); } void CSVWorld::ScriptErrorTable::update (const std::string& source) diff --git a/apps/opencs/view/world/scriptsubview.cpp b/apps/opencs/view/world/scriptsubview.cpp index 5036077fc3..e4cc3dc86c 100644 --- a/apps/opencs/view/world/scriptsubview.cpp +++ b/apps/opencs/view/world/scriptsubview.cpp @@ -29,10 +29,9 @@ void CSVWorld::ScriptSubView::addButtonBar() mLayout.insertWidget (1, mButtons); - connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int))); + connect (mButtons, &RecordButtonBar::switchToRow, this, &ScriptSubView::switchToRow); - connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)), - mButtons, SLOT (universalIdChanged (const CSMWorld::UniversalId&))); + connect (this, &ScriptSubView::universalIdChanged, mButtons, &RecordButtonBar::universalIdChanged); } void CSVWorld::ScriptSubView::recompile() @@ -124,36 +123,33 @@ CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc: // bottom box and buttons mBottom = new TableBottomBox (CreatorFactory(), document, id, this); - connect (mBottom, SIGNAL (requestFocus (const std::string&)), - this, SLOT (switchToId (const std::string&))); + connect (mBottom, &TableBottomBox::requestFocus, this, &ScriptSubView::switchToId); mLayout.addWidget (mBottom); // signals - connect (mEditor, SIGNAL (textChanged()), this, SLOT (textChanged())); + connect (mEditor, &ScriptEdit::textChanged, this, &ScriptSubView::textChanged); - connect (mModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (dataChanged (const QModelIndex&, const QModelIndex&))); + connect (mModel, &CSMWorld::IdTable::dataChanged, this, &ScriptSubView::dataChanged); - connect (mModel, SIGNAL (rowsAboutToBeRemoved (const QModelIndex&, int, int)), - this, SLOT (rowsAboutToBeRemoved (const QModelIndex&, int, int))); + connect (mModel, &CSMWorld::IdTable::rowsAboutToBeRemoved, + this, &ScriptSubView::rowsAboutToBeRemoved); updateStatusBar(); - connect(mEditor, SIGNAL(cursorPositionChanged()), this, SLOT(updateStatusBar())); + connect(mEditor, &ScriptEdit::cursorPositionChanged, this, &ScriptSubView::updateStatusBar); mErrors->update (source.toUtf8().constData()); - connect (mErrors, SIGNAL (highlightError (int, int)), - this, SLOT (highlightError (int, int))); + connect (mErrors, &ScriptErrorTable::highlightError, this, &ScriptSubView::highlightError); mCompileDelay = new QTimer (this); mCompileDelay->setSingleShot (true); - connect (mCompileDelay, SIGNAL (timeout()), this, SLOT (updateRequest())); + connect (mCompileDelay, &QTimer::timeout, this, &ScriptSubView::updateRequest); updateDeletedState(); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &ScriptSubView::settingChanged); CSMPrefs::get()["Scripts"].update(); } diff --git a/apps/opencs/view/world/startscriptcreator.cpp b/apps/opencs/view/world/startscriptcreator.cpp index 0eb6bae40e..cf662bc5ac 100644 --- a/apps/opencs/view/world/startscriptcreator.cpp +++ b/apps/opencs/view/world/startscriptcreator.cpp @@ -44,7 +44,7 @@ CSVWorld::StartScriptCreator::StartScriptCreator( mScript->setCompleter(completionManager.getCompleter(displayType).get()); insertBeforeButtons(mScript, true); - connect(mScript, SIGNAL (textChanged(const QString&)), this, SLOT (scriptChanged())); + connect(mScript, &CSVWidget::DropLineEdit::textChanged, this, &StartScriptCreator::scriptChanged); connect(mScript, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed())); } diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 6a89d08a73..228834f6b4 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -299,7 +299,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, setSortingEnabled (sorting); mEditAction = new QAction (tr ("Edit Record"), this); - connect (mEditAction, SIGNAL (triggered()), this, SLOT (editRecord())); + connect (mEditAction, &QAction::triggered, this, &Table::editRecord); mEditAction->setIcon(QIcon(":edit-edit")); addAction (mEditAction); CSMPrefs::Shortcut* editShortcut = new CSMPrefs::Shortcut("table-edit", this); @@ -308,14 +308,14 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, if (createAndDelete) { mCreateAction = new QAction (tr ("Add Record"), this); - connect (mCreateAction, SIGNAL (triggered()), this, SIGNAL (createRequest())); + connect (mCreateAction, &QAction::triggered, this, &Table::createRequest); mCreateAction->setIcon(QIcon(":edit-add")); addAction (mCreateAction); CSMPrefs::Shortcut* createShortcut = new CSMPrefs::Shortcut("table-add", this); createShortcut->associateAction(mCreateAction); mCloneAction = new QAction (tr ("Clone Record"), this); - connect(mCloneAction, SIGNAL (triggered()), this, SLOT (cloneRecord())); + connect(mCloneAction, &QAction::triggered, this, &Table::cloneRecord); mCloneAction->setIcon(QIcon(":edit-clone")); addAction(mCloneAction); CSMPrefs::Shortcut* cloneShortcut = new CSMPrefs::Shortcut("table-clone", this); @@ -325,7 +325,7 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, if (mModel->getFeatures() & CSMWorld::IdTableBase::Feature_AllowTouch) { mTouchAction = new QAction(tr("Touch Record"), this); - connect(mTouchAction, SIGNAL(triggered()), this, SLOT(touchRecord())); + connect(mTouchAction, &QAction::triggered, this, &Table::touchRecord); mTouchAction->setIcon(QIcon(":edit-touch")); addAction(mTouchAction); CSMPrefs::Shortcut* touchShortcut = new CSMPrefs::Shortcut("table-touch", this); @@ -333,85 +333,85 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, } mRevertAction = new QAction (tr ("Revert Record"), this); - connect (mRevertAction, SIGNAL (triggered()), mDispatcher, SLOT (executeRevert())); + connect (mRevertAction, &QAction::triggered, mDispatcher, &CSMWorld::CommandDispatcher::executeRevert); mRevertAction->setIcon(QIcon(":edit-undo")); addAction (mRevertAction); CSMPrefs::Shortcut* revertShortcut = new CSMPrefs::Shortcut("table-revert", this); revertShortcut->associateAction(mRevertAction); mDeleteAction = new QAction (tr ("Delete Record"), this); - connect (mDeleteAction, SIGNAL (triggered()), mDispatcher, SLOT (executeDelete())); + connect (mDeleteAction, &QAction::triggered, mDispatcher, &CSMWorld::CommandDispatcher::executeDelete); mDeleteAction->setIcon(QIcon(":edit-delete")); addAction (mDeleteAction); CSMPrefs::Shortcut* deleteShortcut = new CSMPrefs::Shortcut("table-remove", this); deleteShortcut->associateAction(mDeleteAction); mMoveUpAction = new QAction (tr ("Move Up"), this); - connect (mMoveUpAction, SIGNAL (triggered()), this, SLOT (moveUpRecord())); + connect (mMoveUpAction, &QAction::triggered, this, &Table::moveUpRecord); mMoveUpAction->setIcon(QIcon(":record-up")); addAction (mMoveUpAction); CSMPrefs::Shortcut* moveUpShortcut = new CSMPrefs::Shortcut("table-moveup", this); moveUpShortcut->associateAction(mMoveUpAction); mMoveDownAction = new QAction (tr ("Move Down"), this); - connect (mMoveDownAction, SIGNAL (triggered()), this, SLOT (moveDownRecord())); + connect (mMoveDownAction, &QAction::triggered, this, &Table::moveDownRecord); mMoveDownAction->setIcon(QIcon(":record-down")); addAction (mMoveDownAction); CSMPrefs::Shortcut* moveDownShortcut = new CSMPrefs::Shortcut("table-movedown", this); moveDownShortcut->associateAction(mMoveDownAction); mViewAction = new QAction (tr ("View"), this); - connect (mViewAction, SIGNAL (triggered()), this, SLOT (viewRecord())); + connect (mViewAction, &QAction::triggered, this, &Table::viewRecord); mViewAction->setIcon(QIcon(":/cell.png")); addAction (mViewAction); CSMPrefs::Shortcut* viewShortcut = new CSMPrefs::Shortcut("table-view", this); viewShortcut->associateAction(mViewAction); mPreviewAction = new QAction (tr ("Preview"), this); - connect (mPreviewAction, SIGNAL (triggered()), this, SLOT (previewRecord())); + connect (mPreviewAction, &QAction::triggered, this, &Table::previewRecord); mPreviewAction->setIcon(QIcon(":edit-preview")); addAction (mPreviewAction); CSMPrefs::Shortcut* previewShortcut = new CSMPrefs::Shortcut("table-preview", this); previewShortcut->associateAction(mPreviewAction); mExtendedDeleteAction = new QAction (tr ("Extended Delete Record"), this); - connect (mExtendedDeleteAction, SIGNAL (triggered()), this, SLOT (executeExtendedDelete())); + connect (mExtendedDeleteAction, &QAction::triggered, this, &Table::executeExtendedDelete); mExtendedDeleteAction->setIcon(QIcon(":edit-delete")); addAction (mExtendedDeleteAction); CSMPrefs::Shortcut* extendedDeleteShortcut = new CSMPrefs::Shortcut("table-extendeddelete", this); extendedDeleteShortcut->associateAction(mExtendedDeleteAction); mExtendedRevertAction = new QAction (tr ("Extended Revert Record"), this); - connect (mExtendedRevertAction, SIGNAL (triggered()), this, SLOT (executeExtendedRevert())); + connect (mExtendedRevertAction, &QAction::triggered, this, &Table::executeExtendedRevert); mExtendedRevertAction->setIcon(QIcon(":edit-undo")); addAction (mExtendedRevertAction); CSMPrefs::Shortcut* extendedRevertShortcut = new CSMPrefs::Shortcut("table-extendedrevert", this); extendedRevertShortcut->associateAction(mExtendedRevertAction); mEditIdAction = new TableEditIdAction (*this, this); - connect (mEditIdAction, SIGNAL (triggered()), this, SLOT (editCell())); + connect (mEditIdAction, &QAction::triggered, this, &Table::editCell); addAction (mEditIdAction); mHelpAction = new QAction (tr ("Help"), this); - connect (mHelpAction, SIGNAL (triggered()), this, SLOT (openHelp())); + connect (mHelpAction, &QAction::triggered, this, &Table::openHelp); mHelpAction->setIcon(QIcon(":/info.png")); addAction (mHelpAction); CSMPrefs::Shortcut* openHelpShortcut = new CSMPrefs::Shortcut("help", this); openHelpShortcut->associateAction(mHelpAction); - connect (mProxyModel, SIGNAL (rowsRemoved (const QModelIndex&, int, int)), - this, SLOT (tableSizeUpdate())); + connect (mProxyModel, &CSMWorld::IdTableProxyModel::rowsRemoved, + this, &Table::tableSizeUpdate); - connect (mProxyModel, SIGNAL (rowAdded (const std::string &)), - this, SLOT (rowAdded (const std::string &))); + connect (mProxyModel, &CSMWorld::IdTableProxyModel::rowAdded, + this, &Table::rowAdded); /// \note This signal could instead be connected to a slot that filters out changes not affecting /// the records status column (for permanence reasons) - connect (mProxyModel, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)), - this, SLOT (dataChangedEvent(const QModelIndex&, const QModelIndex&))); + connect (mProxyModel, &CSMWorld::IdTableProxyModel::dataChanged, + this, &Table::dataChangedEvent); - connect (selectionModel(), SIGNAL (selectionChanged (const QItemSelection&, const QItemSelection&)), - this, SLOT (selectionSizeUpdate ())); + connect (selectionModel(), &QItemSelectionModel::selectionChanged, + this, &Table::selectionSizeUpdate); setAcceptDrops(true); @@ -420,8 +420,8 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id, mDoubleClickActions.insert (std::make_pair (Qt::ControlModifier, Action_View)); mDoubleClickActions.insert (std::make_pair (Qt::ShiftModifier | Qt::ControlModifier, Action_EditRecordAndClose)); - connect (&CSMPrefs::State::get(), SIGNAL (settingChanged (const CSMPrefs::Setting *)), - this, SLOT (settingChanged (const CSMPrefs::Setting *))); + connect (&CSMPrefs::State::get(), &CSMPrefs::State::settingChanged, + this, &Table::settingChanged); CSMPrefs::get()["ID Tables"].update(); new TableHeaderMouseEventHandler(this); diff --git a/apps/opencs/view/world/tablebottombox.cpp b/apps/opencs/view/world/tablebottombox.cpp index 1b065da49e..3d64280625 100644 --- a/apps/opencs/view/world/tablebottombox.cpp +++ b/apps/opencs/view/world/tablebottombox.cpp @@ -91,7 +91,7 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto mLayout = new QStackedLayout; mLayout->setContentsMargins (0, 0, 0, 0); - connect (mLayout, SIGNAL (currentChanged (int)), this, SLOT (currentWidgetChanged (int))); + connect (mLayout, &QStackedLayout::currentChanged, this, &TableBottomBox::currentWidgetChanged); mStatus = new QLabel; @@ -110,16 +110,16 @@ CSVWorld::TableBottomBox::TableBottomBox (const CreatorFactoryBase& creatorFacto mCreator->installEventFilter(this); mLayout->addWidget (mCreator); - connect (mCreator, SIGNAL (done()), this, SLOT (requestDone())); + connect (mCreator, &Creator::done, this, &TableBottomBox::requestDone); - connect (mCreator, SIGNAL (requestFocus (const std::string&)), - this, SIGNAL (requestFocus (const std::string&))); + connect (mCreator, &Creator::requestFocus, this, &TableBottomBox::requestFocus); } mExtendedConfigurator = new ExtendedCommandConfigurator (document, id, this); mExtendedConfigurator->installEventFilter(this); mLayout->addWidget (mExtendedConfigurator); - connect (mExtendedConfigurator, SIGNAL (done()), this, SLOT (requestDone())); + connect (mExtendedConfigurator, &ExtendedCommandConfigurator::done, + this, &TableBottomBox::requestDone); updateSize(); } diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp index 6b4f12738e..bd29b3e634 100644 --- a/apps/opencs/view/world/tablesubview.cpp +++ b/apps/opencs/view/world/tablesubview.cpp @@ -44,7 +44,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D "\nCan be useful in finding the moved or modified" "\nobject instance while 3D editing."); autoJump->setCheckState(Qt::Unchecked); - connect(autoJump, SIGNAL (stateChanged(int)), mTable, SLOT (jumpAfterModChanged(int))); + connect(autoJump, &QCheckBox::stateChanged, mTable, &Table::jumpAfterModChanged); optHLayout->insertWidget(0, autoJump); optHLayout->setContentsMargins (QMargins (0, 3, 0, 0)); mOptions->setLayout(optHLayout); @@ -55,7 +55,7 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D opt->setIcon (QIcon (":startup/configure")); opt->setSizePolicy (QSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed)); opt->setToolTip ("Open additional options for this subview."); - connect (opt, SIGNAL (clicked()), this, SLOT (toggleOptions())); + connect (opt, &QPushButton::clicked, this, &TableSubView::toggleOptions); QVBoxLayout *buttonLayout = new QVBoxLayout; // work around margin issues buttonLayout->setContentsMargins (QMargins (0/*left*/, 3/*top*/, 3/*right*/, 0/*bottom*/)); @@ -78,13 +78,10 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D frameHeight = topLevel->frameGeometry().height() - topLevel->height(); widget->setSizeHint(QSize(mTable->horizontalHeader()->length(), rect.height()-frameHeight)); - connect (mTable, SIGNAL (editRequest (const CSMWorld::UniversalId&, const std::string&)), - this, SLOT (editRequest (const CSMWorld::UniversalId&, const std::string&))); + connect (mTable, &Table::editRequest, this, &TableSubView::editRequest); - connect (mTable, SIGNAL (selectionSizeChanged (int)), - mBottom, SLOT (selectionSizeChanged (int))); - connect (mTable, SIGNAL (tableSizeChanged (int, int, int)), - mBottom, SLOT (tableSizeChanged (int, int, int))); + connect (mTable, &Table::selectionSizeChanged, mBottom, &TableBottomBox::selectionSizeChanged); + connect (mTable, &Table::tableSizeChanged, mBottom, &TableBottomBox::tableSizeChanged); mTable->tableSizeUpdate(); mTable->selectionSizeUpdate(); @@ -94,33 +91,33 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D if (mBottom->canCreateAndDelete()) { - connect (mTable, SIGNAL (createRequest()), mBottom, SLOT (createRequest())); + connect (mTable, &Table::createRequest, mBottom, &TableBottomBox::createRequest); - connect (mTable, SIGNAL (cloneRequest(const CSMWorld::UniversalId&)), this, - SLOT(cloneRequest(const CSMWorld::UniversalId&))); + connect (mTable, &Table::cloneRequest, + this, qOverload(&TableSubView::cloneRequest)); - connect (this, SIGNAL(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type)), - mBottom, SLOT(cloneRequest(const std::string&, const CSMWorld::UniversalId::Type))); + connect (this, + qOverload(&TableSubView::cloneRequest), + mBottom, &TableBottomBox::cloneRequest); - connect (mTable, SIGNAL(touchRequest(const std::vector&)), - mBottom, SLOT(touchRequest(const std::vector&))); + connect (mTable, &Table::touchRequest, + mBottom, &TableBottomBox::touchRequest); - connect (mTable, SIGNAL(extendedDeleteConfigRequest(const std::vector &)), - mBottom, SLOT(extendedDeleteConfigRequest(const std::vector &))); - connect (mTable, SIGNAL(extendedRevertConfigRequest(const std::vector &)), - mBottom, SLOT(extendedRevertConfigRequest(const std::vector &))); + connect (mTable, &Table::extendedDeleteConfigRequest, + mBottom, &TableBottomBox::extendedDeleteConfigRequest); + connect (mTable, &Table::extendedRevertConfigRequest, + mBottom, &TableBottomBox::extendedRevertConfigRequest); } - connect (mBottom, SIGNAL (requestFocus (const std::string&)), - mTable, SLOT (requestFocus (const std::string&))); + connect (mBottom, &TableBottomBox::requestFocus, mTable, &Table::requestFocus); - connect (mFilterBox, - SIGNAL (recordFilterChanged (std::shared_ptr)), - mTable, SLOT (recordFilterChanged (std::shared_ptr))); + connect (mFilterBox, &CSVFilter::FilterBox::recordFilterChanged, + mTable, &Table::recordFilterChanged); - connect(mFilterBox, SIGNAL(recordDropped(std::vector&, Qt::DropAction)), - this, SLOT(createFilterRequest(std::vector&, Qt::DropAction))); + connect(mFilterBox, &CSVFilter::FilterBox::recordDropped, + this, &TableSubView::createFilterRequest); - connect (mTable, SIGNAL (closeRequest()), this, SLOT (closeRequest())); + + connect (mTable, &Table::closeRequest, this, qOverload<>(&TableSubView::closeRequest)); } void CSVWorld::TableSubView::setEditLock (bool locked)