Commit Graph

102 Commits

Author SHA1 Message Date
pre-commit-ci[bot]
9fe130cd73 All: Reformat according to new standard 2025-11-11 13:49:01 +01:00
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
xtemp09
887e7bd595 Simplify repr() function 2025-08-25 10:38:39 -05: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
Kacper Donat
e18c88bd23 Misc: Replace dynamic_cast with qobject_cast 2025-04-26 14:23:25 +02:00
mos
9f220319d0 Removed old Python code <3.10 2025-03-07 16:34:08 -06:00
Benjamin Bræstrup Sayoc
8d2d0a47f4 Gui: Use QStringLiteral 2025-02-10 18:34:57 +01:00
tritao
2145b742eb Base: Standardize on Py::Long type for Python bindings. 2025-02-08 13:14:22 +00:00
wmayer
888a33917d Gui: modernize C++: use equals default 2023-08-20 18:12:43 +02:00
wmayer
e09d8aaba6 Gui: modernize C++: use range-based for loop 2023-08-14 19:42:18 +02:00
wmayer
7a3106d31b modernize C++: use bool literals 2023-08-06 01:35:39 +02:00
Alexander Golubev
35ae3750b9 Gui: Prevent UiLoader from loading 3rd-party Qt plugins.
Due to a flaw in the QUiLoader, UiLoader were loading all designer plugins
it can find in QApplication::libraryPaths(). This in general a bad
practice and leads to bugs due to some plugins may perform some unexpected
actions upon load which may interfere with FreeCAD's functionality.

To avoid such problems reset the libraryPaths before creation of a
UiLoader object.

Also move setLanguageChangeEnabled(true) into constructor due to it's
called every time it's being instanced anyway.

See: https://github.com/FreeCAD/FreeCAD/issues/8708
2023-03-18 17:59:50 +01:00
wmayer
8d42b6f93c Gui: move to new style connect() 2023-02-01 13:49:35 +01:00
wmayer
09ae3b2ab8 Gui: Qt6 port
* QString::indexOf() is now marked as [[nodiscard]]
* Replace deprecated methods of QMessageBox
* QMouseEvent::globalPos() is deprecated, use globalPosition().toPoint()
* QWidget::enterEvent() requires a QEnterEvent as argument
* QLibraryInfo::location() is deprecated, use path()
* QVariant::Type is deprecated, use QMetaType::Type
* QVariant::canConvert(int) is deprecated, use QVariant::canConvert(QMetaType) or QVariant::canConvert<T>()
* QMessageBox::standardIcon is deprecated, use QStyle::standardIcon()
* Replace deprecated method QMessageBox::question(), ...
* QApplication::fontMetrics() is deprecated
* QDropEvent::mouseButtons() is deprecated, use buttons()
* QDropEvent::keyboardModifiers() is deprecated, use modifiers()
* Constructor of QFontDatabase is deprecated, use static methods instead
* Qt::AA_DisableHighDpiScaling is deprecated
* Qt::AA_EnableHighDpiScaling is deprecated
* Qt::AA_UseHighDpiPixmaps is deprecated
2022-12-31 21:54:45 +01:00
marioalexis
ff1b4eff05 Gui: Replace C cast 2022-09-18 11:06:51 -05:00
berniev
ae53c9b0a4 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
Uwe
bb2b49fb1f [Gui] remove superfluous nullptr checks 2022-07-18 03:17:42 +02:00
Uwe
aa78832048 [Gui] Widgets and Window: remove unused includes 2022-02-21 00:39:24 +01:00
wmayer
8b7dadc1ab Gui: do not include generated ui file inside header file 2021-11-22 16:50:21 +01:00
wmayer
f36126770c App: harmonize API of App::Application
* make getHomePath() static and return a std::string
* make getExecutableName() static and return a std::string
2021-11-04 10:50:09 +01:00
wmayer
edf7fe4c7c Gui: use cbegin()/cend() for const_iterator 2021-09-23 11:17:42 +02:00
wmayer
4397c0f520 Gui: modernize some classes 2021-09-23 11:00:50 +02:00
wmayer
21ba35adab Gui: move PythonWrapper class to its own source file 2021-09-22 23:30:03 +02:00
wmayer
bc5c585c8b Gui: move Ui loader classes to their own source files 2021-09-22 20:31:01 +02:00
wmayer
8cb1b9e899 Gui: extend PythonWrapper:
* add methods to wrap/unwrap QDir
* add method to load QtUiTools module
2021-09-22 19:49:39 +02:00
luz paz
a213071c87 Gui: remove Py2 code from several src/Gui .cpp files 2021-04-14 14:56:02 +02:00
Chris Hennes
098d7b9aee [GUI] Remove code for Qt < 5.9 2021-04-02 10:10:37 +02:00
Chris Hennes
6b16e12d7c [OTHER] Catch only Exception, not BaseException 2021-02-11 11:52:45 +01:00
luz paz
38815b9550 Gui: Fix header uniformity, whitespace, and doxygen fixes 2020-11-26 10:14:56 +01:00
wmayer
cd3cf83415 Gui: [skip ci] add method to create Python wrapper for QObject 2020-11-23 16:48:54 +01:00
wmayer
88fd77b31d Porting Py3.8/Py3.9:
Since Py3.3: 'Py_ssize_t PyUnicode_GetSize(PyObject*)' is deprecated [-Wdeprecated-declarations]
Since Py3.9: 'PyObject* PyEval_CallObjectWithKeywords(PyObject*, PyObject*, PyObject*)' is deprecated [-Wdeprecated-declarations]
Since Py3.9: 'void PyEval_InitThreads()' is deprecated [-Wdeprecated-declarations]
2020-06-12 17:51:33 +02:00
Christian Cornelssen
6d05e156fc Workaround for messy SHIBOKEN_MICRO_VERSION definition.
I recently upgraded to `shiboken2-5.14.2.1`, and this broke preprocessing of
`src/Gui/WidgetFactory.cpp` because `SHIBOKEN_MICRO_VERSION` is now defined as
`2.1` (WTF?!), making it a floating-point literal which the preprocessor does
not like. It is only used for version comparison with `5.12.0`, so replacing
`SHIBOKEN_MICRO_VERSION` with `0` should be OK.
2020-04-28 18:50:13 +02:00
wandererfan
f34a7318bb [GUI]Add PySide unwrapper for QGraphicsItem 2020-03-12 07:58:38 -04:00
wmayer
6300e09dd8 handle some more warnings: -Wkeyword-macro -Wdeprecated-declarations -Wextra-semi 2019-11-18 11:56:08 +01:00
wmayer
93321dc208 make PySideUicModule working independent of linking PySide or loading it at runtime 2019-09-07 13:40:04 +02:00
Zheng, Lei
b4c500776d Gui: fix PythonWrapper::fromQIcon() 2019-08-30 15:47:39 +02:00
Zheng, Lei
ad57821cf9 Python feature/observer related changes
* Add new API and signal handler in document observer

* Pre initialize python handler function to improve performance. In
  case Python code use dynamic patching, i.e. add class method at
  runtime (which is rare and should be discouraged), the python feature
  can be re-initialized by simply assign proeprty Proxy again.

* Add property tracking in DocumentObjectT

* WidgetFactory adds support for accepting python QIcon, which is used
  by ViewProviderPythonFeature
2019-08-17 15:08:34 +02:00
wmayer
d422019cd7 use shiboken version number to check for existence of Shiboken::ObjectType::typeForTypeName 2019-08-02 16:31:13 +02:00
wmayer
da6a82eaca fix regression of previous commit and implement an alternative way to avoid MSVC compiler bug 2019-08-02 00:25:32 +02:00
wmayer
a3e6bf4ba5 avoid including bitset header and Qt 5.12's qfloat16.h in the same compilation unit
Hints: qfloat16.h is included through PySide2 headers
       There is a compiler bug in VS 2017 so that the build stops (https://bugreports.qt.io/browse/QTBUG-72073)
2019-08-01 20:01:33 +02:00
wmayer
b62366dbf9 code simplification in PythonWrapper 2019-06-22 14:32:50 +02:00
wmayer
d1e255f8d9 issue #0003984: Creating a Path Job object fails with 'PySide2.QtWidgets.QDialog' object has no attribute 'templateGroup' 2019-06-22 12:32:36 +02:00
wmayer
f839b31478 py3/py2: use exec as function 2019-05-10 17:15:33 +02:00
Mateusz Skowroński
ac508516da Use QString's multi-arg overload to save memory allocations. [-Wclazy-qstring-arg] Thanks Clazy! 2019-02-11 15:39:14 +01:00
wmayer
d65b6b67c0 check for existence of PySide stuff when defining convertWrapperToQuantity 2018-10-24 23:12:59 +02:00
wmayer
36f776aab8 restore shiboken wrapper for Base::Quantity 2018-10-24 22:27:59 +02:00
wmayer
4f56186d1b remove unused shiboken wrapper for Base::Quantity 2018-10-16 19:31:33 +02:00
Michal Ulianko
2e2b8cba6a py3.7 fix
PyUnicode_AsUTF8() returns const char* in py3.7 instead of char*. Making
changes to reflect that which should also be safe in
other Python versions.
2018-09-01 22:44:39 +02:00
wmayer
3ea8ae06ff generic wrapper/unwrapper for PySide and PyQt classes 2018-08-18 22:12:00 +02:00