Allow zooming of message body
Uses default system zoom settings (Ctrl-Wheel). Fixes #163
This commit is contained in:
parent
4033b945ee
commit
962c36e122
|
@ -21,6 +21,7 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
self.outpos = 0
|
self.outpos = 0
|
||||||
self.document().setUndoRedoEnabled(False)
|
self.document().setUndoRedoEnabled(False)
|
||||||
self.rendering = False
|
self.rendering = False
|
||||||
|
self.defaultFontPointSize = self.currentFont().pointSize()
|
||||||
self.verticalScrollBar().valueChanged.connect(self.lazyRender)
|
self.verticalScrollBar().valueChanged.connect(self.lazyRender)
|
||||||
|
|
||||||
def mousePressEvent(self, event):
|
def mousePressEvent(self, event):
|
||||||
|
@ -32,7 +33,16 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
self.showPlain()
|
self.showPlain()
|
||||||
else:
|
else:
|
||||||
super(MessageView, self).mousePressEvent(event)
|
super(MessageView, self).mousePressEvent(event)
|
||||||
|
|
||||||
|
def wheelEvent(self, event):
|
||||||
|
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
||||||
|
numDegrees = event.delta() / 8
|
||||||
|
numSteps = numDegrees / 15
|
||||||
|
zoomDiff = numSteps + self.currentFont().pointSize() - self.defaultFontPointSize
|
||||||
|
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1").arg(str(zoomDiff)))
|
||||||
|
# super will actually automatically take care of zooming
|
||||||
|
super(MessageView, self).wheelEvent(event)
|
||||||
|
|
||||||
def confirmURL(self, link):
|
def confirmURL(self, link):
|
||||||
reply = QtGui.QMessageBox.warning(self,
|
reply = QtGui.QMessageBox.warning(self,
|
||||||
QtGui.QApplication.translate(type(self).__name__, MessageView.CONFIRM_TITLE),
|
QtGui.QApplication.translate(type(self).__name__, MessageView.CONFIRM_TITLE),
|
||||||
|
|
Reference in New Issue
Block a user