diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-09-18 11:15:25 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2024-09-18 12:04:30 +0200 |
| commit | 0e97a47799667f241a706e473009f26c9d9d06a9 (patch) | |
| tree | 82b15ab9a8e8790aa4bd331a49e2692c361e4f39 | |
| parent | bbbe3b8ba777bd90e777f0e3ca9f4ab6821ed28e (diff) | |
PySide6/SerialBus: Fix CAN bus example
Amends e4199ec3881d8e556385af98084856be857e0dbe .
Task-number: PYSIDE-2846
Change-Id: I562aa4cfb30b92b698be440d3302ecd06f7d6722
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
| -rw-r--r-- | examples/serialbus/can/mainwindow.py | 2 | ||||
| -rw-r--r-- | examples/serialbus/can/receivedframesmodel.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/serialbus/can/mainwindow.py b/examples/serialbus/can/mainwindow.py index dda655888..d0fc74fc9 100644 --- a/examples/serialbus/can/mainwindow.py +++ b/examples/serialbus/can/mainwindow.py @@ -137,7 +137,7 @@ class MainWindow(QMainWindow): self.m_ui.actionDeviceInformation.setEnabled(True) self.m_ui.sendFrameBox.setEnabled(True) config_bit_rate = self.m_can_device.configurationParameter(QCanBusDevice.BitRateKey) - if config_bit_rate > 0: + if config_bit_rate is not None and config_bit_rate > 0: is_can_fd = bool(self.m_can_device.configurationParameter(QCanBusDevice.CanFdKey)) config_data_bit_rate = self.m_can_device.configurationParameter( QCanBusDevice.DataBitRateKey) diff --git a/examples/serialbus/can/receivedframesmodel.py b/examples/serialbus/can/receivedframesmodel.py index d9f843a39..d18354e0b 100644 --- a/examples/serialbus/can/receivedframesmodel.py +++ b/examples/serialbus/can/receivedframesmodel.py @@ -43,7 +43,7 @@ class ReceivedFramesModel(QAbstractTableModel): return True def headerData(self, section, orientation, role): - if role == Qt.AlignmentFlag.DisplayRole and orientation == Qt.AlignmentFlag.Horizontal: + if role == Qt.ItemDataRole.DisplayRole and orientation == Qt.Orientation.Horizontal: if section == ReceivedFramesModelColumns.number: return "#" if section == ReceivedFramesModelColumns.timestamp: @@ -57,7 +57,7 @@ class ReceivedFramesModel(QAbstractTableModel): if section == ReceivedFramesModelColumns.data: return "Data" - if role == Qt.AlignmentFlag.SizeHintRole and orientation == Qt.AlignmentFlag.Horizontal: + if role == Qt.ItemDataRole.SizeHintRole and orientation == Qt.Orientation.Horizontal: if section == ReceivedFramesModelColumns.number: return QSize(80, 25) if section == ReceivedFramesModelColumns.timestamp: @@ -77,9 +77,9 @@ class ReceivedFramesModel(QAbstractTableModel): return None row = index.row() column = index.column() - if role == Qt.AlignmentFlag.TextAlignmentRole: + if role == Qt.ItemDataRole.TextAlignmentRole: return column_alignment[index.column()] - if role == Qt.AlignmentFlag.DisplayRole: + if role == Qt.ItemDataRole.AlignmentFlag.DisplayRole: return self.m_framesQueue[row][column] if role == clipboard_text_role: f = self.m_framesQueue[row][column] |
