forked from qt-creator/qt-creator
separate font zoom from font size
Introduce "Reset Font Size" action, bound to Ctrl+0
This commit is contained in:
@@ -427,7 +427,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT);
|
||||||
|
|
||||||
a = new QAction(tr("Reset Font Size"), this);
|
a = new QAction(tr("Reset Font Size"), this);
|
||||||
cmd = am->registerAction(a, QLatin1String("Help.ResetFontSize"),
|
cmd = am->registerAction(a, TextEditor::Constants::DECREASE_FONT_SIZE,
|
||||||
modecontext);
|
modecontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||||
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
connect(a, SIGNAL(triggered()), m_centralWidget, SLOT(resetZoom()));
|
||||||
|
@@ -3411,14 +3411,8 @@ void BaseTextEditor::wheelEvent(QWheelEvent *e)
|
|||||||
|
|
||||||
void BaseTextEditor::zoomIn(int range)
|
void BaseTextEditor::zoomIn(int range)
|
||||||
{
|
{
|
||||||
d->clearVisibleCollapsedBlock();
|
d->clearVisibleCollapsedBlock();
|
||||||
QFont f = font();
|
emit requestFontZoom(range*10);
|
||||||
const int newSize = f.pointSize() + range;
|
|
||||||
if (newSize <= 0)
|
|
||||||
return;
|
|
||||||
emit requestFontSize(newSize);
|
|
||||||
// f.setPointSize(newSize);
|
|
||||||
// setFont(f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseTextEditor::zoomOut(int range)
|
void BaseTextEditor::zoomOut(int range)
|
||||||
@@ -3426,6 +3420,11 @@ void BaseTextEditor::zoomOut(int range)
|
|||||||
zoomIn(-range);
|
zoomIn(-range);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BaseTextEditor::zoomReset()
|
||||||
|
{
|
||||||
|
emit requestZoomReset();
|
||||||
|
}
|
||||||
|
|
||||||
bool BaseTextEditor::isElectricCharacter(const QChar &) const
|
bool BaseTextEditor::isElectricCharacter(const QChar &) const
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@@ -382,6 +382,7 @@ public slots:
|
|||||||
|
|
||||||
void zoomIn(int range = 1);
|
void zoomIn(int range = 1);
|
||||||
void zoomOut(int range = 1);
|
void zoomOut(int range = 1);
|
||||||
|
void zoomReset();
|
||||||
|
|
||||||
void cutLine();
|
void cutLine();
|
||||||
void deleteLine();
|
void deleteLine();
|
||||||
@@ -579,7 +580,8 @@ protected slots:
|
|||||||
virtual void slotUpdateBlockNotify(const QTextBlock &);
|
virtual void slotUpdateBlockNotify(const QTextBlock &);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestFontSize(int pointSize);
|
void requestFontZoom(int zoom);
|
||||||
|
void requestZoomReset();
|
||||||
void requestBlockUpdate(const QTextBlock &);
|
void requestBlockUpdate(const QTextBlock &);
|
||||||
void requestAutoCompletion(TextEditor::ITextEditable *editor, bool forced);
|
void requestAutoCompletion(TextEditor::ITextEditable *editor, bool forced);
|
||||||
void requestQuickFix(TextEditor::ITextEditable *editor);
|
void requestQuickFix(TextEditor::ITextEditable *editor);
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
static const char *fontFamilyKey = "FontFamily";
|
static const char *fontFamilyKey = "FontFamily";
|
||||||
static const char *fontSizeKey = "FontSize";
|
static const char *fontSizeKey = "FontSize";
|
||||||
|
static const char *fontZoomKey= "FontZoom";
|
||||||
static const char *antialiasKey = "FontAntialias";
|
static const char *antialiasKey = "FontAntialias";
|
||||||
static const char *schemeFileNameKey = "ColorScheme";
|
static const char *schemeFileNameKey = "ColorScheme";
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ namespace TextEditor {
|
|||||||
FontSettings::FontSettings() :
|
FontSettings::FontSettings() :
|
||||||
m_family(defaultFixedFontFamily()),
|
m_family(defaultFixedFontFamily()),
|
||||||
m_fontSize(DEFAULT_FONT_SIZE),
|
m_fontSize(DEFAULT_FONT_SIZE),
|
||||||
|
m_fontZoom(100),
|
||||||
m_antialias(DEFAULT_ANTIALIAS)
|
m_antialias(DEFAULT_ANTIALIAS)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -73,6 +75,7 @@ void FontSettings::clear()
|
|||||||
{
|
{
|
||||||
m_family = defaultFixedFontFamily();
|
m_family = defaultFixedFontFamily();
|
||||||
m_fontSize = DEFAULT_FONT_SIZE;
|
m_fontSize = DEFAULT_FONT_SIZE;
|
||||||
|
m_fontZoom = 100;
|
||||||
m_antialias = DEFAULT_ANTIALIAS;
|
m_antialias = DEFAULT_ANTIALIAS;
|
||||||
m_scheme.clear();
|
m_scheme.clear();
|
||||||
}
|
}
|
||||||
@@ -87,6 +90,9 @@ void FontSettings::toSettings(const QString &category,
|
|||||||
if (m_fontSize != DEFAULT_FONT_SIZE || s->contains(QLatin1String(fontSizeKey)))
|
if (m_fontSize != DEFAULT_FONT_SIZE || s->contains(QLatin1String(fontSizeKey)))
|
||||||
s->setValue(QLatin1String(fontSizeKey), m_fontSize);
|
s->setValue(QLatin1String(fontSizeKey), m_fontSize);
|
||||||
|
|
||||||
|
if (m_fontZoom!= 100 || s->contains(QLatin1String(fontZoomKey)))
|
||||||
|
s->setValue(QLatin1String(fontZoomKey), m_fontZoom);
|
||||||
|
|
||||||
if (m_antialias != DEFAULT_ANTIALIAS || s->contains(QLatin1String(antialiasKey)))
|
if (m_antialias != DEFAULT_ANTIALIAS || s->contains(QLatin1String(antialiasKey)))
|
||||||
s->setValue(QLatin1String(antialiasKey), m_antialias);
|
s->setValue(QLatin1String(antialiasKey), m_antialias);
|
||||||
|
|
||||||
@@ -110,6 +116,7 @@ bool FontSettings::fromSettings(const QString &category,
|
|||||||
|
|
||||||
m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString();
|
m_family = s->value(group + QLatin1String(fontFamilyKey), defaultFixedFontFamily()).toString();
|
||||||
m_fontSize = s->value(group + QLatin1String(fontSizeKey), m_fontSize).toInt();
|
m_fontSize = s->value(group + QLatin1String(fontSizeKey), m_fontSize).toInt();
|
||||||
|
m_fontZoom= s->value(group + QLatin1String(fontZoomKey), m_fontZoom).toInt();
|
||||||
m_antialias = s->value(group + QLatin1String(antialiasKey), DEFAULT_ANTIALIAS).toBool();
|
m_antialias = s->value(group + QLatin1String(antialiasKey), DEFAULT_ANTIALIAS).toBool();
|
||||||
|
|
||||||
if (s->contains(group + QLatin1String(schemeFileNameKey))) {
|
if (s->contains(group + QLatin1String(schemeFileNameKey))) {
|
||||||
@@ -144,6 +151,7 @@ bool FontSettings::equals(const FontSettings &f) const
|
|||||||
return m_family == f.m_family
|
return m_family == f.m_family
|
||||||
&& m_schemeFileName == f.m_schemeFileName
|
&& m_schemeFileName == f.m_schemeFileName
|
||||||
&& m_fontSize == f.m_fontSize
|
&& m_fontSize == f.m_fontSize
|
||||||
|
&& m_fontZoom == f.m_fontZoom
|
||||||
&& m_antialias == f.m_antialias
|
&& m_antialias == f.m_antialias
|
||||||
&& m_scheme == f.m_scheme;
|
&& m_scheme == f.m_scheme;
|
||||||
}
|
}
|
||||||
@@ -160,7 +168,7 @@ QTextCharFormat FontSettings::toTextCharFormat(const QString &category) const
|
|||||||
|
|
||||||
if (category == textCategory) {
|
if (category == textCategory) {
|
||||||
tf.setFontFamily(m_family);
|
tf.setFontFamily(m_family);
|
||||||
tf.setFontPointSize(m_fontSize);
|
tf.setFontPointSize(m_fontSize * m_fontZoom / 100);
|
||||||
tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias);
|
tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,6 +221,19 @@ void FontSettings::setFontSize(int size)
|
|||||||
m_fontSize = size;
|
m_fontSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the configured font zoom factor in percent.
|
||||||
|
*/
|
||||||
|
int FontSettings::fontZoom() const
|
||||||
|
{
|
||||||
|
return m_fontZoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
void FontSettings::setFontZoom(int zoom)
|
||||||
|
{
|
||||||
|
m_fontZoom = zoom;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the configured antialiasing behavior.
|
* Returns the configured antialiasing behavior.
|
||||||
*/
|
*/
|
||||||
|
@@ -78,6 +78,9 @@ public:
|
|||||||
int fontSize() const;
|
int fontSize() const;
|
||||||
void setFontSize(int size);
|
void setFontSize(int size);
|
||||||
|
|
||||||
|
int fontZoom() const;
|
||||||
|
void setFontZoom(int zoom);
|
||||||
|
|
||||||
QFont font() const
|
QFont font() const
|
||||||
{ return QFont(family(), fontSize()); }
|
{ return QFont(family(), fontSize()); }
|
||||||
|
|
||||||
@@ -105,6 +108,7 @@ private:
|
|||||||
QString m_family;
|
QString m_family;
|
||||||
QString m_schemeFileName;
|
QString m_schemeFileName;
|
||||||
int m_fontSize;
|
int m_fontSize;
|
||||||
|
int m_fontZoom;
|
||||||
bool m_antialias;
|
bool m_antialias;
|
||||||
ColorScheme m_scheme;
|
ColorScheme m_scheme;
|
||||||
};
|
};
|
||||||
|
@@ -360,6 +360,7 @@ QWidget *FontSettingsPage::createPage(QWidget *parent)
|
|||||||
d_ptr->ui.familyComboBox->setCurrentIndex(idx);
|
d_ptr->ui.familyComboBox->setCurrentIndex(idx);
|
||||||
|
|
||||||
d_ptr->ui.antialias->setChecked(d_ptr->m_value.antialias());
|
d_ptr->ui.antialias->setChecked(d_ptr->m_value.antialias());
|
||||||
|
d_ptr->ui.zoomSpinBox->setValue(d_ptr->m_value.fontZoom());
|
||||||
|
|
||||||
d_ptr->ui.schemeEdit->setFormatDescriptions(d_ptr->m_descriptions);
|
d_ptr->ui.schemeEdit->setFormatDescriptions(d_ptr->m_descriptions);
|
||||||
d_ptr->ui.schemeEdit->setBaseFont(d_ptr->m_value.font());
|
d_ptr->ui.schemeEdit->setBaseFont(d_ptr->m_value.font());
|
||||||
@@ -367,10 +368,12 @@ QWidget *FontSettingsPage::createPage(QWidget *parent)
|
|||||||
|
|
||||||
connect(d_ptr->ui.familyComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontFamilySelected(QString)));
|
connect(d_ptr->ui.familyComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontFamilySelected(QString)));
|
||||||
connect(d_ptr->ui.sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontSizeSelected(QString)));
|
connect(d_ptr->ui.sizeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(fontSizeSelected(QString)));
|
||||||
|
connect(d_ptr->ui.zoomSpinBox, SIGNAL(valueChanged(int)), this, SLOT(fontZoomChanged()));
|
||||||
connect(d_ptr->ui.schemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSchemeSelected(int)));
|
connect(d_ptr->ui.schemeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(colorSchemeSelected(int)));
|
||||||
connect(d_ptr->ui.copyButton, SIGNAL(clicked()), this, SLOT(copyColorScheme()));
|
connect(d_ptr->ui.copyButton, SIGNAL(clicked()), this, SLOT(copyColorScheme()));
|
||||||
connect(d_ptr->ui.deleteButton, SIGNAL(clicked()), this, SLOT(confirmDeleteColorScheme()));
|
connect(d_ptr->ui.deleteButton, SIGNAL(clicked()), this, SLOT(confirmDeleteColorScheme()));
|
||||||
|
|
||||||
|
|
||||||
updatePointSizes();
|
updatePointSizes();
|
||||||
refreshColorSchemeList();
|
refreshColorSchemeList();
|
||||||
d_ptr->m_lastValue = d_ptr->m_value;
|
d_ptr->m_lastValue = d_ptr->m_value;
|
||||||
@@ -421,6 +424,11 @@ void FontSettingsPage::fontSizeSelected(const QString &sizeString)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FontSettingsPage::fontZoomChanged()
|
||||||
|
{
|
||||||
|
d_ptr->m_value.setFontZoom(d_ptr->ui.zoomSpinBox->value());
|
||||||
|
}
|
||||||
|
|
||||||
void FontSettingsPage::colorSchemeSelected(int index)
|
void FontSettingsPage::colorSchemeSelected(int index)
|
||||||
{
|
{
|
||||||
bool readOnly = true;
|
bool readOnly = true;
|
||||||
|
@@ -111,6 +111,7 @@ private slots:
|
|||||||
void delayedChange();
|
void delayedChange();
|
||||||
void fontFamilySelected(const QString &family);
|
void fontFamilySelected(const QString &family);
|
||||||
void fontSizeSelected(const QString &sizeString);
|
void fontSizeSelected(const QString &sizeString);
|
||||||
|
void fontZoomChanged();
|
||||||
void colorSchemeSelected(int index);
|
void colorSchemeSelected(int index);
|
||||||
void copyColorScheme();
|
void copyColorScheme();
|
||||||
void copyColorScheme(const QString &name);
|
void copyColorScheme(const QString &name);
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>344</width>
|
<width>402</width>
|
||||||
<height>306</height>
|
<height>306</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -84,9 +84,12 @@
|
|||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Preferred</enum>
|
||||||
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>20</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@@ -99,6 +102,45 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="7">
|
||||||
|
<widget class="QSpinBox" name="zoomSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>%</string>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>300</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="8">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="6">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Zoom:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@@ -73,6 +73,7 @@ TextEditorActionHandler::TextEditorActionHandler(const QString &context,
|
|||||||
m_selectEncodingAction(0),
|
m_selectEncodingAction(0),
|
||||||
m_increaseFontSizeAction(0),
|
m_increaseFontSizeAction(0),
|
||||||
m_decreaseFontSizeAction(0),
|
m_decreaseFontSizeAction(0),
|
||||||
|
m_resetFontSizeAction(0),
|
||||||
m_gotoBlockStartAction(0),
|
m_gotoBlockStartAction(0),
|
||||||
m_gotoBlockEndAction(0),
|
m_gotoBlockEndAction(0),
|
||||||
m_gotoBlockStartWithSelectionAction(0),
|
m_gotoBlockStartWithSelectionAction(0),
|
||||||
@@ -221,6 +222,12 @@ void TextEditorActionHandler::createActions()
|
|||||||
connect(m_decreaseFontSizeAction, SIGNAL(triggered()), this, SLOT(decreaseFontSize()));
|
connect(m_decreaseFontSizeAction, SIGNAL(triggered()), this, SLOT(decreaseFontSize()));
|
||||||
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
|
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
|
||||||
|
|
||||||
|
m_resetFontSizeAction = new QAction(tr("Reset Font Size"), this);
|
||||||
|
command = am->registerAction(m_resetFontSizeAction, Constants::RESET_FONT_SIZE, m_contextId);
|
||||||
|
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+0")));
|
||||||
|
connect(m_resetFontSizeAction, SIGNAL(triggered()), this, SLOT(resetFontSize()));
|
||||||
|
advancedMenu->addAction(command, Core::Constants::G_EDIT_FONT);
|
||||||
|
|
||||||
m_gotoBlockStartAction = new QAction(tr("Goto Block Start"), this);
|
m_gotoBlockStartAction = new QAction(tr("Goto Block Start"), this);
|
||||||
command = am->registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId);
|
command = am->registerAction(m_gotoBlockStartAction, Constants::GOTO_BLOCK_START, m_contextId);
|
||||||
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+[")));
|
command->setDefaultKeySequence(QKeySequence(tr("Ctrl+[")));
|
||||||
@@ -422,6 +429,7 @@ FUNCTION(collapse)
|
|||||||
FUNCTION(expand)
|
FUNCTION(expand)
|
||||||
FUNCTION2(increaseFontSize, zoomIn)
|
FUNCTION2(increaseFontSize, zoomIn)
|
||||||
FUNCTION2(decreaseFontSize, zoomOut)
|
FUNCTION2(decreaseFontSize, zoomOut)
|
||||||
|
FUNCTION2(resetFontSize, zoomReset)
|
||||||
FUNCTION(selectEncoding)
|
FUNCTION(selectEncoding)
|
||||||
FUNCTION(gotoBlockStart)
|
FUNCTION(gotoBlockStart)
|
||||||
FUNCTION(gotoBlockEnd)
|
FUNCTION(gotoBlockEnd)
|
||||||
|
@@ -104,6 +104,7 @@ private slots:
|
|||||||
void selectEncoding();
|
void selectEncoding();
|
||||||
void increaseFontSize();
|
void increaseFontSize();
|
||||||
void decreaseFontSize();
|
void decreaseFontSize();
|
||||||
|
void resetFontSize();
|
||||||
void gotoBlockStart();
|
void gotoBlockStart();
|
||||||
void gotoBlockEnd();
|
void gotoBlockEnd();
|
||||||
void gotoBlockStartWithSelection();
|
void gotoBlockStartWithSelection();
|
||||||
@@ -139,6 +140,7 @@ private:
|
|||||||
QAction *m_selectEncodingAction;
|
QAction *m_selectEncodingAction;
|
||||||
QAction *m_increaseFontSizeAction;
|
QAction *m_increaseFontSizeAction;
|
||||||
QAction *m_decreaseFontSizeAction;
|
QAction *m_decreaseFontSizeAction;
|
||||||
|
QAction *m_resetFontSizeAction;
|
||||||
QAction *m_gotoBlockStartAction;
|
QAction *m_gotoBlockStartAction;
|
||||||
QAction *m_gotoBlockEndAction;
|
QAction *m_gotoBlockEndAction;
|
||||||
QAction *m_gotoBlockStartWithSelectionAction;
|
QAction *m_gotoBlockStartWithSelectionAction;
|
||||||
|
@@ -49,6 +49,7 @@ const char * const UN_COLLAPSE_ALL = "TextEditor.UnCollapseAll";
|
|||||||
const char * const AUTO_INDENT_SELECTION = "TextEditor.AutoIndentSelection";
|
const char * const AUTO_INDENT_SELECTION = "TextEditor.AutoIndentSelection";
|
||||||
const char * const INCREASE_FONT_SIZE = "TextEditor.IncreaseFontSize";
|
const char * const INCREASE_FONT_SIZE = "TextEditor.IncreaseFontSize";
|
||||||
const char * const DECREASE_FONT_SIZE = "TextEditor.DecreaseFontSize";
|
const char * const DECREASE_FONT_SIZE = "TextEditor.DecreaseFontSize";
|
||||||
|
const char * const RESET_FONT_SIZE = "TextEditor.ResetFontSize";
|
||||||
const char * const GOTO_BLOCK_START = "TextEditor.GotoBlockStart";
|
const char * const GOTO_BLOCK_START = "TextEditor.GotoBlockStart";
|
||||||
const char * const GOTO_BLOCK_START_WITH_SELECTION = "TextEditor.GotoBlockStartWithSelection";
|
const char * const GOTO_BLOCK_START_WITH_SELECTION = "TextEditor.GotoBlockStartWithSelection";
|
||||||
const char * const GOTO_BLOCK_END = "TextEditor.GotoBlockEnd";
|
const char * const GOTO_BLOCK_END = "TextEditor.GotoBlockEnd";
|
||||||
|
@@ -170,8 +170,10 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
|
|||||||
connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
connect(this, SIGNAL(displaySettingsChanged(TextEditor::DisplaySettings)),
|
||||||
editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
editor, SLOT(setDisplaySettings(TextEditor::DisplaySettings)));
|
||||||
|
|
||||||
connect(editor, SIGNAL(requestFontSize(int)),
|
connect(editor, SIGNAL(requestFontZoom(int)),
|
||||||
this, SLOT(fontSizeRequested(int)));
|
this, SLOT(fontZoomRequested(int)));
|
||||||
|
connect(editor, SIGNAL(requestZoomReset()),
|
||||||
|
this, SLOT(zoomResetRequested()));
|
||||||
|
|
||||||
// Apply current settings (tab settings depend on font settings)
|
// Apply current settings (tab settings depend on font settings)
|
||||||
editor->setFontSettings(fontSettings());
|
editor->setFontSettings(fontSettings());
|
||||||
@@ -181,10 +183,17 @@ void TextEditorSettings::initializeEditor(BaseTextEditor *editor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void TextEditorSettings::fontSizeRequested(int pointSize)
|
void TextEditorSettings::fontZoomRequested(int zoom)
|
||||||
{
|
{
|
||||||
FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
|
FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
|
||||||
fs.setFontSize(pointSize);
|
fs.setFontZoom(qMax(10, fs.fontZoom() + zoom));
|
||||||
|
m_fontSettingsPage->saveSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextEditorSettings::zoomResetRequested()
|
||||||
|
{
|
||||||
|
FontSettings &fs = const_cast<FontSettings&>(m_fontSettingsPage->fontSettings());
|
||||||
|
fs.setFontZoom(100);
|
||||||
m_fontSettingsPage->saveSettings();
|
m_fontSettingsPage->saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -74,7 +74,8 @@ signals:
|
|||||||
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
void displaySettingsChanged(const TextEditor::DisplaySettings &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fontSizeRequested(int pointSize);
|
void fontZoomRequested(int pointSize);
|
||||||
|
void zoomResetRequested();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FontSettingsPage *m_fontSettingsPage;
|
FontSettingsPage *m_fontSettingsPage;
|
||||||
|
Reference in New Issue
Block a user