- enhancement: recalc layout info for code editors when dpi changed
This commit is contained in:
parent
956b717a14
commit
c3ea1e6dd4
|
@ -78,6 +78,7 @@ void ExecutableRunner::run()
|
|||
process.setCreateProcessArgumentsModifier([this](QProcess::CreateProcessArguments * args){
|
||||
if (mStartConsole) {
|
||||
args->flags |= CREATE_NEW_CONSOLE;
|
||||
args->flags &= ~CREATE_NO_WINDOW;
|
||||
}
|
||||
if (!mRedirectInput) {
|
||||
args->startupInfo -> dwFlags &= ~STARTF_USESTDHANDLES;
|
||||
|
|
|
@ -264,18 +264,6 @@ void EditorList::selectPreviousPage()
|
|||
}
|
||||
}
|
||||
|
||||
void EditorList::notifyDPIChanged(int dpi)
|
||||
{
|
||||
for (int i=0;i<mLeftPageWidget->count();i++) {
|
||||
Editor* e = static_cast<Editor*>(mLeftPageWidget->widget(i));
|
||||
e->changeDPI(dpi);
|
||||
}
|
||||
for (int i=0;i<mRightPageWidget->count();i++) {
|
||||
Editor* e = static_cast<Editor*>(mRightPageWidget->widget(i));
|
||||
e->changeDPI(dpi);
|
||||
}
|
||||
}
|
||||
|
||||
Editor *EditorList::operator[](int index)
|
||||
{
|
||||
if (index>=0 && index<mLeftPageWidget->count()) {
|
||||
|
|
|
@ -53,7 +53,6 @@ public:
|
|||
int pageCount();
|
||||
void selectNextPage();
|
||||
void selectPreviousPage();
|
||||
void notifyDPIChanged(int dpi);
|
||||
|
||||
Editor* operator[](int index);
|
||||
|
||||
|
|
|
@ -41,10 +41,7 @@ bool WindowLogoutEventFilter::nativeEventFilter(const QByteArray & /*eventType*/
|
|||
}
|
||||
break;
|
||||
case WM_DPICHANGED:
|
||||
if (pMainWindow) {
|
||||
int dpi = HIWORD(pMsg->wParam);
|
||||
pMainWindow->notifyDPIChanged(dpi);
|
||||
}
|
||||
//todo
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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<TodoParser>();
|
||||
mSymbolUsageManager = std::make_shared<SymbolUsageManager>();
|
||||
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="usesScrollButtons">
|
||||
<bool>true</bool>
|
||||
|
@ -1398,7 +1398,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1114</width>
|
||||
<height>30</height>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -275,7 +275,6 @@ public:
|
|||
|
||||
void updateMouseCursor();
|
||||
|
||||
void changeDPI(int dpi);
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue