diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-07-03 09:41:28 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-07-04 15:30:52 +0200 |
| commit | 058444c9d14062f5d8b117e91ee0aa5ed9ce6c27 (patch) | |
| tree | 6144735d8b7cc98d3fa79c06381d2af0f28e8998 /sources/pyside6/PySide6/glue | |
| parent | 1864c79821515f36cf1ce7d478ea9bf6436602b0 (diff) | |
Add QMessageBox.open() with a slot
Extract a helper function from QTimer::singleShot()
implementation and use that to implement it.
Fixes: PYSIDE-2805
Change-Id: Ib758d355b36c598052cfa495b53d7da423999976
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/glue')
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtcore.cpp | 21 | ||||
| -rw-r--r-- | sources/pyside6/PySide6/glue/qtwidgets.cpp | 6 |
2 files changed, 8 insertions, 19 deletions
diff --git a/sources/pyside6/PySide6/glue/qtcore.cpp b/sources/pyside6/PySide6/glue/qtcore.cpp index 0c206db72..899fedc3a 100644 --- a/sources/pyside6/PySide6/glue/qtcore.cpp +++ b/sources/pyside6/PySide6/glue/qtcore.cpp @@ -1061,25 +1061,8 @@ if (msec == 0) { QTimer * timer = %CONVERTTOCPP[QTimer *](pyTimer); timer->setSingleShot(true); - - if (PyObject_TypeCheck(%2, PySideSignalInstance_TypeF())) { - PySideSignalInstance *signalInstance = reinterpret_cast<PySideSignalInstance *>(%2); - Shiboken::AutoDecRef signalSignature(Shiboken::String::fromFormat("2%s", PySide::Signal::getSignature(signalInstance))); - Shiboken::AutoDecRef result( - PyObject_CallMethod(pyTimer, "connect", "OsOO", - pyTimer, - SIGNAL(timeout()), - PySide::Signal::getObject(signalInstance), - signalSignature.object()) - ); - } else { - Shiboken::AutoDecRef result( - PyObject_CallMethod(pyTimer, "connect", "OsO", - pyTimer, - SIGNAL(timeout()), - %PYARG_2) - ); - } + if (!PySide::callConnect(pyTimer, SIGNAL(timeout()), %PYARG_2)) + return nullptr; timer->connect(timer, &QTimer::timeout, timer, &QObject::deleteLater, Qt::DirectConnection); Shiboken::Object::releaseOwnership(reinterpret_cast<SbkObject *>(pyTimer)); diff --git a/sources/pyside6/PySide6/glue/qtwidgets.cpp b/sources/pyside6/PySide6/glue/qtwidgets.cpp index f886106cf..eeab64a43 100644 --- a/sources/pyside6/PySide6/glue/qtwidgets.cpp +++ b/sources/pyside6/PySide6/glue/qtwidgets.cpp @@ -809,6 +809,12 @@ const QByteArray signature = QByteArrayLiteral("2") + method.methodSignature(); Shiboken::Object::removeParent(reinterpret_cast<SbkObject *>(%PYSELF)); // @snippet qdialog-exec-remove-parent-relation +// @snippet qmessagebox-open-connect-accept +if (!PySide::callConnect(%PYSELF, SIGNAL(accepted()), %PYARG_1)) + return nullptr; +%CPPSELF.%FUNCTION_NAME(); +// @snippet qmessagebox-open-connect-accept + /********************************************************************* * CONVERSIONS ********************************************************************/ |
