- fix: use pixel size for fonts, to fit different dpi in multiple displays
This commit is contained in:
parent
e7ae7f1220
commit
b2caf38e89
3
NEWS.md
3
NEWS.md
|
@ -1,3 +1,6 @@
|
|||
Version 0.11.3 For Dev-C++ 7 Beta
|
||||
- fix: use pixel size for fonts, to fit different dpi in multiple displays
|
||||
|
||||
Version 0.11.2 For Dev-C++ 7 Beta
|
||||
- fix: button "run all problem cases" not disabled when compiling or debugging
|
||||
- enhancement: set font for problem case input/output textedits
|
||||
|
|
|
@ -4077,7 +4077,8 @@ void Editor::applySettings()
|
|||
codeFolding().indentGuidesColor = pSettings->editor().indentLineColor();
|
||||
codeFolding().fillIndents = pSettings->editor().fillIndents();
|
||||
|
||||
QFont f=QFont(pSettings->editor().fontName(),pSettings->editor().fontSize());
|
||||
QFont f=QFont(pSettings->editor().fontName());
|
||||
f.setPixelSize(pSettings->editor().fontSize());
|
||||
f.setStyleStrategy(QFont::PreferAntialias);
|
||||
setFont(f);
|
||||
|
||||
|
@ -4087,9 +4088,11 @@ void Editor::applySettings()
|
|||
gutter().setBorderStyle(SynGutterBorderStyle::None);
|
||||
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
||||
if (pSettings->editor().gutterUseCustomFont()) {
|
||||
f=QFont(pSettings->editor().gutterFontName(),pSettings->editor().gutterFontSize());
|
||||
f=QFont(pSettings->editor().gutterFontName());
|
||||
f.setPixelSize(pSettings->editor().gutterFontSize());
|
||||
} else {
|
||||
f=QFont(pSettings->editor().fontName(),pSettings->editor().fontSize());
|
||||
f=QFont(pSettings->editor().fontName());
|
||||
f.setPixelSize(pSettings->editor().fontSize());
|
||||
}
|
||||
f.setStyleStrategy(QFont::PreferAntialias);
|
||||
gutter().setFont(f);
|
||||
|
|
|
@ -539,14 +539,14 @@ void MainWindow::applySettings()
|
|||
mFileInfoStatus->setPalette(appTheme->palette());
|
||||
updateEditorColorSchemes();
|
||||
|
||||
QFont font(pSettings->environment().interfaceFont(),
|
||||
pSettings->environment().interfaceFontSize());
|
||||
QFont font(pSettings->environment().interfaceFont());
|
||||
font.setPixelSize(pSettings->environment().interfaceFontSize());
|
||||
font.setStyleStrategy(QFont::PreferAntialias);
|
||||
qApp->setFont(font);
|
||||
this->setFont(font);
|
||||
|
||||
QFont caseEditorFont(pSettings->executor().caseEditorFontName(),
|
||||
pSettings->executor().caseEditorFontSize());
|
||||
QFont caseEditorFont(pSettings->executor().caseEditorFontName());
|
||||
caseEditorFont.setPixelSize(pSettings->executor().caseEditorFontSize());
|
||||
font.setStyleStrategy(QFont::PreferAntialias);
|
||||
ui->txtProblemCaseInput->setFont(caseEditorFont);
|
||||
ui->txtProblemCaseOutput->setFont(caseEditorFont);
|
||||
|
@ -1070,8 +1070,8 @@ void MainWindow::updateCompilerSet()
|
|||
|
||||
void MainWindow::updateDebuggerSettings()
|
||||
{
|
||||
QFont font(pSettings->debugger().fontName(),
|
||||
pSettings->debugger().fontSize());
|
||||
QFont font(pSettings->debugger().fontName());
|
||||
font.setPixelSize(pSettings->debugger().fontSize());
|
||||
ui->debugConsole->setFont(font);
|
||||
ui->txtMemoryView->setFont(font);
|
||||
ui->txtLocals->setFont(font);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||
{
|
||||
|
@ -148,6 +149,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
|||
|
||||
//setMouseTracking(true);
|
||||
setAcceptDrops(true);
|
||||
|
||||
}
|
||||
|
||||
int SynEdit::displayLineCount() const
|
||||
|
@ -4442,20 +4444,20 @@ void SynEdit::doRedoItem()
|
|||
void SynEdit::doZoomIn()
|
||||
{
|
||||
QFont newFont = font();
|
||||
int size = newFont.pointSize();
|
||||
int size = newFont.pixelSize();
|
||||
size++;
|
||||
newFont.setPointSize(size);
|
||||
newFont.setPixelSize(size);
|
||||
setFont(newFont);
|
||||
}
|
||||
|
||||
void SynEdit::doZoomOut()
|
||||
{
|
||||
QFont newFont = font();
|
||||
int size = newFont.pointSize();
|
||||
int size = newFont.pixelSize();
|
||||
size--;
|
||||
if (size<2)
|
||||
size = 2;
|
||||
newFont.setPointSize(size);
|
||||
newFont.setPixelSize(size);
|
||||
setFont(newFont);
|
||||
}
|
||||
|
||||
|
@ -5818,17 +5820,6 @@ 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();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QStandardPaths>
|
||||
#include <QScreen>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
||||
|
@ -1166,7 +1167,7 @@ void Settings::Editor::doLoad()
|
|||
//Font
|
||||
//font
|
||||
mFontName = stringValue("font_name","consolas");
|
||||
mFontSize = intValue("font_size",14);
|
||||
mFontSize = intValue("font_size",16*qApp->desktop()->logicalDpiY()/96);
|
||||
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
|
||||
|
||||
//gutter
|
||||
|
@ -1180,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",14);
|
||||
mGutterFontSize = intValue("gutter_font_size",16*qApp->desktop()->logicalDpiY()/96);
|
||||
mGutterFontOnlyMonospaced = boolValue("gutter_font_only_monospaced",true);
|
||||
|
||||
//copy
|
||||
|
@ -2753,8 +2754,8 @@ void Settings::Environment::doLoad()
|
|||
defaultFontName = fontName;
|
||||
}
|
||||
}
|
||||
mInterfaceFont = stringValue("interface font",defaultFontName);
|
||||
mInterfaceFontSize = intValue("interface font size",10);
|
||||
mInterfaceFont = stringValue("interface_font",defaultFontName);
|
||||
mInterfaceFontSize = intValue("interface_font_size",12*qApp->desktop()->logicalDpiY()/96);
|
||||
mLanguage = stringValue("language", QLocale::system().name());
|
||||
|
||||
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
|
||||
|
@ -2811,8 +2812,8 @@ void Settings::Environment::doSave()
|
|||
{
|
||||
//Appearence
|
||||
saveValue("theme", mTheme);
|
||||
saveValue("interface font", mInterfaceFont);
|
||||
saveValue("interface font size", mInterfaceFontSize);
|
||||
saveValue("interface_font", mInterfaceFont);
|
||||
saveValue("interface_font_size", mInterfaceFontSize);
|
||||
saveValue("language", mLanguage);
|
||||
|
||||
saveValue("current_folder",mCurrentFolder);
|
||||
|
@ -3006,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);
|
||||
mCaseEditorFontSize = intValue("case_editor_font_size",14*qApp->desktop()->logicalDpiY()/96);
|
||||
mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true);
|
||||
}
|
||||
|
||||
|
@ -3170,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);
|
||||
mFontSize = intValue("font_size",12*qApp->desktop()->logicalDpiY()/96);
|
||||
mUseIntelStyle = boolValue("use_intel_style",true);
|
||||
mBlendMode = boolValue("blend_mode",true);
|
||||
mSkipSystemLibraries = boolValue("skip_system_lib",true);
|
||||
|
|
|
@ -16,7 +16,7 @@ OJProblemPropertyWidget::~OJProblemPropertyWidget()
|
|||
void OJProblemPropertyWidget::setName(const QString &name)
|
||||
{
|
||||
QFont f = ui->lbName->font();
|
||||
f.setPointSize(f.pointSize()+2);
|
||||
f.setPixelSize(f.pixelSize()+2);
|
||||
f.setBold(true);
|
||||
ui->lbName->setFont(f);
|
||||
ui->lbName->setText(name);
|
||||
|
|
Loading…
Reference in New Issue