use point as the unit for font size in configuration
This commit is contained in:
parent
b2caf38e89
commit
959cdab6cb
|
@ -4078,7 +4078,7 @@ void Editor::applySettings()
|
|||
codeFolding().fillIndents = pSettings->editor().fillIndents();
|
||||
|
||||
QFont f=QFont(pSettings->editor().fontName());
|
||||
f.setPixelSize(pSettings->editor().fontSize());
|
||||
f.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
|
||||
f.setStyleStrategy(QFont::PreferAntialias);
|
||||
setFont(f);
|
||||
|
||||
|
@ -4089,10 +4089,10 @@ void Editor::applySettings()
|
|||
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
||||
if (pSettings->editor().gutterUseCustomFont()) {
|
||||
f=QFont(pSettings->editor().gutterFontName());
|
||||
f.setPixelSize(pSettings->editor().gutterFontSize());
|
||||
f.setPixelSize(pointToPixel(pSettings->editor().gutterFontSize()));
|
||||
} else {
|
||||
f=QFont(pSettings->editor().fontName());
|
||||
f.setPixelSize(pSettings->editor().fontSize());
|
||||
f.setPixelSize(pointToPixel(pSettings->editor().fontSize()));
|
||||
}
|
||||
f.setStyleStrategy(QFont::PreferAntialias);
|
||||
gutter().setFont(f);
|
||||
|
|
|
@ -540,13 +540,13 @@ void MainWindow::applySettings()
|
|||
updateEditorColorSchemes();
|
||||
|
||||
QFont font(pSettings->environment().interfaceFont());
|
||||
font.setPixelSize(pSettings->environment().interfaceFontSize());
|
||||
font.setPixelSize(pointToPixel(pSettings->environment().interfaceFontSize()));
|
||||
font.setStyleStrategy(QFont::PreferAntialias);
|
||||
qApp->setFont(font);
|
||||
this->setFont(font);
|
||||
|
||||
QFont caseEditorFont(pSettings->executor().caseEditorFontName());
|
||||
caseEditorFont.setPixelSize(pSettings->executor().caseEditorFontSize());
|
||||
caseEditorFont.setPixelSize(pointToPixel(pSettings->executor().caseEditorFontSize()));
|
||||
font.setStyleStrategy(QFont::PreferAntialias);
|
||||
ui->txtProblemCaseInput->setFont(caseEditorFont);
|
||||
ui->txtProblemCaseOutput->setFont(caseEditorFont);
|
||||
|
@ -1071,7 +1071,7 @@ void MainWindow::updateCompilerSet()
|
|||
void MainWindow::updateDebuggerSettings()
|
||||
{
|
||||
QFont font(pSettings->debugger().fontName());
|
||||
font.setPixelSize(pSettings->debugger().fontSize());
|
||||
font.setPixelSize(pointToPixel(pSettings->debugger().fontSize()));
|
||||
ui->debugConsole->setFont(font);
|
||||
ui->txtMemoryView->setFont(font);
|
||||
ui->txtLocals->setFont(font);
|
||||
|
|
|
@ -1167,7 +1167,7 @@ void Settings::Editor::doLoad()
|
|||
//Font
|
||||
//font
|
||||
mFontName = stringValue("font_name","consolas");
|
||||
mFontSize = intValue("font_size",16*qApp->desktop()->logicalDpiY()/96);
|
||||
mFontSize = intValue("font_size",14);
|
||||
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
|
||||
|
||||
//gutter
|
||||
|
@ -1181,7 +1181,7 @@ void Settings::Editor::doLoad()
|
|||
mGutterLineNumbersStartZero = boolValue("gutter_line_numbers_start_zero",false);
|
||||
mGutterUseCustomFont = boolValue("gutter_use_custom_font",false);
|
||||
mGutterFontName = stringValue("gutter_font_name","consolas");
|
||||
mGutterFontSize = intValue("gutter_font_size",16*qApp->desktop()->logicalDpiY()/96);
|
||||
mGutterFontSize = intValue("gutter_font_size",14);
|
||||
mGutterFontOnlyMonospaced = boolValue("gutter_font_only_monospaced",true);
|
||||
|
||||
//copy
|
||||
|
@ -2755,7 +2755,7 @@ void Settings::Environment::doLoad()
|
|||
}
|
||||
}
|
||||
mInterfaceFont = stringValue("interface_font",defaultFontName);
|
||||
mInterfaceFontSize = intValue("interface_font_size",12*qApp->desktop()->logicalDpiY()/96);
|
||||
mInterfaceFontSize = intValue("interface_font_size",10);
|
||||
mLanguage = stringValue("language", QLocale::system().name());
|
||||
|
||||
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
|
||||
|
@ -3007,7 +3007,7 @@ void Settings::Executor::doLoad()
|
|||
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
||||
mCaseEditorFontName = stringValue("case_editor_font_name","consolas");
|
||||
mCaseEditorFontSize = intValue("case_editor_font_size",14*qApp->desktop()->logicalDpiY()/96);
|
||||
mCaseEditorFontSize = intValue("case_editor_font_size",10);
|
||||
mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true);
|
||||
}
|
||||
|
||||
|
@ -3171,7 +3171,7 @@ void Settings::Debugger::doLoad()
|
|||
mShowDetailLog = boolValue("show_detail_log",false);
|
||||
mFontName = stringValue("font_name","Consolas");
|
||||
mOnlyShowMono = boolValue("only_show_mono",true);
|
||||
mFontSize = intValue("font_size",12*qApp->desktop()->logicalDpiY()/96);
|
||||
mFontSize = intValue("font_size",12);
|
||||
mUseIntelStyle = boolValue("use_intel_style",true);
|
||||
mBlendMode = boolValue("blend_mode",true);
|
||||
mSkipSystemLibraries = boolValue("skip_system_lib",true);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QStyleFactory>
|
||||
#include <QDateTime>
|
||||
#include <QColor>
|
||||
#include <QDesktopWidget>
|
||||
#include "parser/cppparser.h"
|
||||
#include "settings.h"
|
||||
#include "mainwindow.h"
|
||||
|
@ -957,3 +958,13 @@ QString localizePath(const QString &path)
|
|||
result.replace("/",QDir::separator());
|
||||
return result;
|
||||
}
|
||||
|
||||
float pointToPixel(float point)
|
||||
{
|
||||
return point * qApp->desktop()->logicalDpiY() / 72;
|
||||
}
|
||||
|
||||
float pixelToPoint(float pixel)
|
||||
{
|
||||
return pixel * 72 / qApp->desktop()->logicalDpiY();
|
||||
}
|
||||
|
|
|
@ -204,6 +204,9 @@ bool readRegistry(HKEY key,const QByteArray& subKey, const QByteArray& name, QSt
|
|||
class CppParser;
|
||||
void resetCppParser(std::shared_ptr<CppParser> parser);
|
||||
|
||||
float pointToPixel(float point);
|
||||
float pixelToPoint(float pixel);
|
||||
|
||||
|
||||
/**
|
||||
* from https://github.com/Microsoft/GSL
|
||||
|
|
Loading…
Reference in New Issue