Commit Graph

62 Commits

Author SHA1 Message Date
Markus Reitböck
a72a0d6405 Gui: use CMake to generate precompiled headers on all platforms
"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
should be considered an optimization, not a requirement. In particular, do not explicitly include a
precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
generated precompile header on the compiler command line instead. This is more portable across
the major compilers and is likely to be easier to maintain. It will also avoid warnings being
generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
2025-09-14 09:47:03 +02:00
Kacper Donat
c9532316ff Gui: Fix wildcard call disconnects warnings Qt6.9 (#22096)
* Gui: Fix wildcard call disconnects warnings Qt6.9

* Gui: Fix typo

---------

Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
2025-06-23 17:42:03 +00:00
bofdahof
ba2c2ca5ad Console: rename PascalCase named methods to camelCase 2025-05-06 17:50:21 +02:00
Ladislav Michl
9683cf1e4f Base: rename Exception's PascalCase methods to camelCase 2025-05-05 23:50:01 +02:00
Andrea
25af2a6d92 Update PythonWrapper.cpp
.
2025-03-05 09:32:06 +01:00
Andrea
2d4ab5af20 REMOVE old QT<= 5.14 code
Ubuntu 22.04  use qt 1.15.3.
In the code is still used qt code <5.10.
A cleanup was done by removing qT code version used in ubuntu 18.04.
2025-03-05 09:32:06 +01:00
Yuri D'Elia
009e02b6c0 Gui: Fix Shiboken version detection and compilation error
- Shiboken headers need to be included first to get MAJOR/MINOR version
  flags. Without them the code would still compile, but fail the version
  check a few lines below assuming Shiboken is always older than 5.12
- Fix typo in cast when HAVE_SHIBOKEN_TYPE_FOR_TYPENAME is defined and
  remove the conditional: we have to assume typeForTypeName() always
  results in a valid name, as for the other implementations. There's no
  error handling of any kind in callers.

This fixes the build on debian unstable with shiboken 5.15.
2024-07-21 00:04:37 -05:00
wmayer
594c382e5e Gui: Fix comparison of argument of clicked() with StandardButton
Fixes #14639: Comparison between integers and StandardButton fails for Python task dialogs with PySide6
2024-06-16 22:18:58 -05:00
wmayer
17eac1ab69 Gui: Fix possible crash when using Shiboken::Enum::getValue
Fixes #14156
2024-06-16 22:18:58 -05:00
wmayer
03715005f8 Gui: Fix PythonWrapper::toEnum() to also accept a Python int as argument
See https://github.com/FreeCAD/FreeCAD/pull/13611#issuecomment-2097126565
2024-05-09 01:28:45 -04:00
wmayer
ac48d2bfb0 Core: Fix build failures and warnings 2024-05-07 19:48:33 +02:00
Martin Rodriguez Reboredo
51987dc1ab Fixups with Qt6 enums (#13611)
* Python PySide enums to C++ converter

* Python IntFlags to C++ int in getStandardButtons

* Remove int conversion in mods Python sources
2024-05-06 18:02:18 +02:00
Martin Rodriguez Reboredo
221ae53dbe Gui: TypeInitStruct for Shiboken6 builds 2024-04-29 16:08:07 -04:00
Ladislav Michl
15094fadef Gui: PythonWrapper: Consolidate typeName handling
Use typeName consistently for both PySide and Python interface
code paths.
2024-03-03 15:20:48 +01:00
wmayer
d4c564efe9 Gui: PythonWrapper: Make qt_getCppType more robust
Handle gracefully possible shiboken's Python API changes.
2024-03-03 15:20:48 +01:00
wmayer
3d2c365093 Gui: PythonWrapper: Fix possible crash in qt_wrapInstance 2024-03-03 15:20:48 +01:00
Ladislav Michl
cbff393dc1 Gui: PythonWrapper: Use getPyTypeObjectForTypeName consistently 2024-03-03 15:20:48 +01:00
Ladislav Michl
92e047d886 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
61bca92941 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
282c44ead1 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: 26babf4d3674 (Gui: Consolidate Python -> Qt class conversion)
2024-02-24 01:18:30 +01:00
wmayer
572a2f4243 Gui: fix linter warnings 2024-02-22 11:47:48 +01:00
wmayer
f22bfcef9b Gui: fixes #12540: ‘ModuleShiboken’ was not declared in this scope 2024-02-22 11:47:48 +01:00
wmayer
756329e7f4 Gui: removed unused variable 2024-02-20 14:44:53 +01:00
Ladislav Michl
b90f43d0d4 Gui: PythonWrapper: move getCppPointer into template 2024-02-16 09:25:02 +01:00
Ladislav Michl
3a26e22f38 Gui: PythonWrapper: move wrap instance argument into template 2024-02-16 09:22:57 +01:00
Ladislav Michl
7a3069797e Gui: PythonWrapper: fix access via Python to QObject and QWidget 2024-02-16 09:22:57 +01:00
Ladislav Michl
6d28656e44 Gui: PythonWrapper: unify getPyTypeObjectForTypeName 2024-02-16 09:22:57 +01:00
Ladislav Michl
8f029e551f Gui: PythonWrapper: consolidate module loader 2024-02-16 09:22:54 +01:00
xtemp09
f1fe2bb3a8 Correction of #11775 2024-01-23 07:39:51 -06:00
xtemp09
fbb114c47c Fix occasional segmentation fault when exiting
Fixes #11521.
2024-01-22 10:49:52 -06:00
Ladislav Michl
d03a0dfcd7 Gui: Consolidate Python -> Qt class conversion 2024-01-22 06:58:17 +01:00
Ladislav Michl
3dd2fc8f0f Gui: Consolidate module error message in PythonWrapper 2024-01-22 06:58:17 +01:00
wmayer
9fb08b887d fixes #11533: TypeError in: FreeCADGui.getMainWindow().windowStateChanged 2023-11-27 11:30:41 -06:00
wmayer
4d4267481f Gui: modernize C++: use override 2023-08-04 17:09:53 +02:00
wmayer
567b34419a Gui: support of wrapping QImage 2023-08-03 01:31:15 +02:00
wandererfan
ef68b1c020 [Gui]overload toQGraphicsItem, toQGraphicsObject for PyObject 2023-04-22 13:48:31 -04:00
Pesc0
99e13d9529 Remove all PyQt references 2023-03-31 10:36:04 +02:00
wmayer
64f6f73bcf Gui: Use shiboken6 & PySide6 API 2023-01-01 19:06:06 +01:00
wmayer
7a6e2cc6bb Gui: refactor PythonWrapper 2023-01-01 17:42:25 +01:00
wmayer
e8ed464559 Gui: refactor PythonWrapper 2023-01-01 16:35:12 +01:00
wmayer
9ce8743ff2 Gui: include header for QPrinter 2022-12-22 16:28:01 +01:00
wmayer
5657abebfc Gui: support of QPrintSupport module in PythonWrapper 2022-12-22 16:18:18 +01:00
luz paz
26cf9e771f Add missing brackets + change indentation to spaces 2022-12-12 11:38:06 +01:00
luz paz
f17b73a7bf Cleanup: move return statement to new line + trailing
Follow-up to #6497
2022-12-12 11:38:06 +01:00
wmayer
9c358a5d3a Gui: [skip ci] fix build failure if shiboken support is disabled 2022-11-05 13:38:39 +01:00
wmayer
9eb078da5d Gui: fix possible crash when running the garbage collector after creating a shiboken wrapper 2022-11-04 21:00:49 +01:00
wmayer
1ecfcf3e5e Gui: include needed header 2022-10-31 11:32:06 +01:00
wmayer
bf857c7997 Gui: clear the list of Python wrapper when quitting the application 2022-10-31 11:17:41 +01:00
wmayer
5f48e22bba 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
342666162a Gui: fix possible crash in WrapperManager 2022-10-25 12:48:55 +02:00