Skip to content

qtvcp: fix PyQt5 ≥ 5.15 and PyQt6 compatibility - #3943

Closed
bgermann wants to merge 3 commits into
LinuxCNC:masterfrom
bgermann:qtpy
Closed

bgermann wants to merge 3 commits into
LinuxCNC: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)

@bgermann

Copy link
Copy Markdown
Contributor Author

Okay. The toPointF() calls should be resolved.

@NTULINUX

NTULINUX commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

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.

@NTULINUX

Copy link
Copy Markdown
Contributor

Is it possible to add a try: thing to python so if rcc is not found, it tries to use pyside6-rcc?

Also, /usr/lib/qt6/libexec/rcc is not in the default path in debian.

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.
@c-morley

Copy link
Copy Markdown
Collaborator

Thank you. pushed manually.

@c-morley c-morley closed this Apr 26, 2026
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