Sat, 15 Sep 2018 19:59:20 +0200
E5TextEditSearchWidget: added method to modify the layout strategy.
--- a/APIs/Python3/eric6.api Sat Sep 15 16:05:36 2018 +0200 +++ b/APIs/Python3/eric6.api Sat Sep 15 19:59:20 2018 +0200 @@ -1280,6 +1280,7 @@ eric6.E5Gui.E5TextEditSearchWidget.E5TextEditSearchWidget.on_findNextButton_clicked?4() eric6.E5Gui.E5TextEditSearchWidget.E5TextEditSearchWidget.on_findPrevButton_clicked?4() eric6.E5Gui.E5TextEditSearchWidget.E5TextEditSearchWidget.on_findtextCombo_editTextChanged?4(txt) +eric6.E5Gui.E5TextEditSearchWidget.E5TextEditSearchWidget.setWidthForHeight?4(widthForHeight) eric6.E5Gui.E5TextEditSearchWidget.E5TextEditSearchWidget?1(parent=None, widthForHeight=True) eric6.E5Gui.E5TextSpinBox.E5TextSpinBox.addItem?4(txt, data=None) eric6.E5Gui.E5TextSpinBox.E5TextSpinBox.currentIndex?4()
--- a/Documentation/Help/source.qhp Sat Sep 15 16:05:36 2018 +0200 +++ b/Documentation/Help/source.qhp Sat Sep 15 19:59:20 2018 +0200 @@ -4935,6 +4935,7 @@ <keyword name="E5TextEditSearchWidget" id="E5TextEditSearchWidget" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget" /> <keyword name="E5TextEditSearchWidget (Constructor)" id="E5TextEditSearchWidget (Constructor)" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.__init__" /> <keyword name="E5TextEditSearchWidget (Module)" id="E5TextEditSearchWidget (Module)" ref="eric6.E5Gui.E5TextEditSearchWidget.html" /> + <keyword name="E5TextEditSearchWidget.__addWidthForHeightLayout" id="E5TextEditSearchWidget.__addWidthForHeightLayout" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.__addWidthForHeightLayout" /> <keyword name="E5TextEditSearchWidget.__find" id="E5TextEditSearchWidget.__find" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.__find" /> <keyword name="E5TextEditSearchWidget.__findByReturnPressed" id="E5TextEditSearchWidget.__findByReturnPressed" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.__findByReturnPressed" /> <keyword name="E5TextEditSearchWidget.__findNextPrevCallback" id="E5TextEditSearchWidget.__findNextPrevCallback" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.__findNextPrevCallback" /> @@ -4949,6 +4950,7 @@ <keyword name="E5TextEditSearchWidget.on_findNextButton_clicked" id="E5TextEditSearchWidget.on_findNextButton_clicked" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.on_findNextButton_clicked" /> <keyword name="E5TextEditSearchWidget.on_findPrevButton_clicked" id="E5TextEditSearchWidget.on_findPrevButton_clicked" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.on_findPrevButton_clicked" /> <keyword name="E5TextEditSearchWidget.on_findtextCombo_editTextChanged" id="E5TextEditSearchWidget.on_findtextCombo_editTextChanged" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.on_findtextCombo_editTextChanged" /> + <keyword name="E5TextEditSearchWidget.setWidthForHeight" id="E5TextEditSearchWidget.setWidthForHeight" ref="eric6.E5Gui.E5TextEditSearchWidget.html#E5TextEditSearchWidget.setWidthForHeight" /> <keyword name="E5TextSpinBox" id="E5TextSpinBox" ref="eric6.E5Gui.E5TextSpinBox.html#E5TextSpinBox" /> <keyword name="E5TextSpinBox (Constructor)" id="E5TextSpinBox (Constructor)" ref="eric6.E5Gui.E5TextSpinBox.html#E5TextSpinBox.__init__" /> <keyword name="E5TextSpinBox (Module)" id="E5TextSpinBox (Module)" ref="eric6.E5Gui.E5TextSpinBox.html" />
--- a/Documentation/Source/eric6.E5Gui.E5TextEditSearchWidget.html Sat Sep 15 16:05:36 2018 +0200 +++ b/Documentation/Source/eric6.E5Gui.E5TextEditSearchWidget.html Sat Sep 15 19:59:20 2018 +0200 @@ -60,6 +60,9 @@ <td><a href="#E5TextEditSearchWidget.__init__">E5TextEditSearchWidget</a></td> <td>Constructor</td> </tr><tr> +<td><a href="#E5TextEditSearchWidget.__addWidthForHeightLayout">__addWidthForHeightLayout</a></td> +<td>Private method to set the middle part of the layout.</td> +</tr><tr> <td><a href="#E5TextEditSearchWidget.__find">__find</a></td> <td>Private method to search the associated text edit.</td> </tr><tr> @@ -101,6 +104,9 @@ </tr><tr> <td><a href="#E5TextEditSearchWidget.on_findtextCombo_editTextChanged">on_findtextCombo_editTextChanged</a></td> <td>Private slot to enable/disable the find buttons.</td> +</tr><tr> +<td><a href="#E5TextEditSearchWidget.setWidthForHeight">setWidthForHeight</a></td> +<td>Public method to set the 'width for height'.</td> </tr> </table> <h3>Static Methods</h3> @@ -122,6 +128,16 @@ If this parameter is False, some widgets are shown in a third line. </dd> +</dl><a NAME="E5TextEditSearchWidget.__addWidthForHeightLayout" ID="E5TextEditSearchWidget.__addWidthForHeightLayout"></a> +<h4>E5TextEditSearchWidget.__addWidthForHeightLayout</h4> +<b>__addWidthForHeightLayout</b>(<i>widthForHeight</i>) +<p> + Private method to set the middle part of the layout. +</p><dl> +<dt><i>widthForHeight</i> (bool)</dt> +<dd> +flag indicating to prefer width +</dd> </dl><a NAME="E5TextEditSearchWidget.__find" ID="E5TextEditSearchWidget.__find"></a> <h4>E5TextEditSearchWidget.__find</h4> <b>__find</b>(<i>backwards</i>) @@ -275,6 +291,16 @@ <dd> text of the combobox (string) </dd> +</dl><a NAME="E5TextEditSearchWidget.setWidthForHeight" ID="E5TextEditSearchWidget.setWidthForHeight"></a> +<h4>E5TextEditSearchWidget.setWidthForHeight</h4> +<b>setWidthForHeight</b>(<i>widthForHeight</i>) +<p> + Public method to set the 'width for height'. +</p><dl> +<dt><i>widthForHeight</i> (bool)</dt> +<dd> +flag indicating to prefer width +</dd> </dl> <div align="right"><a href="#top">Up</a></div> <hr />
--- a/E5Gui/E5TextEditSearchWidget.py Sat Sep 15 16:05:36 2018 +0200 +++ b/E5Gui/E5TextEditSearchWidget.py Sat Sep 15 19:59:20 2018 +0200 @@ -135,10 +135,7 @@ # place everything together self.verticalLayout.addLayout(self.horizontalLayout1) - if widthForHeight: - self.horizontalLayout1.addLayout(self.horizontalLayout2) - else: - self.verticalLayout.addLayout(self.horizontalLayout2) + self.__addWidthForHeightLayout(widthForHeight) self.verticalLayout.addWidget(self.infoLabel) QMetaObject.connectSlotsByName(self) @@ -148,6 +145,35 @@ self.setTabOrder(self.wordCheckBox, self.findPrevButton) self.setTabOrder(self.findPrevButton, self.findNextButton) + def setWidthForHeight(self, widthForHeight): + """ + Public method to set the 'width for height'. + + @param widthForHeight flag indicating to prefer width + @type bool + """ + if self.__widthForHeight: + self.horizontalLayout1.takeAt(self.__widthForHeightLayoutIndex) + else: + self.verticalLayout.takeAt(self.__widthForHeightLayoutIndex) + self.__addWidthForHeightLayout(widthForHeight) + + self.__widthForHeight = widthForHeight + + def __addWidthForHeightLayout(self, widthForHeight): + """ + Private method to set the middle part of the layout. + + @param widthForHeight flag indicating to prefer width + @type bool + """ + if widthForHeight: + self.horizontalLayout1.addLayout(self.horizontalLayout2) + self.__widthForHeightLayoutIndex = 2 + else: + self.verticalLayout.insertLayout(1, self.horizontalLayout2) + self.__widthForHeightLayoutIndex = 1 + def attachTextEdit(self, textedit, editType="QTextEdit"): """ Public method to attach a QTextEdit widget.