forked from qt-creator/qt-creator
CompilerExplorer: Adjust Terminal font size
Adjust the output Terminal font size based on the text editor font size settings. Change-Id: Id1047f0fce0ac781cbc51b01f0df9657b179d71a Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -32,8 +32,8 @@ struct SearchHit
|
|||||||
bool operator==(const SearchHit &other) const { return !operator!=(other); }
|
bool operator==(const SearchHit &other) const { return !operator!=(other); }
|
||||||
};
|
};
|
||||||
|
|
||||||
QString defaultFontFamily();
|
QString TERMINAL_EXPORT defaultFontFamily();
|
||||||
int defaultFontSize();
|
int TERMINAL_EXPORT defaultFontSize();
|
||||||
|
|
||||||
class TERMINAL_EXPORT TerminalView : public QAbstractScrollArea
|
class TERMINAL_EXPORT TerminalView : public QAbstractScrollArea
|
||||||
{
|
{
|
||||||
|
@@ -446,6 +446,22 @@ Core::SearchableTerminal *CompilerWidget::createTerminal()
|
|||||||
|
|
||||||
m_resultTerminal->setColors(colors);
|
m_resultTerminal->setColors(colors);
|
||||||
|
|
||||||
|
auto setFontSize = [this](const TextEditor::FontSettings &fontSettings) {
|
||||||
|
QFont f;
|
||||||
|
f.setFixedPitch(true);
|
||||||
|
f.setFamily(TerminalSolution::defaultFontFamily());
|
||||||
|
f.setPointSize(TerminalSolution::defaultFontSize() * (fontSettings.fontZoom() / 100.0f));
|
||||||
|
|
||||||
|
m_resultTerminal->setFont(f);
|
||||||
|
};
|
||||||
|
|
||||||
|
setFontSize(TextEditorSettings::instance()->fontSettings());
|
||||||
|
|
||||||
|
connect(TextEditorSettings::instance(),
|
||||||
|
&TextEditorSettings::fontSettingsChanged,
|
||||||
|
this,
|
||||||
|
setFontSize);
|
||||||
|
|
||||||
return m_resultTerminal;
|
return m_resultTerminal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -924,6 +940,14 @@ EditorFactory::EditorFactory()
|
|||||||
|
|
||||||
m_actionHandler.setUnhandledCallback(
|
m_actionHandler.setUnhandledCallback(
|
||||||
[undoStackFromEditor](Utils::Id cmdId, Core::IEditor *editor) {
|
[undoStackFromEditor](Utils::Id cmdId, Core::IEditor *editor) {
|
||||||
|
if (cmdId == TextEditor::Constants::INCREASE_FONT_SIZE) {
|
||||||
|
TextEditor::TextEditorSettings::instance()->increaseFontZoom();
|
||||||
|
return true;
|
||||||
|
} else if (cmdId == TextEditor::Constants::DECREASE_FONT_SIZE) {
|
||||||
|
TextEditor::TextEditorSettings::instance()->decreaseFontZoom();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (cmdId != Core::Constants::UNDO && cmdId != Core::Constants::REDO)
|
if (cmdId != Core::Constants::UNDO && cmdId != Core::Constants::REDO)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user