commit b42ff0b925bbc3b97d6d1c269d9fbb34a3d785c7
parent 697d8b7750a761a5dbbfc15fef33855dbf79dd48
Author: ThomasV <thomasv@gitorious>
Date: Mon, 20 Apr 2015 12:32:48 +0200
gui: fix buttonsTextEdit bug
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/gui/qt/util.py b/gui/qt/util.py
@@ -330,8 +330,7 @@ class ButtonsWidget(QWidget):
super(QWidget, self).__init__()
self.buttons = []
- def resizeEvent(self, e):
- o = QWidget.resizeEvent(self, e)
+ def resizeButtons(self):
frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
x = self.rect().right() - frameWidth
y = self.rect().bottom() - frameWidth
@@ -339,7 +338,6 @@ class ButtonsWidget(QWidget):
sz = button.sizeHint()
x -= sz.width()
button.move(x, y - sz.height())
- return o
def addButton(self, icon_name, on_click, tooltip):
button = QToolButton(self)
@@ -356,12 +354,21 @@ class ButtonsLineEdit(QLineEdit, ButtonsWidget):
QLineEdit.__init__(self, text)
self.buttons = []
+ def resizeEvent(self, e):
+ o = QLineEdit.resizeEvent(self, e)
+ self.resizeButtons()
+ return o
+
class ButtonsTextEdit(QPlainTextEdit, ButtonsWidget):
def __init__(self, text=None):
QPlainTextEdit.__init__(self, text)
self.setText = self.setPlainText
self.buttons = []
+ def resizeEvent(self, e):
+ o = QPlainTextEdit.resizeEvent(self, e)
+ self.resizeButtons()
+ return o
if __name__ == "__main__":