View Single Post
Old 01-12-2022, 04:18 PM   #927
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,203
Karma: 1995558
Join Date: Aug 2015
Device: Kindle
Quote:
Originally Posted by chaley View Post
@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: thanks for the tip . Since I removed PyQt4 support from all plugins I support and made the minimum calibre version 5.13, I directly replaced setTabStopWidth with setTabStopDistance.
capink is offline   Reply With Quote