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>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="ScrollingTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
@ -47,10 +47,10 @@
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="opt_swap_author_names">
|
<widget class="QCheckBox" name="opt_swap_author_names">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Swap the firstname and lastname of the author. This affects only metadata read from file names.</string>
|
<string>Swap the first name and last name of the author. This affects only metadata read from file names.</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Swap author firstname and lastname when reading author from filename</string>
|
<string>&Swap author first name and last name when reading author from filename</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -445,6 +445,12 @@ that have been explicitly ignored below.</string>
|
|||||||
<extends>QLineEdit</extends>
|
<extends>QLineEdit</extends>
|
||||||
<header>calibre/gui2/widgets.h</header>
|
<header>calibre/gui2/widgets.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ScrollingTabWidget</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header>calibre/gui2/widgets2.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../../resources/images.qrc"/>
|
<include location="../../../../resources/images.qrc"/>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="ScrollingTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>2</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
@ -1319,6 +1319,12 @@ column being examined (the left-hand pane)</string>
|
|||||||
<extends>QComboBox</extends>
|
<extends>QComboBox</extends>
|
||||||
<header>calibre/gui2/complete2.h</header>
|
<header>calibre/gui2/complete2.h</header>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>ScrollingTabWidget</class>
|
||||||
|
<extends>QTabWidget</extends>
|
||||||
|
<header>calibre/gui2/widgets2.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../../../../resources/images.qrc"/>
|
<include location="../../../../resources/images.qrc"/>
|
||||||
|
@ -8,17 +8,17 @@ import weakref
|
|||||||
|
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QAbstractListModel, QApplication, QCheckBox, QColor, QColorDialog, QComboBox,
|
QAbstractListModel, QApplication, QCheckBox, QColor, QColorDialog, QComboBox,
|
||||||
QDialog, QDialogButtonBox, QFont, QIcon, QKeySequence, QLabel, QLayout,
|
QDialog, QDialogButtonBox, QFont, QFontInfo, QIcon, QKeySequence, QLabel,
|
||||||
QModelIndex, QPalette, QPixmap, QPoint, QPushButton, QRect, QSize, QSizePolicy,
|
QLayout, QModelIndex, QPalette, QPixmap, QPoint, QPushButton, QRect, QScrollArea,
|
||||||
QStyle, QStyledItemDelegate, Qt, QTextBrowser, QToolButton, QUndoCommand, QFontInfo,
|
QSize, QSizePolicy, QStyle, QStyledItemDelegate, Qt, QTabWidget, QTextBrowser,
|
||||||
QUndoStack, QWidget, pyqtSignal
|
QToolButton, QUndoCommand, QUndoStack, QWidget, pyqtSignal
|
||||||
)
|
)
|
||||||
|
|
||||||
from calibre.ebooks.metadata import rating_to_stars
|
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 import gprefs, rating_font
|
||||||
from calibre.gui2.complete2 import EditWithComplete, LineEdit
|
from calibre.gui2.complete2 import EditWithComplete, LineEdit
|
||||||
from calibre.gui2.widgets import history
|
from calibre.gui2.widgets import history
|
||||||
|
from calibre.utils.config_base import tweaks
|
||||||
from polyglot.builtins import unicode_type
|
from polyglot.builtins import unicode_type
|
||||||
|
|
||||||
|
|
||||||
@ -482,6 +482,30 @@ class HTMLDisplay(QTextBrowser):
|
|||||||
self.anchor_clicked.emit(qurl)
|
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__':
|
if __name__ == '__main__':
|
||||||
from calibre.gui2 import Application
|
from calibre.gui2 import Application
|
||||||
app = Application([])
|
app = Application([])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user