← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~m2j/openlp/bug-795068 into lp:openlp

 

Meinert Jordan has proposed merging lp:~m2j/openlp/bug-795068 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~m2j/openlp/bug-795068/+merge/100409

Bug #795068: Verse List in Song Editor did not resize properly
-- 
https://code.launchpad.net/~m2j/openlp/bug-795068/+merge/100409
Your team OpenLP Core is requested to review the proposed merge of lp:~m2j/openlp/bug-795068 into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongdialog.py'
--- openlp/plugins/songs/forms/editsongdialog.py	2012-03-05 19:45:32 +0000
+++ openlp/plugins/songs/forms/editsongdialog.py	2012-04-02 13:30:32 +0000
@@ -69,12 +69,8 @@
         self.lyricsLabel.setObjectName(u'lyricsLabel')
         self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
             QtCore.Qt.AlignTop)
-        self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
-        self.verseListWidget.horizontalHeader().setVisible(False)
-        self.verseListWidget.horizontalHeader().setStretchLastSection(True)
-        self.verseListWidget.horizontalHeader().setMinimumSectionSize(16)
+        self.verseListWidget = SingleColumnTableWidget(self.lyricsTab)
         self.verseListWidget.setAlternatingRowColors(True)
-        self.verseListWidget.setColumnCount(1)
         self.verseListWidget.setSelectionBehavior(
             QtGui.QAbstractItemView.SelectRows)
         self.verseListWidget.setSelectionMode(
@@ -373,3 +369,24 @@
     comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
     comboBox.setObjectName(name)
     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()

=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2012-03-31 09:58:34 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2012-04-02 13:30:32 +0000
@@ -248,8 +248,6 @@
             self.copyrightEdit.setText(self.song.copyright)
         else:
             self.copyrightEdit.setText(u'')
-        self.verseListWidget.clear()
-        self.verseListWidget.setRowCount(0)
         if self.song.comments:
             self.commentsEdit.setPlainText(self.song.comments)
         else:
@@ -355,7 +353,6 @@
             row_def = u'%s%s' % (verse_tag, verse_def[1:])
             row_label.append(row_def)
         self.verseListWidget.setVerticalHeaderLabels(row_label)
-        self.verseListWidget.setColumnWidth(0, self.width)
         self.verseListWidget.resizeRowsToContents()
         self.verseListWidget.repaint()
 


Follow ups