diff --git a/RedPandaIDE/compiler/executablerunner.cpp b/RedPandaIDE/compiler/executablerunner.cpp index 8c050ef9..e8c3ade6 100644 --- a/RedPandaIDE/compiler/executablerunner.cpp +++ b/RedPandaIDE/compiler/executablerunner.cpp @@ -77,7 +77,8 @@ void ExecutableRunner::run() process.setProcessEnvironment(env); process.setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){ if (mStartConsole) { - args->flags |= CREATE_NEW_CONSOLE; + args->flags |= CREATE_NEW_CONSOLE; + args->flags &= ~CREATE_NO_WINDOW; } if (!mRedirectInput) { args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES; diff --git a/RedPandaIDE/editorlist.cpp b/RedPandaIDE/editorlist.cpp index d631aca1..cdf9cad4 100644 --- a/RedPandaIDE/editorlist.cpp +++ b/RedPandaIDE/editorlist.cpp @@ -264,18 +264,6 @@ void EditorList::selectPreviousPage() } } -void EditorList::notifyDPIChanged(int dpi) -{ - for (int i=0;icount();i++) { - Editor* e = static_cast(mLeftPageWidget->widget(i)); - e->changeDPI(dpi); - } - for (int i=0;icount();i++) { - Editor* e = static_cast(mRightPageWidget->widget(i)); - e->changeDPI(dpi); - } -} - Editor *EditorList::operator[](int index) { if (index>=0 && indexcount()) { diff --git a/RedPandaIDE/editorlist.h b/RedPandaIDE/editorlist.h index 37ee2eb5..e4820783 100644 --- a/RedPandaIDE/editorlist.h +++ b/RedPandaIDE/editorlist.h @@ -53,7 +53,6 @@ public: int pageCount(); void selectNextPage(); void selectPreviousPage(); - void notifyDPIChanged(int dpi); Editor* operator[](int index); diff --git a/RedPandaIDE/main.cpp b/RedPandaIDE/main.cpp index 2c47e0f9..ae197f6c 100644 --- a/RedPandaIDE/main.cpp +++ b/RedPandaIDE/main.cpp @@ -41,11 +41,8 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/ } break; case WM_DPICHANGED: - if (pMainWindow) { - int dpi = HIWORD(pMsg->wParam); - pMainWindow->notifyDPIChanged(dpi); - } - break; + //todo + break; } return false; } diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 747df46a..b0f644cd 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -175,8 +175,6 @@ MainWindow::MainWindow(QWidget *parent) this, &MainWindow::onDebugEvaluateInput); connect(ui->cbMemoryAddress->lineEdit(), &QLineEdit::returnPressed, this, &MainWindow::onDebugMemoryAddressInput); - connect(this,&MainWindow::dpiChanged, - this,&MainWindow::onDPIChanged); mTodoParser = std::make_shared(); mSymbolUsageManager = std::make_shared(); @@ -643,11 +641,6 @@ void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus) } } -void MainWindow::dpiChanged(int dpi) -{ - mEditorList->notifyDPIChanged(dpi); -} - void MainWindow::updateAppTitle() { QString appName=tr("Red Panda Dev-C++"); @@ -5633,12 +5626,6 @@ bool MainWindow::openningFiles() const return mOpenningFiles; } -void MainWindow::notifyDPIChanged(int dpi) -{ - emit dpiChanged(dpi); -} - - void MainWindow::on_actionTool_Window_Bars_triggered() { bool state = ui->tabInfos->isVisible(); diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 84eedb7d..9997d355 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -163,10 +163,6 @@ public: bool openningFiles() const; - void notifyDPIChanged(int dpi); - -signals: - void dpiChanged(int dpi); public slots: void onCompileLog(const QString& msg); void onCompileIssue(PCompileIssue issue); @@ -198,7 +194,6 @@ public slots: void onTodoParsing(const QString& filename, int lineNo, int ch, const QString& line); void onTodoParseFinished(); void setActiveBreakpoint(QString FileName, int Line, bool setFocus); - void onDPIChanged(); private: void prepareProjectForCompile(); @@ -658,7 +653,6 @@ protected: void closeEvent(QCloseEvent *event) override; void showEvent(QShowEvent* event) override; void hideEvent(QHideEvent *event) override; - }; extern MainWindow* pMainWindow; diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 932d9b7d..2d38fa16 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -85,7 +85,7 @@ QTabWidget::West - 1 + 2 true @@ -1398,7 +1398,7 @@ 0 0 1114 - 30 + 23 diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 0b57233f..4c2a976d 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -24,7 +24,6 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) { - mDPI = -1; mLastKey = 0; mLastKeyModifiers = Qt::NoModifier; mModified = false; @@ -149,8 +148,6 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent) //setMouseTracking(true); setAcceptDrops(true); - - mDPI = fontMetrics().fontDpi(); } int SynEdit::displayLineCount() const @@ -5809,26 +5806,8 @@ void SynEdit::updateMouseCursor(){ } } -void SynEdit::changeDPI(int dpi) -{ - if (dpi!=mDPI) { - mDPI=dpi; - } -} - void SynEdit::paintEvent(QPaintEvent *event) { - if (fontMetrics().fontDpi()!=mDPI) { - QFont f; - f.setFamily(font().family()); - f.setPointSize(font().pointSize()); - f.setBold(font().bold()); - f.setItalic(font().bold()); - f.setUnderline(font().underline()); - f.setStrikeOut(font().strikeOut()); - setFont(f); - return; - } if (mPainterLock>0) return; if (mPainting) @@ -5840,6 +5819,17 @@ void SynEdit::paintEvent(QPaintEvent *event) // Now paint everything while the caret is hidden. QPainter painter(viewport()); + if (fontMetrics().fontDpi()!=painter.device()->logicalDpiX()) { + QFont f; + f.setFamily(font().family()); + f.setPointSize(font().pointSize()); + f.setBold(font().bold()); + f.setItalic(font().bold()); + f.setUnderline(font().underline()); + f.setStrikeOut(font().strikeOut()); + setFont(f); + return; + } //Get the invalidated rect. QRect rcClip = event->rect(); QRect rcCaret = calculateCaretRect(); diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 6dd06be0..3f7511be 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -275,8 +275,7 @@ public: void updateMouseCursor(); - void changeDPI(int dpi); -// setter && getters + // setter && getters int topLine() const; void setTopLine(int value); @@ -706,8 +705,6 @@ private: BufferCoord mDragSelEndSave; bool mDragging; - int mDPI; - friend class SynEditTextPainter; // QWidget interface