- 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
|
Version 0.11.2 For Dev-C++ 7 Beta
|
||||||
- fix: button "run all problem cases" not disabled when compiling or debugging
|
- fix: button "run all problem cases" not disabled when compiling or debugging
|
||||||
- enhancement: set font for problem case input/output textedits
|
- enhancement: set font for problem case input/output textedits
|
||||||
|
|
|
@ -4077,7 +4077,8 @@ void Editor::applySettings()
|
||||||
codeFolding().indentGuidesColor = pSettings->editor().indentLineColor();
|
codeFolding().indentGuidesColor = pSettings->editor().indentLineColor();
|
||||||
codeFolding().fillIndents = pSettings->editor().fillIndents();
|
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);
|
f.setStyleStrategy(QFont::PreferAntialias);
|
||||||
setFont(f);
|
setFont(f);
|
||||||
|
|
||||||
|
@ -4087,9 +4088,11 @@ void Editor::applySettings()
|
||||||
gutter().setBorderStyle(SynGutterBorderStyle::None);
|
gutter().setBorderStyle(SynGutterBorderStyle::None);
|
||||||
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
||||||
if (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 {
|
} else {
|
||||||
f=QFont(pSettings->editor().fontName(),pSettings->editor().fontSize());
|
f=QFont(pSettings->editor().fontName());
|
||||||
|
f.setPixelSize(pSettings->editor().fontSize());
|
||||||
}
|
}
|
||||||
f.setStyleStrategy(QFont::PreferAntialias);
|
f.setStyleStrategy(QFont::PreferAntialias);
|
||||||
gutter().setFont(f);
|
gutter().setFont(f);
|
||||||
|
|
|
@ -539,14 +539,14 @@ void MainWindow::applySettings()
|
||||||
mFileInfoStatus->setPalette(appTheme->palette());
|
mFileInfoStatus->setPalette(appTheme->palette());
|
||||||
updateEditorColorSchemes();
|
updateEditorColorSchemes();
|
||||||
|
|
||||||
QFont font(pSettings->environment().interfaceFont(),
|
QFont font(pSettings->environment().interfaceFont());
|
||||||
pSettings->environment().interfaceFontSize());
|
font.setPixelSize(pSettings->environment().interfaceFontSize());
|
||||||
font.setStyleStrategy(QFont::PreferAntialias);
|
font.setStyleStrategy(QFont::PreferAntialias);
|
||||||
qApp->setFont(font);
|
qApp->setFont(font);
|
||||||
this->setFont(font);
|
this->setFont(font);
|
||||||
|
|
||||||
QFont caseEditorFont(pSettings->executor().caseEditorFontName(),
|
QFont caseEditorFont(pSettings->executor().caseEditorFontName());
|
||||||
pSettings->executor().caseEditorFontSize());
|
caseEditorFont.setPixelSize(pSettings->executor().caseEditorFontSize());
|
||||||
font.setStyleStrategy(QFont::PreferAntialias);
|
font.setStyleStrategy(QFont::PreferAntialias);
|
||||||
ui->txtProblemCaseInput->setFont(caseEditorFont);
|
ui->txtProblemCaseInput->setFont(caseEditorFont);
|
||||||
ui->txtProblemCaseOutput->setFont(caseEditorFont);
|
ui->txtProblemCaseOutput->setFont(caseEditorFont);
|
||||||
|
@ -1070,8 +1070,8 @@ void MainWindow::updateCompilerSet()
|
||||||
|
|
||||||
void MainWindow::updateDebuggerSettings()
|
void MainWindow::updateDebuggerSettings()
|
||||||
{
|
{
|
||||||
QFont font(pSettings->debugger().fontName(),
|
QFont font(pSettings->debugger().fontName());
|
||||||
pSettings->debugger().fontSize());
|
font.setPixelSize(pSettings->debugger().fontSize());
|
||||||
ui->debugConsole->setFont(font);
|
ui->debugConsole->setFont(font);
|
||||||
ui->txtMemoryView->setFont(font);
|
ui->txtMemoryView->setFont(font);
|
||||||
ui->txtLocals->setFont(font);
|
ui->txtLocals->setFont(font);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QDrag>
|
#include <QDrag>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
{
|
{
|
||||||
|
@ -148,6 +149,7 @@ SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent)
|
||||||
|
|
||||||
//setMouseTracking(true);
|
//setMouseTracking(true);
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEdit::displayLineCount() const
|
int SynEdit::displayLineCount() const
|
||||||
|
@ -4442,20 +4444,20 @@ void SynEdit::doRedoItem()
|
||||||
void SynEdit::doZoomIn()
|
void SynEdit::doZoomIn()
|
||||||
{
|
{
|
||||||
QFont newFont = font();
|
QFont newFont = font();
|
||||||
int size = newFont.pointSize();
|
int size = newFont.pixelSize();
|
||||||
size++;
|
size++;
|
||||||
newFont.setPointSize(size);
|
newFont.setPixelSize(size);
|
||||||
setFont(newFont);
|
setFont(newFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEdit::doZoomOut()
|
void SynEdit::doZoomOut()
|
||||||
{
|
{
|
||||||
QFont newFont = font();
|
QFont newFont = font();
|
||||||
int size = newFont.pointSize();
|
int size = newFont.pixelSize();
|
||||||
size--;
|
size--;
|
||||||
if (size<2)
|
if (size<2)
|
||||||
size = 2;
|
size = 2;
|
||||||
newFont.setPointSize(size);
|
newFont.setPixelSize(size);
|
||||||
setFont(newFont);
|
setFont(newFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5818,17 +5820,6 @@ void SynEdit::paintEvent(QPaintEvent *event)
|
||||||
|
|
||||||
// Now paint everything while the caret is hidden.
|
// Now paint everything while the caret is hidden.
|
||||||
QPainter painter(viewport());
|
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.
|
//Get the invalidated rect.
|
||||||
QRect rcClip = event->rect();
|
QRect rcClip = event->rect();
|
||||||
QRect rcCaret = calculateCaretRect();
|
QRect rcCaret = calculateCaretRect();
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
const char ValueToChar[28] = {'0', '1', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h',
|
||||||
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
|
||||||
|
@ -1166,7 +1167,7 @@ void Settings::Editor::doLoad()
|
||||||
//Font
|
//Font
|
||||||
//font
|
//font
|
||||||
mFontName = stringValue("font_name","consolas");
|
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);
|
mFontOnlyMonospaced = boolValue("font_only_monospaced",true);
|
||||||
|
|
||||||
//gutter
|
//gutter
|
||||||
|
@ -1180,7 +1181,7 @@ void Settings::Editor::doLoad()
|
||||||
mGutterLineNumbersStartZero = boolValue("gutter_line_numbers_start_zero",false);
|
mGutterLineNumbersStartZero = boolValue("gutter_line_numbers_start_zero",false);
|
||||||
mGutterUseCustomFont = boolValue("gutter_use_custom_font",false);
|
mGutterUseCustomFont = boolValue("gutter_use_custom_font",false);
|
||||||
mGutterFontName = stringValue("gutter_font_name","consolas");
|
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);
|
mGutterFontOnlyMonospaced = boolValue("gutter_font_only_monospaced",true);
|
||||||
|
|
||||||
//copy
|
//copy
|
||||||
|
@ -2753,8 +2754,8 @@ void Settings::Environment::doLoad()
|
||||||
defaultFontName = fontName;
|
defaultFontName = fontName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mInterfaceFont = stringValue("interface font",defaultFontName);
|
mInterfaceFont = stringValue("interface_font",defaultFontName);
|
||||||
mInterfaceFontSize = intValue("interface font size",10);
|
mInterfaceFontSize = intValue("interface_font_size",12*qApp->desktop()->logicalDpiY()/96);
|
||||||
mLanguage = stringValue("language", QLocale::system().name());
|
mLanguage = stringValue("language", QLocale::system().name());
|
||||||
|
|
||||||
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
|
mCurrentFolder = stringValue("current_folder",QDir::currentPath());
|
||||||
|
@ -2811,8 +2812,8 @@ void Settings::Environment::doSave()
|
||||||
{
|
{
|
||||||
//Appearence
|
//Appearence
|
||||||
saveValue("theme", mTheme);
|
saveValue("theme", mTheme);
|
||||||
saveValue("interface font", mInterfaceFont);
|
saveValue("interface_font", mInterfaceFont);
|
||||||
saveValue("interface font size", mInterfaceFontSize);
|
saveValue("interface_font_size", mInterfaceFontSize);
|
||||||
saveValue("language", mLanguage);
|
saveValue("language", mLanguage);
|
||||||
|
|
||||||
saveValue("current_folder",mCurrentFolder);
|
saveValue("current_folder",mCurrentFolder);
|
||||||
|
@ -3006,7 +3007,7 @@ void Settings::Executor::doLoad()
|
||||||
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
mCompetivieCompanionPort = intValue("competitive_companion_port",10045);
|
||||||
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
mIgnoreSpacesWhenValidatingCases = boolValue("ignore_spaces_when_validating_cases",false);
|
||||||
mCaseEditorFontName = stringValue("case_editor_font_name","consolas");
|
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);
|
mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3170,7 +3171,7 @@ void Settings::Debugger::doLoad()
|
||||||
mShowDetailLog = boolValue("show_detail_log",false);
|
mShowDetailLog = boolValue("show_detail_log",false);
|
||||||
mFontName = stringValue("font_name","Consolas");
|
mFontName = stringValue("font_name","Consolas");
|
||||||
mOnlyShowMono = boolValue("only_show_mono",true);
|
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);
|
mUseIntelStyle = boolValue("use_intel_style",true);
|
||||||
mBlendMode = boolValue("blend_mode",true);
|
mBlendMode = boolValue("blend_mode",true);
|
||||||
mSkipSystemLibraries = boolValue("skip_system_lib",true);
|
mSkipSystemLibraries = boolValue("skip_system_lib",true);
|
||||||
|
|
|
@ -16,7 +16,7 @@ OJProblemPropertyWidget::~OJProblemPropertyWidget()
|
||||||
void OJProblemPropertyWidget::setName(const QString &name)
|
void OJProblemPropertyWidget::setName(const QString &name)
|
||||||
{
|
{
|
||||||
QFont f = ui->lbName->font();
|
QFont f = ui->lbName->font();
|
||||||
f.setPointSize(f.pointSize()+2);
|
f.setPixelSize(f.pixelSize()+2);
|
||||||
f.setBold(true);
|
f.setBold(true);
|
||||||
ui->lbName->setFont(f);
|
ui->lbName->setFont(f);
|
||||||
ui->lbName->setText(name);
|
ui->lbName->setText(name);
|
||||||
|
|
Loading…
Reference in New Issue