mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1858284 [Automatic adding dialog has an unnecessary scrollbar](https://bugs.launchpad.net/calibre/+bug/1858284)
This commit is contained in:
parent
9a452f67b8
commit
b2c4abd9b0
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="ScrollingTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@ -445,6 +445,12 @@ that have been explicitly ignored below.</string>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>calibre/gui2/widgets.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ScrollingTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>calibre/gui2/widgets2.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../../resources/images.qrc"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<widget class="ScrollingTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
@ -1319,6 +1319,12 @@ column being examined (the left-hand pane)</string>
|
||||
<extends>QComboBox</extends>
|
||||
<header>calibre/gui2/complete2.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ScrollingTabWidget</class>
|
||||
<extends>QTabWidget</extends>
|
||||
<header>calibre/gui2/widgets2.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../../../../resources/images.qrc"/>
|
||||
|
@ -8,17 +8,17 @@ import weakref
|
||||
|
||||
from PyQt5.Qt import (
|
||||
QAbstractListModel, QApplication, QCheckBox, QColor, QColorDialog, QComboBox,
|
||||
QDialog, QDialogButtonBox, QFont, QIcon, QKeySequence, QLabel, QLayout,
|
||||
QModelIndex, QPalette, QPixmap, QPoint, QPushButton, QRect, QSize, QSizePolicy,
|
||||
QStyle, QStyledItemDelegate, Qt, QTextBrowser, QToolButton, QUndoCommand, QFontInfo,
|
||||
QUndoStack, QWidget, pyqtSignal
|
||||
QDialog, QDialogButtonBox, QFont, QFontInfo, QIcon, QKeySequence, QLabel,
|
||||
QLayout, QModelIndex, QPalette, QPixmap, QPoint, QPushButton, QRect, QScrollArea,
|
||||
QSize, QSizePolicy, QStyle, QStyledItemDelegate, Qt, QTabWidget, QTextBrowser,
|
||||
QToolButton, QUndoCommand, QUndoStack, QWidget, pyqtSignal
|
||||
)
|
||||
|
||||
from calibre.ebooks.metadata import rating_to_stars
|
||||
from calibre.utils.config_base import tweaks
|
||||
from calibre.gui2 import gprefs, rating_font
|
||||
from calibre.gui2.complete2 import EditWithComplete, LineEdit
|
||||
from calibre.gui2.widgets import history
|
||||
from calibre.utils.config_base import tweaks
|
||||
from polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
@ -482,6 +482,30 @@ class HTMLDisplay(QTextBrowser):
|
||||
self.anchor_clicked.emit(qurl)
|
||||
|
||||
|
||||
class ScrollingTabWidget(QTabWidget):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QTabWidget.__init__(self, parent)
|
||||
|
||||
def wrap_widget(self, page):
|
||||
sw = QScrollArea(self)
|
||||
sw.setWidget(page)
|
||||
sw.setWidgetResizable(True)
|
||||
page.setAutoFillBackground(False)
|
||||
sw.setStyleSheet('QScrollArea { background: transparent }')
|
||||
return sw
|
||||
|
||||
def indexOf(self, page):
|
||||
for i in range(self.count()):
|
||||
t = self.widget(i)
|
||||
if t.widget() is page:
|
||||
return i
|
||||
return -1
|
||||
|
||||
def addTab(self, page, *args):
|
||||
return QTabWidget.addTab(self, self.wrap_widget(page), *args)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from calibre.gui2 import Application
|
||||
app = Application([])
|
||||
|
Loading…
x
Reference in New Issue
Block a user