Use addCustomAction() instead of deprecated addCustomButton()

This commit is contained in:
Martchus 2020-07-09 20:21:54 +02:00
parent 418a5ca9ab
commit a9225c5a35
4 changed files with 11 additions and 10 deletions

View File

@ -11,7 +11,7 @@ set(META_APP_CATEGORIES "Network;FileTransfer")
set(META_GUI_OPTIONAL false)
set(META_VERSION_MAJOR 0)
set(META_VERSION_MINOR 11)
set(META_VERSION_PATCH 0)
set(META_VERSION_PATCH 1)
set(META_VERSION_EXACT_SONAME ON)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)

View File

@ -76,7 +76,7 @@ find_package(c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.0.0 REQUIRED)
use_cpp_utilities()
# find qtutilities
find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.0.0 REQUIRED)
find_package(qtutilities${CONFIGURATION_PACKAGE_SUFFIX} 6.1.0 REQUIRED)
use_qt_utilities()
# find backend libraries

View File

@ -856,7 +856,7 @@ LauncherOptionPage::LauncherOptionPage(const QString &tool, QWidget *parentWidge
, LauncherOptionPageBase(parentWidget)
, m_process(&Launcher::toolProcess(tool))
, m_launcher(nullptr)
, m_restoreArgsButton(nullptr)
, m_restoreArgsAction(nullptr)
, m_kill(false)
, m_tool(tool)
{
@ -885,12 +885,12 @@ QWidget *LauncherOptionPage::setupWidget()
// add "restore to defaults" action for Syncthing arguments
if (isSyncthing) {
m_restoreArgsButton = new IconButton(ui()->argumentsLineEdit);
m_restoreArgsButton->setPixmap(
QIcon::fromTheme(QStringLiteral("edit-undo"), QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/edit-paste.svg"))).pixmap(16));
m_restoreArgsButton->setToolTip(tr("Restore default"));
connect(m_restoreArgsButton, &IconButton::clicked, this, &LauncherOptionPage::restoreDefaultArguments);
ui()->argumentsLineEdit->insertCustomButton(0, m_restoreArgsButton);
m_restoreArgsAction = new QAction(ui()->argumentsLineEdit);
m_restoreArgsAction->setText(tr("Restore default"));
m_restoreArgsAction->setIcon(
QIcon::fromTheme(QStringLiteral("edit-undo"), QIcon(QStringLiteral(":/icons/hicolor/scalable/actions/edit-paste.svg"))));
connect(m_restoreArgsAction, &QAction::triggered, this, &LauncherOptionPage::restoreDefaultArguments);
ui()->argumentsLineEdit->addCustomAction(m_restoreArgsAction);
ui()->configDirPathSelection->provideCustomFileMode(QFileDialog::Directory);
ui()->dataDirPathSelection->provideCustomFileMode(QFileDialog::Directory);
}

View File

@ -14,6 +14,7 @@
#include <QProcess>
#include <QWidget>
QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QLabel)
namespace CppUtilities {
@ -126,7 +127,7 @@ private:
Data::SyncthingProcess *const m_process;
Data::SyncthingLauncher *const m_launcher;
QtUtilities::IconButton *m_restoreArgsButton;
QAction *m_restoreArgsAction;
bool m_kill;
QString m_tool;
};