Commit Graph

45 Commits

Author SHA1 Message Date
Ladislav Michl
769d14a1f1 Gui: PythonWrapper: Raise exception on qt_wrapInstance failure
When qt_wrapInstance fails it returns Py::Object with internal
pointer set to null. Make PythonWrapper::from* methods raise
exception when this happens to be consistent with PySide code path.
2024-03-03 15:20:48 +01:00
Ladislav Michl
da64119797 Gui: Implement PythonWrapper::fromQAction
Wrapping QAction through QObject does not work as QAction class
is a part of QtGui not QtCore, so Py::Object with internal
pointer being null is returned causing a crash later.
Therefore implement fromQAction conversion method.
2024-03-03 15:20:48 +01:00
Ladislav Michl
967633eca9 Gui: PythonWrapper: Do not steal reference
Foreign Python objects needs to be passed as Py::Object().
Py::asObject() is stealing reference and object might be garbage
collected even before dereferenced. Problem didn't show in the
original code because methods Py::asObject() was used in were
never called.

Fixes: ac6f991baf (Gui: Consolidate Python -> Qt class conversion)
2024-02-24 01:18:30 +01:00
wmayer
89a1dc0363 Gui: fix linter warnings 2024-02-22 11:47:48 +01:00
wmayer
b335a15ccc Gui: fixes #12540: ‘ModuleShiboken’ was not declared in this scope 2024-02-22 11:47:48 +01:00
wmayer
aed799ce2a Gui: removed unused variable 2024-02-20 14:44:53 +01:00
Ladislav Michl
16232eed95 Gui: PythonWrapper: move getCppPointer into template 2024-02-16 09:25:02 +01:00
Ladislav Michl
6f8268b394 Gui: PythonWrapper: move wrap instance argument into template 2024-02-16 09:22:57 +01:00
Ladislav Michl
9e65a334fb Gui: PythonWrapper: fix access via Python to QObject and QWidget 2024-02-16 09:22:57 +01:00
Ladislav Michl
ec93b2aef1 Gui: PythonWrapper: unify getPyTypeObjectForTypeName 2024-02-16 09:22:57 +01:00
Ladislav Michl
92d0e5a266 Gui: PythonWrapper: consolidate module loader 2024-02-16 09:22:54 +01:00
xtemp09
5aa36cd7dc Correction of #11775 2024-01-23 07:39:51 -06:00
xtemp09
51ccf610c0 Fix occasional segmentation fault when exiting
Fixes #11521.
2024-01-22 10:49:52 -06:00
Ladislav Michl
ac6f991baf Gui: Consolidate Python -> Qt class conversion 2024-01-22 06:58:17 +01:00
Ladislav Michl
9f5f00db69 Gui: Consolidate module error message in PythonWrapper 2024-01-22 06:58:17 +01:00
wmayer
3f7e4d42e5 fixes #11533: TypeError in: FreeCADGui.getMainWindow().windowStateChanged 2023-11-27 11:30:41 -06:00
wmayer
e72da4d4c4 Gui: modernize C++: use override 2023-08-04 17:09:53 +02:00
wmayer
b202eb2f6b Gui: support of wrapping QImage 2023-08-03 01:31:15 +02:00
wandererfan
c55a9256e1 [Gui]overload toQGraphicsItem, toQGraphicsObject for PyObject 2023-04-22 13:48:31 -04:00
Pesc0
876601d34d Remove all PyQt references 2023-03-31 10:36:04 +02:00
wmayer
fd7c7f35cf Gui: Use shiboken6 & PySide6 API 2023-01-01 19:06:06 +01:00
wmayer
f565fa2f7a Gui: refactor PythonWrapper 2023-01-01 17:42:25 +01:00
wmayer
6358ad1717 Gui: refactor PythonWrapper 2023-01-01 16:35:12 +01:00
wmayer
53e93c4363 Gui: include header for QPrinter 2022-12-22 16:28:01 +01:00
wmayer
caa7eb36f9 Gui: support of QPrintSupport module in PythonWrapper 2022-12-22 16:18:18 +01:00
luz paz
7637d58df0 Add missing brackets + change indentation to spaces 2022-12-12 11:38:06 +01:00
luz paz
80efe8191e Cleanup: move return statement to new line + trailing
Follow-up to #6497
2022-12-12 11:38:06 +01:00
wmayer
4a4c4dad6c Gui: [skip ci] fix build failure if shiboken support is disabled 2022-11-05 13:38:39 +01:00
wmayer
fda1b18b1a Gui: fix possible crash when running the garbage collector after creating a shiboken wrapper 2022-11-04 21:00:49 +01:00
wmayer
37d94bb4f9 Gui: include needed header 2022-10-31 11:32:06 +01:00
wmayer
58d227570d Gui: clear the list of Python wrapper when quitting the application 2022-10-31 11:17:41 +01:00
wmayer
7c51aa9749 Gui: [skip ci] Missing reference in range-for with non trivial type (Py::Object) [-Wclazy-range-loop-reference] 2022-10-25 13:36:39 +02:00
wmayer
51698f6a4c Gui: fix possible crash in WrapperManager 2022-10-25 12:48:55 +02:00
wmayer
7a77549ed7 Gui: cppcoreguidelines-pro-type-reinterpret-cast
Replace an unsafe reinterpret_cast with the safer static_cast
2022-10-24 17:09:53 +02:00
wmayer
804d0426a4 Gui: fix crash when accessing PySide wrapper after the underlying QObject has been destroyed 2022-10-21 17:05:55 +02:00
berniev
75acacd1b7 Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. 
* When possible use a ranged for loop instead of begin() and end() iterators
2022-09-14 13:25:13 -05:00
wmayer
b548d3b1ef Partially revert "Remove unused code into GUI" 2022-07-17 12:32:03 +02:00
andrea
3018985f80 Remove unused code into GUI 2022-07-17 03:53:11 +02:00
wmayer
971743a2e9 Gui: fix build failure with Qt 5.9 2022-05-08 19:36:51 +02:00
Wanderer Fan
ad64c57acd [Gui]add support for QGraphicsObject to PythonWrapper 2022-05-08 09:01:04 -04:00
Uwe
a55d1b03fd [Gui] Python and Property: remove unused includes 2022-03-05 03:44:45 +01:00
wmayer
00bb1d0b58 Gui: [skip ci] fix possible warning 2021-09-23 19:02:15 +02:00
0penBrain
3f224066db [BUILDFIX] Add missing includes 2021-09-23 13:14:03 +02:00
wmayer
eb18c2f9db Gui: modernize some classes 2021-09-23 11:00:50 +02:00
wmayer
00759f9c96 Gui: move PythonWrapper class to its own source file 2021-09-22 23:30:03 +02:00