diff --git a/NEWS.md b/NEWS.md index 3b7c5a32..0da4ce31 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,6 +3,8 @@ Red Panda C++ Version 1.0.3 the app is restored to normal state, no matter it's current state. - enhancement: input shortcut in the option dialog's general -> shortcut page by pressing keys. - enhancement: shift+ctrl+down/up to move currenlt selection lines up / down + - fix: can't compile under linux + - enhancement: support Devcie Pixel Ratio ( for linux ) Red Panda C++ Version 1.0.2 - enhancement: press tab in column mode won't exit column mode diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index a0134e06..a00415ff 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -67,7 +67,7 @@ #include #include #include -#include "MainWindow.h" +#include "mainwindow.h" #include #include diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 6bf86100..d357afdd 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -146,7 +146,9 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent), mScrollHintColor = Qt::yellow; mScrollHintFormat = SynScrollHintFormat::shfTopLineOnly; - mContentImage = std::make_shared(clientWidth(),clientHeight(),QImage::Format_ARGB32); + qreal dpr=devicePixelRatioF(); + mContentImage = std::make_shared(clientWidth()*dpr,clientHeight()*dpr,QImage::Format_ARGB32); + mContentImage->setDevicePixelRatio(dpr); mUseCodeFolding = true; m_blinkTimerId = 0; @@ -5970,7 +5972,14 @@ void SynEdit::paintEvent(QPaintEvent *event) // only update caret // calculate the needed invalid area for caret //qDebug()<<"update caret"<devicePixelRatioF(); + cacheRC.setLeft(rcClip.left()*dpr); + cacheRC.setTop(rcClip.top()*dpr); + cacheRC.setWidth(rcClip.width()*dpr); + cacheRC.setHeight(rcClip.height()*dpr); + qDebug()<devicePixelRatioF(); + cacheRC.setLeft(rcClip.left()*dpr); + cacheRC.setTop(rcClip.top()*dpr); + cacheRC.setWidth(rcClip.width()*dpr); + cacheRC.setHeight(rcClip.height()*dpr); + painter.drawImage(rcClip,*mContentImage,cacheRC); } paintCaret(painter, rcCaret); } @@ -6017,8 +6032,10 @@ void SynEdit::paintEvent(QPaintEvent *event) void SynEdit::resizeEvent(QResizeEvent *) { //resize the cache image - std::shared_ptr image = std::make_shared(clientWidth(),clientHeight(), + qreal dpr = devicePixelRatioF(); + std::shared_ptr image = std::make_shared(clientWidth()*dpr,clientHeight()*dpr, QImage::Format_ARGB32); + image->setDevicePixelRatio(dpr); QRect newRect = image->rect().intersected(mContentImage->rect()); QPainter painter(image.get());