57 @param index index to get data for (QModelIndex) |
57 @param index index to get data for (QModelIndex) |
58 @param role role of the data to retrieve (integer) |
58 @param role role of the data to retrieve (integer) |
59 @return requested data |
59 @return requested data |
60 """ |
60 """ |
61 if role == Qt.ItemDataRole.CheckStateRole: |
61 if role == Qt.ItemDataRole.CheckStateRole: |
62 return (self.__value >> (self.__bits - index.column() - 1)) & 1 |
62 if (self.__value >> (self.__bits - index.column() - 1)) & 1: |
|
63 return Qt.CheckState.Checked |
|
64 else: |
|
65 return Qt.CheckState.Unchecked |
63 |
66 |
64 elif role == Qt.ItemDataRole.DisplayRole: |
67 elif role == Qt.ItemDataRole.DisplayRole: |
65 return "" |
68 return "" |
66 |
69 |
67 return None |
70 return None |
145 @param value value to be set |
148 @param value value to be set |
146 @param role role of the data (integer) |
149 @param role role of the data (integer) |
147 @return flag indicating success (boolean) |
150 @return flag indicating success (boolean) |
148 """ |
151 """ |
149 if role == Qt.ItemDataRole.CheckStateRole: |
152 if role == Qt.ItemDataRole.CheckStateRole: |
150 if ( |
153 if Qt.CheckState(value) == Qt.CheckState.Checked: |
151 value == Qt.CheckState.Checked and |
|
152 not self.data(index, Qt.ItemDataRole.CheckStateRole) |
|
153 ): |
|
154 self.__value |= (1 << self.__bits - index.column() - 1) |
154 self.__value |= (1 << self.__bits - index.column() - 1) |
155 else: |
155 else: |
156 self.__value &= ~(1 << self.__bits - index.column() - 1) |
156 self.__value &= ~(1 << self.__bits - index.column() - 1) |
157 self.dataChanged.emit(index, index) |
157 self.dataChanged.emit(index, index) |
158 return True |
158 return True |
178 super().__init__(parent) |
178 super().__init__(parent) |
179 self.setupUi(self) |
179 self.setupUi(self) |
180 |
180 |
181 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
181 self.setWindowIcon(UI.PixmapCache.getIcon("eric")) |
182 |
182 |
183 self.__badNumberSheet = "background-color: #ffa0a0;" |
183 self.__badNumberSheet = ( |
|
184 "background-color: #b31b1b;" |
|
185 if ericApp().usesDarkPalette() else |
|
186 "background-color: #ffa0a0;" |
|
187 ) |
184 |
188 |
185 self.binInButton.setIcon(UI.PixmapCache.getIcon("2downarrow")) |
189 self.binInButton.setIcon(UI.PixmapCache.getIcon("2downarrow")) |
186 self.binOutButton.setIcon(UI.PixmapCache.getIcon("2uparrow")) |
190 self.binOutButton.setIcon(UI.PixmapCache.getIcon("2uparrow")) |
187 self.octInButton.setIcon(UI.PixmapCache.getIcon("2downarrow")) |
191 self.octInButton.setIcon(UI.PixmapCache.getIcon("2downarrow")) |
188 self.octOutButton.setIcon(UI.PixmapCache.getIcon("2uparrow")) |
192 self.octOutButton.setIcon(UI.PixmapCache.getIcon("2uparrow")) |