Zooming info percent based an single step
Zooming in message body view / compose works in single steps irrespective of wheel sensitivity, and info about zoom level is displayed in percent rather than font pixel size.
This commit is contained in:
parent
d36d6f300e
commit
2597ac63f6
|
@ -9,14 +9,12 @@ class MessageCompose(QtGui.QTextEdit):
|
||||||
|
|
||||||
def wheelEvent(self, event):
|
def wheelEvent(self, event):
|
||||||
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
||||||
numDegrees = event.delta() / 8
|
if event.delta() > 0:
|
||||||
numSteps = numDegrees / 15
|
self.zoomIn(1)
|
||||||
zoomDiff = numSteps + self.currentFont().pointSize() - self.defaultFontPointSize
|
|
||||||
if numSteps > 0:
|
|
||||||
self.zoomIn(numSteps)
|
|
||||||
else:
|
else:
|
||||||
self.zoomOut(-numSteps)
|
self.zoomOut(1)
|
||||||
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1").arg(str(zoomDiff)))
|
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
||||||
|
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom)))
|
||||||
# super will actually automatically take care of zooming
|
# super will actually automatically take care of zooming
|
||||||
super(MessageCompose, self).wheelEvent(event)
|
super(MessageCompose, self).wheelEvent(event)
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,11 @@ class MessageView(QtGui.QTextBrowser):
|
||||||
super(MessageView, self).mousePressEvent(event)
|
super(MessageView, self).mousePressEvent(event)
|
||||||
|
|
||||||
def wheelEvent(self, 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 will actually automatically take care of zooming
|
||||||
super(MessageView, self).wheelEvent(event)
|
super(MessageView, self).wheelEvent(event)
|
||||||
|
if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
|
||||||
|
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
|
||||||
|
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom)))
|
||||||
|
|
||||||
def confirmURL(self, link):
|
def confirmURL(self, link):
|
||||||
reply = QtGui.QMessageBox.warning(self,
|
reply = QtGui.QMessageBox.warning(self,
|
||||||
|
|
Reference in New Issue
Block a user