5 |
5 |
6 """ |
6 """ |
7 Module implementing a widget to show numbers in different formats. |
7 Module implementing a widget to show numbers in different formats. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtCore import QAbstractTableModel, Qt, pyqtSignal, pyqtSlot |
10 from PyQt6.QtCore import QAbstractTableModel, QModelIndex, Qt, pyqtSignal, pyqtSlot |
11 from PyQt6.QtWidgets import QHeaderView, QWidget |
11 from PyQt6.QtWidgets import QHeaderView, QWidget |
12 |
12 |
13 from eric7.EricGui import EricPixmapCache |
13 from eric7.EricGui import EricPixmapCache |
14 from eric7.EricWidgets.EricApplication import ericApp |
14 from eric7.EricWidgets.EricApplication import ericApp |
15 |
15 |
30 super().__init__(parent) |
30 super().__init__(parent) |
31 |
31 |
32 self.__bits = 0 |
32 self.__bits = 0 |
33 self.__value = 0 |
33 self.__value = 0 |
34 |
34 |
35 def rowCount(self, parent): |
35 def rowCount(self, parent): # noqa: U100 |
36 """ |
36 """ |
37 Public method to get the number of rows of the model. |
37 Public method to get the number of rows of the model. |
38 |
38 |
39 @param parent parent index (QModelIndex) |
39 @param parent parent index (QModelIndex) |
40 @return number of columns (integer) |
40 @return number of columns (integer) |
41 """ |
41 """ |
42 return 1 |
42 return 1 |
43 |
43 |
44 def columnCount(self, parent): |
44 def columnCount(self, parent): # noqa: U100 |
45 """ |
45 """ |
46 Public method to get the number of columns of the model. |
46 Public method to get the number of columns of the model. |
47 |
47 |
48 @param parent parent index (QModelIndex) |
48 @param parent parent index (QModelIndex) |
49 @return number of columns (integer) |
49 @return number of columns (integer) |
67 elif role == Qt.ItemDataRole.DisplayRole: |
67 elif role == Qt.ItemDataRole.DisplayRole: |
68 return "" |
68 return "" |
69 |
69 |
70 return None |
70 return None |
71 |
71 |
72 def flags(self, index): |
72 def flags(self, index): # noqa: U100 |
73 """ |
73 """ |
74 Public method to get flags from the model. |
74 Public method to get flags from the model. |
75 |
75 |
76 @param index index to get flags for (QModelIndex) |
76 @param index index to get flags for (QModelIndex) |
77 @return flags (Qt.ItemFlags) |
77 @return flags (Qt.ItemFlags) |
352 """ |
352 """ |
353 Private slot to send a binary number. |
353 Private slot to send a binary number. |
354 """ |
354 """ |
355 self.insertNumber.emit(self.binEdit.text()) |
355 self.insertNumber.emit(self.binEdit.text()) |
356 |
356 |
|
357 @pyqtSlot(QModelIndex, QModelIndex) |
357 def __binModelDataChanged(self, start, end): |
358 def __binModelDataChanged(self, start, end): |
358 """ |
359 """ |
359 Private slot to handle a change of the binary model value by the user. |
360 Private slot to handle a change of the binary model value by the user. |
360 |
361 |
361 @param start start index (QModelIndex) |
362 @param start start index (QModelIndex) |