- fix: menu font size is wrong when dpi changed

This commit is contained in:
Roy Qu 2022-03-02 15:17:09 +08:00
parent ecf567b13f
commit d93a41e496
3 changed files with 11 additions and 2 deletions

View File

@ -9,7 +9,7 @@ Red Panda C++ Version 0.14.5
- enhancement: add option "hide symbols start with underscore" and "hide synbols start with two underscore" - enhancement: add option "hide symbols start with underscore" and "hide synbols start with two underscore"
- fix: can't rename project files that not openned in editor - fix: can't rename project files that not openned in editor
- enhancement: group undo will stop at spaces - enhancement: group undo will stop at spaces
- fix: menu font size is wrong when dpi changed
Red Panda C++ Version 0.14.4 Red Panda C++ Version 0.14.4
- enhancement: git - log - enhancement: git - log

View File

@ -239,6 +239,14 @@ void setTheme(const QString& theme) {
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
//QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
//#ifdef Q_OS_WIN
// QApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
// QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
// qputenv("QT_SCALE_FACTOR_ROUNDING_POLICY","PassThrough");
// qputenv("QT_DEVICE_PIXEL_RATIO ","auto");
// qputenv("QT_AUTO_SCREEN_SCALE_FACTOR","false");
//#endif
QApplication app(argc, argv); QApplication app(argc, argv);
QFile tempFile(QDir::tempPath()+QDir::separator()+"RedPandaDevCppStartUp.lock"); QFile tempFile(QDir::tempPath()+QDir::separator()+"RedPandaDevCppStartUp.lock");

View File

@ -752,7 +752,7 @@ void MainWindow::setActiveBreakpoint(QString FileName, int Line, bool setFocus)
void MainWindow::updateDPI(int oldDPI, int newDPI) void MainWindow::updateDPI(int oldDPI, int newDPI)
{ {
applySettings(); //applySettings();
if (oldDPI<1) if (oldDPI<1)
oldDPI = 1; oldDPI = 1;
mBottomPanelHeight = mBottomPanelHeight * newDPI / oldDPI ; mBottomPanelHeight = mBottomPanelHeight * newDPI / oldDPI ;
@ -4147,6 +4147,7 @@ void MainWindow::hideEvent(QHideEvent *)
bool MainWindow::event(QEvent *event) bool MainWindow::event(QEvent *event)
{ {
if (event->type()==DPI_CHANGED_EVENT) { if (event->type()==DPI_CHANGED_EVENT) {
applySettings();
int saveHeight = mBottomPanelHeight ; int saveHeight = mBottomPanelHeight ;
int saveWidth = mLeftPanelWidth; int saveWidth = mLeftPanelWidth;
openCloseBottomPanel(mBottomPanelOpenned); openCloseBottomPanel(mBottomPanelOpenned);