View Single Post
Old 01-12-2022, 01:59 PM   #926
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,476
Karma: 8025702
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@capink: setTabStopWidth() is now setTabStopDistance().

I solved this problem in common_utils as follows:
The imports:
Code:
try:
    import qt.core as QtGui
    from qt.core import (Qt, QIcon, QPixmap, QLabel, QDialog, QHBoxLayout,
                         QTableWidgetItem, QFont, QLineEdit, QComboBox,
                         QVBoxLayout, QDialogButtonBox, QStyledItemDelegate, QDateTime,
                         QTextEdit,
                         QListWidget, QAbstractItemView)
    from qt.core import QRegularExpressionValidator as QRegExpValidator
    from qt.core import QRegularExpression as QRegExp

    using_Qt6 = True
except ImportError:
    using_Qt6 = False
    try:
        from PyQt5 import Qt as QtGui
        from PyQt5.Qt import (Qt, QIcon, QPixmap, QLabel, QDialog, QHBoxLayout,
                              QTableWidgetItem, QFont, QLineEdit, QComboBox,
                              QVBoxLayout, QDialogButtonBox, QStyledItemDelegate, QDateTime,
                              QRegExpValidator, QRegExp, QTextEdit,
                              QListWidget, QAbstractItemView)
    except ImportError:
        from PyQt4 import QtGui
        from PyQt4.Qt import (Qt, QIcon, QPixmap, QLabel, QDialog, QHBoxLayout,
                              QTableWidgetItem, QFont, QLineEdit, QComboBox,
                              QVBoxLayout, QDialogButtonBox, QStyledItemDelegate, QDateTime,
                              QRegExpValidator, QRegExp, QTextEdit,
                              QListWidget, QAbstractItemView)
And then where it is used:
Code:
        if using_Qt6:
            self.value_text.setTabStopDistance(24)
        else:
            self.value_text.setTabStopWidth(24)
chaley is offline   Reply With Quote