aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-10-11 17:45:43 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2018-11-22 17:00:11 +0000
commita57a202a70801f766094c3ed11664b03c9a6a3e4 (patch)
tree73c2c1f4fc902ccbc10b73811bbf299a2c555728 /sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
parentf93a7369657814206bfbce49817c8fbd9a1bfcba (diff)
Move inject-code snippets to separate files
When code must be modified or added to certain functions, we currently have two options: * Write a template and include it into the typesystem, * inject code directly at a certain place of the function entry. The problem with injecting raw code is that since it is an XML file, one need to escape protected symbols, like "<" and "&". Thanks to a couple of complementary commits, now we can place this code snippets on a separate file without triggering a whole module compiling process, since the typesystem itself will not be alterered. All the injected code from the typesystem was removed and placed into a single file per module inside a top-level directory called glue. Some small fixes were included mainly regarding styling of the code. Task-number: PYSIDE-834 Change-Id: I823e92d241a528d75d5940090008db9bf297f49e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp')
-rw-r--r--sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp77
1 files changed, 77 insertions, 0 deletions
diff --git a/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
new file mode 100644
index 000000000..6744c4be2
--- /dev/null
+++ b/sources/pyside2/PySide2/glue/qtwebkitwidgets.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of Qt for Python.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// @snippet qwebview-page
+SbkObject* _pyReturn = reinterpret_cast<SbkObject*>(%PYARG_0);
+if (!Shiboken::Object::hasParentInfo(_pyReturn))
+ Shiboken::Object::setParent(%PYSELF, %PYARG_0);
+// @snippet qwebview-page
+
+// @snippet qwebelementcollection-len
+return %CPPSELF.count();
+// @snippet qwebelementcollection-len
+
+// @snippet qwebelementcollection-getitem
+if (_i < 0 || _i >= %CPPSELF.count()) {
+ PyErr_SetString(PyExc_IndexError, "index out of bounds");
+ return 0;
+}
+QWebElement element = %CPPSELF.at(_i);
+return %CONVERTTOPYTHON[QWebElement](element);
+// @snippet qwebelementcollection-getitem
+
+// @snippet qwebpage-qt-metacall
+static int _signalIndex = -1;
+static QMetaMethod _m;
+
+if (_signalIndex == -1) {
+ _signalIndex = QWebPage::staticMetaObject.indexOfSlot("shouldInterruptJavaScript()")
+ _m = QWebPage::staticMetaObject.method(_signalIndex);
+}
+
+if (_signalIndex == id) {
+ Shiboken::GilState gil;
+ PyObject* self = (PyObject*)Shiboken::BindingManager::instance().retrieveWrapper(this);
+
+ if (self) {
+ Shiboken::AutoDecRef _pyMethod(PyObject_GetAttrString(self, "shouldInterruptJavaScript"));
+ return PySide::SignalManager::callPythonMetaMethod(_m, args, _pyMethod, false);
+ }
+}
+// @snippet qwebpage-qt-metacall