Commit c7520164 authored by Friedrich W. H. Kossebau's avatar Friedrich W. H. Kossebau
Browse files

Port away from deprecated KSelectAction::triggered(int)

parent b3d52426
......@@ -21,6 +21,7 @@
#include "kgdifficulty.h"
// KF
#include <kwidgetsaddons_version.h>
#include <KConfigGroup>
#include <KGuiItem>
#include <KMessageBox>
......@@ -390,7 +391,11 @@ void KgDifficultyGUI::init(KXmlGuiWindow* window, KgDifficulty* difficulty)
KSelectAction* menu = new KgDifficultyGUI::Menu(icon, i18nc("Game difficulty level", "Difficulty"), window);
menu->setToolTip(i18n("Set the difficulty level"));
menu->setWhatsThis(i18n("Set the difficulty level of the game."));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
QObject::connect(menu, &KSelectAction::indexTriggered, selector, &Selector::slotActivated);
#else
QObject::connect(menu, QOverload<int>::of(&KSelectAction::triggered), selector, &Selector::slotActivated);
#endif
QObject::connect(difficulty, &KgDifficulty::editableChanged, menu, &QAction::setEnabled);
QObject::connect(selector, &Selector::signalSelected, menu, &KSelectAction::setCurrentItem);
......
......@@ -148,7 +148,11 @@ QAction* KStandardGameAction::create(StandardGameAction id, const QObject *recvr
QObject::connect(pAction, SIGNAL(urlSelected(QUrl)), recvr, slot);
break;
case ChooseGameType:
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
QObject::connect(pAction, SIGNAL(indexTriggered(int)), recvr, slot);
#else
QObject::connect(pAction, SIGNAL(triggered(int)), recvr, slot);
#endif
break;
default:
QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);
......
......@@ -456,10 +456,10 @@ namespace KStandardGameAction
QAction* action = _k_createInternal(ChooseGameType, parent);
KSelectAction* chooseGameTypeAction = qobject_cast<KSelectAction*>(action);
Q_ASSERT(chooseGameTypeAction);
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 78, 0)
QObject::connect(chooseGameTypeAction, QOverload<int>::of(&KSelectAction::triggered), recvr, slot);
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
QObject::connect(chooseGameTypeAction, &KSelectAction::indexTriggered, recvr, slot);
#else
QObject::connect(chooseGameTypeAction, &KSelectAction::triggered, recvr, slot);
QObject::connect(chooseGameTypeAction, QOverload<int>::of(&KSelectAction::triggered), recvr, slot);
#endif
return chooseGameTypeAction;
}
......
......@@ -12,6 +12,7 @@ You should have received a copy of the GNU Library General Public License along
#include "kgamedifficulty.h"
// KF
#include <kwidgetsaddons_version.h>
#include <KActionCollection>
#include <KComboBox>
#include <KLocalizedString>
......@@ -112,7 +113,11 @@ void KGameDifficultyPrivate::init(KXmlGuiWindow* window, const QObject* recvr, c
m_menu = new KSelectAction(QIcon::fromTheme( QStringLiteral( "games-difficult") ), i18nc("Game difficulty level", "Difficulty" ), window);
m_menu->setToolTip(i18n("Set the difficulty level"));
m_menu->setWhatsThis(i18n("Set the difficulty level of the game."));
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 78, 0)
connect(m_menu, &KSelectAction::indexTriggered,
#else
connect(m_menu, QOverload<int>::of(&KSelectAction::triggered),
#endif
this, &KGameDifficultyPrivate::changeSelection);
m_menu->setObjectName( QStringLiteral("options_game_difficulty" ));
window->actionCollection()->addAction(m_menu->objectName(), m_menu);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment