summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2024-09-13 17:14:34 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2024-09-14 11:18:41 +0200
commit247fa8af6ce0ba8138e733f97ff6ec4a577c4692 (patch)
tree96ae5bfc73c44e05248a7bce48d6c87a2d1e11bd /vcl
parent9005798c6249008a1dacae467e47f174d48f8de2 (diff)
qt: QtFilePicker: Use modern connect syntax, port from deprecated signal
Use modern connect syntax and address the warning about the use of a deprecated signal that this revealed: `QCheckBox::checkStateChanged` was introduced in Qt 6.7 [1] and `QCheckBox::stateChanged` was deprecated in Qt 6.9 [2]. In file included from .../libreoffice/vcl/qt6/QtFilePicker.cxx:10: .../libreoffice/vcl/qt6/../qt5/QtFilePicker.cxx:693:44: error: 'stateChanged' is deprecated: Use checkStateChanged() instead [-Werror,-Wdeprecated-declarations] 693 | connect(pCheckbox, &QCheckBox::stateChanged, this, | ^ .../qt5/qtbase/src/widgets/widgets/qcheckbox.h:40:19: note: 'stateChanged' has been explicitly marked deprecated here 40 | QT_MOC_COMPAT QT_DEPRECATED_VERSION_X_6_9("Use checkStateChanged() instead") | ^ .../qt5/qtbase/src/corelib/global/qtdeprecationmarkers.h:179:44: note: expanded from macro 'QT_DEPRECATED_VERSION_X_6_9' 179 | # define QT_DEPRECATED_VERSION_X_6_9(text) QT_DEPRECATED_X(text) | ^ .../qt5/qtbase/src/corelib/global/qtdeprecationmarkers.h:29:33: note: expanded from macro 'QT_DEPRECATED_X' 29 | # define QT_DEPRECATED_X(text) Q_DECL_DEPRECATED_X(text) | ^ .../qt5/qtbase/src/corelib/global/qcompilerdetection.h:1004:36: note: expanded from macro 'Q_DECL_DEPRECATED_X' 1004 | # define Q_DECL_DEPRECATED_X(x) [[deprecated(x)]] [1] https://doc.qt.io/qt-6/qcheckbox.html#checkStateChanged [2] https://doc.qt.io/qt-6/qcheckbox-obsolete.html#stateChanged Change-Id: I0787b378855009abea740a0f5c1aab537c41987e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173348 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/QtFilePicker.cxx21
1 files changed, 12 insertions, 9 deletions
diff --git a/vcl/qt5/QtFilePicker.cxx b/vcl/qt5/QtFilePicker.cxx
index 3193f9901db5..524cff7dc95d 100644
--- a/vcl/qt5/QtFilePicker.cxx
+++ b/vcl/qt5/QtFilePicker.cxx
@@ -111,16 +111,14 @@ QtFilePicker::QtFilePicker(css::uno::Reference<css::uno::XComponentContext> cont
setMultiSelectionMode(false);
// XFilePickerListener notifications
- connect(m_pFileDialog.get(), SIGNAL(filterSelected(const QString&)), this,
- SLOT(filterSelected(const QString&)));
- connect(m_pFileDialog.get(), SIGNAL(currentChanged(const QString&)), this,
- SLOT(currentChanged(const QString&)));
+ connect(m_pFileDialog.get(), &QFileDialog::filterSelected, this, &QtFilePicker::filterSelected);
+ connect(m_pFileDialog.get(), &QFileDialog::currentChanged, this, &QtFilePicker::currentChanged);
// update automatic file extension when filter is changed
- connect(m_pFileDialog.get(), SIGNAL(filterSelected(const QString&)), this,
- SLOT(updateAutomaticFileExtension()));
+ connect(m_pFileDialog.get(), &QFileDialog::filterSelected, this,
+ &QtFilePicker::updateAutomaticFileExtension);
- connect(m_pFileDialog.get(), SIGNAL(finished(int)), this, SLOT(finished(int)));
+ connect(m_pFileDialog.get(), &QFileDialog::finished, this, &QtFilePicker::finished);
}
QtFilePicker::~QtFilePicker()
@@ -688,8 +686,13 @@ void QtFilePicker::addCustomControl(sal_Int16 controlId)
case CHECKBOX_AUTOEXTENSION:
pCheckbox = new QCheckBox(getResString(resId), m_pExtraControls);
// to add/remove automatic file extension based on checkbox
- connect(pCheckbox, SIGNAL(stateChanged(int)), this,
- SLOT(updateAutomaticFileExtension()));
+#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
+ connect(pCheckbox, &QCheckBox::checkStateChanged, this,
+ &QtFilePicker::updateAutomaticFileExtension);
+#else
+ connect(pCheckbox, &QCheckBox::stateChanged, this,
+ &QtFilePicker::updateAutomaticFileExtension);
+#endif
widget = pCheckbox;
break;
case CHECKBOX_PASSWORD: