forked from qt-creator/qt-creator
Editor: avoid accessing the widget from the FontSettingsPage
Change-Id: I51dbf4d1c7384f460b84da9602c10667addabebb Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -202,6 +202,8 @@ public:
|
||||
this, &FontSettingsPageWidget::importScheme);
|
||||
connect(exportButton, &QPushButton::clicked,
|
||||
this, &FontSettingsPageWidget::exportScheme);
|
||||
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
|
||||
this, &FontSettingsPageWidget::updateFontZoom);
|
||||
|
||||
updatePointSizes();
|
||||
refreshColorSchemeList();
|
||||
@@ -226,6 +228,7 @@ public:
|
||||
|
||||
void maybeSaveColorScheme();
|
||||
void updatePointSizes();
|
||||
void updateFontZoom(const FontSettings &fontSettings);
|
||||
QList<int> pointSizesForSelectedFont() const;
|
||||
void refreshColorSchemeList();
|
||||
|
||||
@@ -449,6 +452,11 @@ void FontSettingsPageWidget::updatePointSizes()
|
||||
m_sizeComboBox->setCurrentIndex(idx);
|
||||
}
|
||||
|
||||
void FontSettingsPageWidget::updateFontZoom(const FontSettings &fontSettings)
|
||||
{
|
||||
m_zoomSpinBox->setValue(fontSettings.fontZoom());
|
||||
}
|
||||
|
||||
QList<int> FontSettingsPageWidget::pointSizesForSelectedFont() const
|
||||
{
|
||||
QFontDatabase db;
|
||||
@@ -774,10 +782,4 @@ FontSettingsPage::FontSettingsPage(FontSettings *fontSettings, const FormatDescr
|
||||
setWidgetCreator([this, fontSettings, fd] { return new FontSettingsPageWidget(this, fd, fontSettings); });
|
||||
}
|
||||
|
||||
void FontSettingsPage::setFontZoom(int zoom)
|
||||
{
|
||||
if (m_widget)
|
||||
static_cast<FontSettingsPageWidget *>(m_widget.data())->m_zoomSpinBox->setValue(zoom);
|
||||
}
|
||||
|
||||
} // TextEditor
|
||||
|
||||
@@ -583,7 +583,6 @@ Utils::Id TextEditorSettings::languageId(const QString &mimeType)
|
||||
|
||||
static void setFontZoom(int zoom)
|
||||
{
|
||||
d->m_fontSettingsPage.setFontZoom(zoom);
|
||||
d->m_fontSettings.setFontZoom(zoom);
|
||||
d->m_fontSettings.toSettings(Core::ICore::settings());
|
||||
emit m_instance->fontSettingsChanged(d->m_fontSettings);
|
||||
|
||||
Reference in New Issue
Block a user