Allow zooming of message body
Uses default system zoom settings (Ctrl-Wheel). Fixes #163
This commit is contained in:
parent
882c414e68
commit
376b755acc
|
@ -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):
|
||||||
|
@ -33,6 +34,15 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
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),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user