forked from openlp/openlp
Bug #795068: Verse List in Song Editor did not resize properly
bzr-revno: 1928 Fixes: https://launchpad.net/bugs/795068
This commit is contained in:
commit
1128b424e5
@ -69,12 +69,8 @@ class Ui_EditSongDialog(object):
|
|||||||
self.lyricsLabel.setObjectName(u'lyricsLabel')
|
self.lyricsLabel.setObjectName(u'lyricsLabel')
|
||||||
self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
|
self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
|
||||||
QtCore.Qt.AlignTop)
|
QtCore.Qt.AlignTop)
|
||||||
self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
|
self.verseListWidget = SingleColumnTableWidget(self.lyricsTab)
|
||||||
self.verseListWidget.horizontalHeader().setVisible(False)
|
|
||||||
self.verseListWidget.horizontalHeader().setStretchLastSection(True)
|
|
||||||
self.verseListWidget.horizontalHeader().setMinimumSectionSize(16)
|
|
||||||
self.verseListWidget.setAlternatingRowColors(True)
|
self.verseListWidget.setAlternatingRowColors(True)
|
||||||
self.verseListWidget.setColumnCount(1)
|
|
||||||
self.verseListWidget.setSelectionBehavior(
|
self.verseListWidget.setSelectionBehavior(
|
||||||
QtGui.QAbstractItemView.SelectRows)
|
QtGui.QAbstractItemView.SelectRows)
|
||||||
self.verseListWidget.setSelectionMode(
|
self.verseListWidget.setSelectionMode(
|
||||||
@ -373,3 +369,24 @@ def editSongDialogComboBox(parent, name):
|
|||||||
comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||||
comboBox.setObjectName(name)
|
comboBox.setObjectName(name)
|
||||||
return comboBox
|
return comboBox
|
||||||
|
|
||||||
|
class SingleColumnTableWidget(QtGui.QTableWidget):
|
||||||
|
"""
|
||||||
|
Class to for a single column table widget to use for the verse table widget.
|
||||||
|
"""
|
||||||
|
def __init__(self, parent):
|
||||||
|
"""
|
||||||
|
Constrctor
|
||||||
|
"""
|
||||||
|
QtGui.QTableWidget.__init__(self, parent)
|
||||||
|
self.horizontalHeader().setVisible(False)
|
||||||
|
self.setColumnCount(1)
|
||||||
|
|
||||||
|
def resizeEvent(self, event):
|
||||||
|
"""
|
||||||
|
Resize the first column together with the widget.
|
||||||
|
"""
|
||||||
|
QtGui.QTableWidget.resizeEvent(self, event)
|
||||||
|
if self.columnCount():
|
||||||
|
self.setColumnWidth(0, event.size().width())
|
||||||
|
self.resizeRowsToContents()
|
||||||
|
@ -244,8 +244,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.themeComboBox, unicode(self.song.theme_name))
|
self.themeComboBox, unicode(self.song.theme_name))
|
||||||
self.copyrightEdit.setText(
|
self.copyrightEdit.setText(
|
||||||
self.song.copyright if self.song.copyright else u'')
|
self.song.copyright if self.song.copyright else u'')
|
||||||
self.verseListWidget.clear()
|
|
||||||
self.verseListWidget.setRowCount(0)
|
|
||||||
self.commentsEdit.setPlainText(
|
self.commentsEdit.setPlainText(
|
||||||
self.song.comments if self.song.comments else u'')
|
self.song.comments if self.song.comments else u'')
|
||||||
self.CCLNumberEdit.setText(
|
self.CCLNumberEdit.setText(
|
||||||
@ -345,7 +343,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
row_def = u'%s%s' % (verse_tag, verse_def[1:])
|
row_def = u'%s%s' % (verse_tag, verse_def[1:])
|
||||||
row_label.append(row_def)
|
row_label.append(row_def)
|
||||||
self.verseListWidget.setVerticalHeaderLabels(row_label)
|
self.verseListWidget.setVerticalHeaderLabels(row_label)
|
||||||
self.verseListWidget.setColumnWidth(0, self.width)
|
|
||||||
self.verseListWidget.resizeRowsToContents()
|
self.verseListWidget.resizeRowsToContents()
|
||||||
self.verseListWidget.repaint()
|
self.verseListWidget.repaint()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user