Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Update pixmap height calculation #4738

Merged
merged 3 commits into from
Jul 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions spyder/widgets/sourcecode/codeeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import time

# Third party imports
from qtpy import is_pyqt46
from qtpy import is_pyqt46, QT_VERSION
from qtpy.compat import to_qvariant
from qtpy.QtCore import QRect, QRegExp, QSize, Qt, QTimer, Signal, Slot
from qtpy.QtGui import (QBrush, QColor, QCursor, QFont, QIntValidator,
Expand All @@ -52,6 +52,7 @@
from spyder.utils import syntaxhighlighters as sh
from spyder.utils import encoding, sourcecode
from spyder.utils.dochelpers import getobj
from spyder.utils.programs import check_version
from spyder.utils.qthelpers import add_actions, create_action, mimedata2url
from spyder.utils.sourcecode import ALL_LANGUAGES, CELL_LANGUAGES
from spyder.widgets.editortools import PythonCFM
Expand All @@ -68,6 +69,7 @@
# For debugging purpose:
LOG_FILENAME = get_conf_path('codeeditor.log')
DEBUG_EDITOR = DEBUG >= 3
QT55_VERSION = check_version(QT_VERSION, "5.5", ">=")


def is_letter_or_number(char):
Expand Down Expand Up @@ -1179,7 +1181,12 @@ def linenumberarea_paint_event(self, event):
active_line_number = active_block.blockNumber() + 1

def draw_pixmap(ytop, pixmap):
painter.drawPixmap(0, ytop + (font_height-pixmap.height()) / 2,
if not QT55_VERSION:
pixmap_height = pixmap.height()
else:
# scale pixmap height to device independent pixels
pixmap_height = pixmap.height() / pixmap.devicePixelRatio()
painter.drawPixmap(0, ytop + (font_height-pixmap_height) / 2,
pixmap)

for top, line_number, block in self.visible_blocks:
Expand Down