Skip to content

qtvcp: fix PyQt5 ≥ 5.15 and PyQt6 compatibility#3943

Open
bgermann wants to merge 3 commits intoLinuxCNC:masterfrom
bgermann:qtpy
Open

qtvcp: fix PyQt5 ≥ 5.15 and PyQt6 compatibility#3943
bgermann wants to merge 3 commits intoLinuxCNC:masterfrom
bgermann:qtpy

Conversation

@bgermann
Copy link
Copy Markdown
Contributor

This is a follow-up on #3881

@c-morley
Copy link
Copy Markdown
Collaborator

I suggest adding:

    LOG.info('green<Qt version: {}>'.format(QtCore.qVersion()))

on about line 171 in qtvcp.py, so we know what bindings are being used.

you can force pyqt6 by adding:

os.environ['QT_API'] = 'pyqt6'

on about line 11 in qtvcp.py

@c-morley
Copy link
Copy Markdown
Collaborator

In indicatorMixin.py I get erros related to using toPointF() need to switch to QPointF instead eg:

gradient = QtGui.QLinearGradient((top_bot + QtCore.QPointF(size, 0)), top_bot)

Replace removed Qt APIs and fix strict enum type checking:

- Replace QRegExp/QRegExpValidator with QRegularExpression/
  QRegularExpressionValidator

- Fix QDialogButtonBox.addButton() calls passing bare int 3
  instead of QDialogButtonBox.ActionRole

- Fix setSortIndicator() passing bare int instead of Qt.SortOrder
  enum

- Fix QLinearGradient() rejecting QPoint arguments (requires
  QPointF)

- Fix QVariant usage in table models: replace QVariant() returns
  with None, QVariant(x) returns with x, and QVariant.Double/Int
  type ID constants with a try/except fallback to Qt metatype
  integers

- Add try/except fallback for QEnum import (qtpy ≥ 2.0.0) with
  fallback to Q_ENUM and Q_ENUMS for older versions
GCodeGraphics._hal_cleanup() never stopped the QTimer or the
positionlogger background thread before HAL.exit() freed LinuxCNC's
shared memory. The C logger loop continued accessing NML/status memory
that had already been deallocated, causing a use-after-free segfault.

Stop the Qt poll timer and call logger.stop() at the start of
_hal_cleanup(), mirroring the shutdown sequence used by AXIS.
@bgermann
Copy link
Copy Markdown
Contributor Author

Okay. The toPointF() calls should be resolved.

@NTULINUX
Copy link
Copy Markdown
Contributor

NTULINUX commented Apr 21, 2026

How would one go about using pyside6-rcc/pyside6-uic instead of rcc or uic if Qt6, without breaking compatibility with Qt5? Without the pyside6 variants, those are specific to Qt5 and do not exist on a pure Qt6 system. I can force it to use the pyside6 ones but then that will break LinuxCNC on Qt5 systems.

@bgermann
Copy link
Copy Markdown
Contributor Author

I do not know what is supposed to be a "pure Qt6" system but Debian has the two programs in the qt6-base-dev-tools package, built from src/tools directory of the source distribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants