|
1 | | -from PySide2 import QtCore |
2 | | -from PySide2.QtCore import Qt, QAbstractItemModel, QModelIndex, QSize |
3 | | -from PySide2.QtGui import QPalette, QFontMetricsF |
4 | | -from PySide2.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QWidget, QTableView, QItemDelegate, QStyle, QHeaderView, QAbstractItemView, QLabel, QPushButton |
| 1 | +import binaryninjaui |
| 2 | +if "qt_major_version" in binaryninjaui.__dict__ and binaryninjaui.qt_major_version == 6: |
| 3 | + from PySide6 import QtCore |
| 4 | + from PySide6.QtCore import Qt, QAbstractItemModel, QModelIndex, QSize |
| 5 | + from PySide6.QtGui import QPalette, QFontMetricsF |
| 6 | + from PySide6.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QWidget, QTableView, QItemDelegate, QStyle, QHeaderView, QAbstractItemView, QLabel, QPushButton |
| 7 | +else: |
| 8 | + from PySide2 import QtCore |
| 9 | + from PySide2.QtCore import Qt, QAbstractItemModel, QModelIndex, QSize |
| 10 | + from PySide2.QtGui import QPalette, QFontMetricsF |
| 11 | + from PySide2.QtWidgets import QApplication, QHBoxLayout, QVBoxLayout, QWidget, QTableView, QItemDelegate, QStyle, QHeaderView, QAbstractItemView, QLabel, QPushButton |
5 | 12 |
|
6 | 13 | import binaryninja |
7 | | -import binaryninjaui |
8 | 14 | from binaryninjaui import DockContextHandler, UIActionHandler, ThemeColor |
9 | 15 |
|
10 | 16 | from . import widget |
@@ -145,9 +151,6 @@ def __init__(self, parent, name, data): |
145 | 151 | self.table.resizeColumnsToContents() |
146 | 152 | self.table.resizeRowsToContents() |
147 | 153 |
|
148 | | - for i in range(len(self.model.columns)): |
149 | | - self.table.setColumnWidth(i, self.item_delegate.sizeHint(self.table.viewOptions(), self.model.index(-1, i, QModelIndex())).width()) |
150 | | - |
151 | 154 | update_layout = QHBoxLayout() |
152 | 155 | update_layout.setContentsMargins(0, 0, 0, 0) |
153 | 156 |
|
|
0 commit comments