diff options
Diffstat (limited to 'sources/pyside6/plugins/uitools')
-rw-r--r-- | sources/pyside6/plugins/uitools/CMakeLists.txt | 18 | ||||
-rw-r--r-- | sources/pyside6/plugins/uitools/customwidget.cpp | 24 | ||||
-rw-r--r-- | sources/pyside6/plugins/uitools/customwidget.h | 8 | ||||
-rw-r--r-- | sources/pyside6/plugins/uitools/customwidgets.h | 8 |
4 files changed, 27 insertions, 31 deletions
diff --git a/sources/pyside6/plugins/uitools/CMakeLists.txt b/sources/pyside6/plugins/uitools/CMakeLists.txt index b24d5f9d7..06d0ae900 100644 --- a/sources/pyside6/plugins/uitools/CMakeLists.txt +++ b/sources/pyside6/plugins/uitools/CMakeLists.txt @@ -1,17 +1,17 @@ +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + project(plugins) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Widgets) -find_package(Qt6 COMPONENTS UiPlugin) +find_package(Qt6 COMPONENTS Core Gui Widgets UiPlugin) set(ui_plugin_src - customwidgets.cpp - customwidget.cpp + customwidgets.cpp customwidgets.h + customwidget.cpp customwidget.h ) add_library(uiplugin STATIC ${ui_plugin_src}) @@ -20,11 +20,7 @@ if(CMAKE_HOST_UNIX AND NOT CYGWIN) endif() add_definitions(-DQT_STATICPLUGIN) -if(${QT_MAJOR_VERSION} GREATER_EQUAL 6) - set_property(TARGET pyside6 PROPERTY CXX_STANDARD 17) -else() - set_property(TARGET pyside6 PROPERTY CXX_STANDARD 11) -endif() +set_property(TARGET pyside6 PROPERTY CXX_STANDARD 17) target_link_libraries(uiplugin Qt::Core diff --git a/sources/pyside6/plugins/uitools/customwidget.cpp b/sources/pyside6/plugins/uitools/customwidget.cpp index fa631ba14..976754feb 100644 --- a/sources/pyside6/plugins/uitools/customwidget.cpp +++ b/sources/pyside6/plugins/uitools/customwidget.cpp @@ -24,22 +24,22 @@ bool PyCustomWidget::isInitialized() const QIcon PyCustomWidget::icon() const { - return QIcon(); + return {}; } QString PyCustomWidget::domXml() const { - return QString(); + return {}; } QString PyCustomWidget::group() const { - return QString(); + return {}; } QString PyCustomWidget::includeFile() const { - return QString(); + return {}; } QString PyCustomWidget::name() const @@ -49,12 +49,12 @@ QString PyCustomWidget::name() const QString PyCustomWidget::toolTip() const { - return QString(); + return {}; } QString PyCustomWidget::whatsThis() const { - return QString(); + return {}; } // A copy of this code exists in PyDesignerCustomWidget::createWidget() @@ -64,9 +64,9 @@ QWidget *PyCustomWidget::createWidget(QWidget *parent) // Create a python instance and return cpp object PyObject *pyParent = nullptr; bool unknownParent = false; - if (parent) { + if (parent != nullptr) { pyParent = reinterpret_cast<PyObject *>(Shiboken::BindingManager::instance().retrieveWrapper(parent)); - if (pyParent) { + if (pyParent != nullptr) { Py_INCREF(pyParent); } else { static Shiboken::Conversions::SpecificConverter converter("QWidget*"); @@ -79,11 +79,11 @@ QWidget *PyCustomWidget::createWidget(QWidget *parent) } Shiboken::AutoDecRef pyArgs(PyTuple_New(1)); - PyTuple_SET_ITEM(pyArgs, 0, pyParent); // tuple will keep pyParent reference + PyTuple_SET_ITEM(pyArgs.object(), 0, pyParent); // tuple will keep pyParent reference // Call python constructor - auto result = reinterpret_cast<SbkObject *>(PyObject_CallObject(m_pyObject, pyArgs)); - if (!result) { + auto *result = reinterpret_cast<SbkObject *>(PyObject_CallObject(m_pyObject, pyArgs)); + if (result == nullptr) { qWarning("Unable to create a Python custom widget of type \"%s\".", qPrintable(m_name)); PyErr_Print(); @@ -98,7 +98,7 @@ QWidget *PyCustomWidget::createWidget(QWidget *parent) return reinterpret_cast<QWidget *>(Shiboken::Object::cppPointer(result, Py_TYPE(result))); } -void PyCustomWidget::initialize(QDesignerFormEditorInterface *core) +void PyCustomWidget::initialize(QDesignerFormEditorInterface *) { m_initialized = true; } diff --git a/sources/pyside6/plugins/uitools/customwidget.h b/sources/pyside6/plugins/uitools/customwidget.h index 8ffd88bc8..52621f0bd 100644 --- a/sources/pyside6/plugins/uitools/customwidget.h +++ b/sources/pyside6/plugins/uitools/customwidget.h @@ -1,15 +1,13 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef _PY_CUSTOM_WIDGET_H_ -#define _PY_CUSTOM_WIDGET_H_ +#ifndef PY_CUSTOM_WIDGET_H_ +#define PY_CUSTOM_WIDGET_H_ #include <shiboken.h> #include <QtUiPlugin/QDesignerCustomWidgetInterface> -#include <QtCore/qglobal.h> - class PyCustomWidget: public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT @@ -36,4 +34,4 @@ private: bool m_initialized = false; }; -#endif // _PY_CUSTOM_WIDGET_H_ +#endif // PY_CUSTOM_WIDGET_H_ diff --git a/sources/pyside6/plugins/uitools/customwidgets.h b/sources/pyside6/plugins/uitools/customwidgets.h index 47e2f73ed..f67a0847d 100644 --- a/sources/pyside6/plugins/uitools/customwidgets.h +++ b/sources/pyside6/plugins/uitools/customwidgets.h @@ -1,8 +1,8 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#ifndef _PY_CUSTOM_WIDGETS_H_ -#define _PY_CUSTOM_WIDGETS_H_ +#ifndef PY_CUSTOM_WIDGETS_H_ +#define PY_CUSTOM_WIDGETS_H_ #include <shiboken.h> @@ -18,8 +18,10 @@ class PyCustomWidgets: public QObject, public QDesignerCustomWidgetCollectionInt Q_PLUGIN_METADATA(IID "org.qt-project.Qt.PySide.PyCustomWidgetsInterface") public: + Q_DISABLE_COPY_MOVE(PyCustomWidgets) + explicit PyCustomWidgets(QObject *parent = nullptr); - ~PyCustomWidgets(); + ~PyCustomWidgets() override; QList<QDesignerCustomWidgetInterface*> customWidgets() const override; |