Fix QListView::Flow

This commit is contained in:
Kovid Goyal 2020-12-09 08:08:09 +05:30
parent fe45cb1111
commit 0c389a57ba
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
9 changed files with 12 additions and 12 deletions

View File

@ -699,7 +699,7 @@ class GridView(QListView):
setup_dnd_interface(self) setup_dnd_interface(self)
self.setUniformItemSizes(True) self.setUniformItemSizes(True)
self.setWrapping(True) self.setWrapping(True)
self.setFlow(Qt.LayoutDirection.LeftToRight) self.setFlow(QListView.Flow.LeftToRight)
# We cannot set layout mode to batched, because that breaks # We cannot set layout mode to batched, because that breaks
# restore_vpos() # restore_vpos()
# self.setLayoutMode(self.Batched) # self.setLayoutMode(self.Batched)

View File

@ -80,7 +80,7 @@ class ConfigWidget(QWidget):
g.setContentsMargins(0, 0, 0, 0) g.setContentsMargins(0, 0, 0, 0)
self.fields_view = v = FieldsList(self) self.fields_view = v = FieldsList(self)
g.addWidget(v) g.addWidget(v)
v.setFlow(Qt.LayoutDirection.LeftToRight) v.setFlow(QListView.Flow.LeftToRight)
v.setWrapping(True) v.setWrapping(True)
v.setResizeMode(v.Adjust) v.setResizeMode(v.Adjust)
self.fields_model = FieldsModel(self.plugin) self.fields_model = FieldsModel(self.plugin)

View File

@ -769,7 +769,7 @@ class CoversView(QListView): # {{{
self.m = CoversModel(current_cover, self) self.m = CoversModel(current_cover, self)
self.setModel(self.m) self.setModel(self.m)
self.setFlow(Qt.LayoutDirection.LeftToRight) self.setFlow(QListView.Flow.LeftToRight)
self.setWrapping(True) self.setWrapping(True)
self.setResizeMode(self.Adjust) self.setResizeMode(self.Adjust)
self.setGridSize(QSize(190, 260)) self.setGridSize(QSize(190, 260))

View File

@ -52,7 +52,7 @@ class ListView(QListView):
f.setBold(True) f.setBold(True)
self.setFont(f) self.setFont(f)
self.setIconSize(QSize(48, 48)) self.setIconSize(QSize(48, 48))
self.setFlow(self.TopToBottom) self.setFlow(QListView.Flow.TopToBottom)
self.setSpacing(10) self.setSpacing(10)
def currentChanged(self, cur, prev): def currentChanged(self, cur, prev):

View File

@ -9,7 +9,7 @@ import glob, os, shutil
from functools import partial from functools import partial
from PyQt5.Qt import ( from PyQt5.Qt import (
QDialog, QVBoxLayout, QListWidget, QListWidgetItem, Qt, QIcon, QDialog, QVBoxLayout, QListWidget, QListWidgetItem, Qt, QIcon,
QApplication, QSize, QDialogButtonBox, QTimer, QLabel, QAbstractItemView) QApplication, QSize, QDialogButtonBox, QTimer, QLabel, QAbstractItemView, QListView)
from calibre.constants import config_dir from calibre.constants import config_dir
from calibre.gui2 import choose_files, error_dialog from calibre.gui2 import choose_files, error_dialog
@ -47,7 +47,7 @@ class TextureChooser(QDialog):
il.itemDoubleClicked.connect(self.accept, type=Qt.ConnectionType.QueuedConnection) il.itemDoubleClicked.connect(self.accept, type=Qt.ConnectionType.QueuedConnection)
il.setIconSize(QSize(256, 256)) il.setIconSize(QSize(256, 256))
il.setViewMode(il.IconMode) il.setViewMode(il.IconMode)
il.setFlow(Qt.LayoutDirection.LeftToRight) il.setFlow(QListView.Flow.LeftToRight)
il.setSpacing(20) il.setSpacing(20)
il.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection) il.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
il.itemSelectionChanged.connect(self.update_remove_state) il.itemSelectionChanged.connect(self.update_remove_state)

View File

@ -591,7 +591,7 @@ class CharView(QListView):
self.delegate = CharDelegate(self) self.delegate = CharDelegate(self)
self.setResizeMode(self.Adjust) self.setResizeMode(self.Adjust)
self.setItemDelegate(self.delegate) self.setItemDelegate(self.delegate)
self.setFlow(Qt.LayoutDirection.LeftToRight) self.setFlow(QListView.Flow.LeftToRight)
self.setWrapping(True) self.setWrapping(True)
self.setMouseTracking(True) self.setMouseTracking(True)
self.setSpacing(2) self.setSpacing(2)

View File

@ -215,7 +215,7 @@ class InsertImage(Dialog):
self.view = v = QListView(self) self.view = v = QListView(self)
v.setViewMode(v.IconMode) v.setViewMode(v.IconMode)
v.setFlow(Qt.LayoutDirection.LeftToRight) v.setFlow(QListView.Flow.LeftToRight)
v.setSpacing(4) v.setSpacing(4)
v.setResizeMode(v.Adjust) v.setResizeMode(v.Adjust)
v.setUniformItemSizes(True) v.setUniformItemSizes(True)

View File

@ -11,7 +11,7 @@ from itertools import groupby
from operator import attrgetter, itemgetter from operator import attrgetter, itemgetter
from PyQt5.Qt import ( from PyQt5.Qt import (
Qt, QObject, QSize, QVBoxLayout, QStackedLayout, QWidget, QLineEdit, Qt, QObject, QSize, QVBoxLayout, QStackedLayout, QWidget, QLineEdit, QListView,
QToolButton, QIcon, QHBoxLayout, QPushButton, QListWidget, QListWidgetItem, QToolButton, QIcon, QHBoxLayout, QPushButton, QListWidget, QListWidgetItem,
QGridLayout, QPlainTextEdit, QLabel, QFrame, QDialog, QDialogButtonBox) QGridLayout, QPlainTextEdit, QLabel, QFrame, QDialog, QDialogButtonBox)
@ -486,7 +486,7 @@ class EditSnippet(QWidget):
add_row(_('&Template:'), t) add_row(_('&Template:'), t)
self.types = t = QListWidget(self) self.types = t = QListWidget(self)
t.setFlow(Qt.LayoutDirection.LeftToRight) t.setFlow(QListView.Flow.LeftToRight)
t.setWrapping(True), t.setResizeMode(t.Adjust), t.setSpacing(5) t.setWrapping(True), t.setResizeMode(t.Adjust), t.setSpacing(5)
fm = t.fontMetrics() fm = t.fontMetrics()
t.setMaximumHeight(2*(fm.ascent() + fm.descent()) + 25) t.setMaximumHeight(2*(fm.ascent() + fm.descent()) + 25)

View File

@ -16,7 +16,7 @@ from copy import copy, deepcopy
from PyQt5.Qt import ( from PyQt5.Qt import (
QDialog, QGridLayout, QStackedWidget, QDialogButtonBox, QListWidget, QDialog, QGridLayout, QStackedWidget, QDialogButtonBox, QListWidget,
QListWidgetItem, QIcon, QWidget, QSize, QFormLayout, Qt, QSpinBox, QListWidgetItem, QIcon, QWidget, QSize, QFormLayout, Qt, QSpinBox, QListView,
QCheckBox, pyqtSignal, QDoubleSpinBox, QComboBox, QLabel, QFont, QApplication, QCheckBox, pyqtSignal, QDoubleSpinBox, QComboBox, QLabel, QFont, QApplication,
QFontComboBox, QPushButton, QSizePolicy, QHBoxLayout, QGroupBox, QAbstractItemView, QFontComboBox, QPushButton, QSizePolicy, QHBoxLayout, QGroupBox, QAbstractItemView,
QToolButton, QVBoxLayout, QSpacerItem, QTimer, QRadioButton) QToolButton, QVBoxLayout, QSpacerItem, QTimer, QRadioButton)
@ -733,7 +733,7 @@ class Preferences(QDialog):
cl.currentRowChanged.connect(self.stacks.setCurrentIndex) cl.currentRowChanged.connect(self.stacks.setCurrentIndex)
cl.clearPropertyFlags() cl.clearPropertyFlags()
cl.setViewMode(cl.IconMode) cl.setViewMode(cl.IconMode)
cl.setFlow(cl.TopToBottom) cl.setFlow(QListView.Flow.TopToBottom)
cl.setMovement(cl.Static) cl.setMovement(cl.Static)
cl.setWrapping(False) cl.setWrapping(False)
cl.setSpacing(15) cl.setSpacing(15)