|
4 | 4 | import os
|
5 | 5 | import re
|
6 | 6 | import codecs
|
7 |
| -from PySide2.QtWidgets import (QLineEdit, QPushButton, QApplication, QTextEdit, QWidget, |
8 |
| - QVBoxLayout, QHBoxLayout, QDialog, QFileSystemModel, QTreeView, QLabel, QSplitter, |
9 |
| - QInputDialog, QMessageBox, QHeaderView, QMenu, QAction, QKeySequenceEdit, |
10 |
| - QPlainTextEdit) |
11 |
| -from PySide2.QtCore import (QDir, QObject, Qt, QFileInfo, QItemSelectionModel, QSettings, QUrl) |
12 |
| -from PySide2.QtGui import (QFont, QFontMetrics, QDesktopServices, QKeySequence, QIcon) |
| 7 | +import binaryninjaui |
| 8 | +from binaryninjaui import (getMonospaceFont, UIAction, UIActionHandler, Menu, DockHandler) |
| 9 | +if "qt_major_version" in binaryninjaui.__dict__ and binaryninjaui.qt_major_version == 6: |
| 10 | + from PySide6.QtWidgets import (QLineEdit, QPushButton, QApplication, QTextEdit, QWidget, |
| 11 | + QVBoxLayout, QHBoxLayout, QDialog, QFileSystemModel, QTreeView, QLabel, QSplitter, |
| 12 | + QInputDialog, QMessageBox, QHeaderView, QMenu, QKeySequenceEdit, |
| 13 | + QPlainTextEdit) |
| 14 | + from PySide6.QtCore import (QDir, QObject, Qt, QFileInfo, QItemSelectionModel, QSettings, QUrl) |
| 15 | + from PySide6.QtGui import (QAction, QFont, QFontMetrics, QDesktopServices, QKeySequence, QIcon) |
| 16 | +else: |
| 17 | + from PySide2.QtWidgets import (QLineEdit, QPushButton, QApplication, QTextEdit, QWidget, |
| 18 | + QVBoxLayout, QHBoxLayout, QDialog, QFileSystemModel, QTreeView, QLabel, QSplitter, |
| 19 | + QInputDialog, QMessageBox, QHeaderView, QMenu, QKeySequenceEdit, QAction, |
| 20 | + QPlainTextEdit) |
| 21 | + from PySide2.QtCore import (QDir, QObject, Qt, QFileInfo, QItemSelectionModel, QSettings, QUrl) |
| 22 | + from PySide2.QtGui import (QFont, QFontMetrics, QDesktopServices, QKeySequence, QIcon) |
13 | 23 | from binaryninja import user_plugin_path
|
14 | 24 | from binaryninja.plugin import PluginCommand, MainThreadActionHandler
|
15 | 25 | from binaryninja.mainthread import execute_on_main_thread
|
16 | 26 | from binaryninja.log import (log_error, log_debug)
|
17 |
| -from binaryninjaui import (getMonospaceFont, UIAction, UIActionHandler, Menu, DockHandler) |
18 | 27 | import numbers
|
19 | 28 | from .QCodeEditor import QCodeEditor, PythonHighlighter
|
20 | 29 |
|
@@ -164,7 +173,7 @@ def __init__(self, context, parent=None):
|
164 | 173 | font = getMonospaceFont(self)
|
165 | 174 | self.edit.setFont(font)
|
166 | 175 | font = QFontMetrics(font)
|
167 |
| - self.edit.setTabStopWidth(4 * font.width(' ')) #TODO, replace with settings API |
| 176 | + self.edit.setTabStopDistance(4 * font.horizontalAdvance(' ')) #TODO, replace with settings API |
168 | 177 |
|
169 | 178 | #Files
|
170 | 179 | self.files = QFileSystemModel()
|
|
0 commit comments