Fixed default font in utilities

This commit is contained in:
Vadim Kuznetsov 2022-02-18 19:47:32 +01:00
parent fd54db5e16
commit c9ffce91a7
6 changed files with 11 additions and 21 deletions

View File

@ -32,14 +32,13 @@ struct tQucsSettings QucsSettings;
// Loads the settings file and stores the settings.
bool loadSettings()
{
QSettings settings("qucs","qucs");
QSettings settings("qucs","qucs_s");
settings.beginGroup("QucsActiveFilter");
if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt();
if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt();
if(settings.contains("showConsole")) QucsSettings.showConsole=settings.value("showConsole").toBool();
settings.endGroup();
if(settings.contains("font"))QucsSettings.font.fromString(settings.value("font").toString());
if(settings.contains("Language"))QucsSettings.Language=settings.value("Language").toString();
return true;
@ -50,7 +49,7 @@ bool loadSettings()
// Saves the settings in the settings file.
bool saveApplSettings(QucsActiveFilter *qucs)
{
QSettings settings ("qucs","qucs");
QSettings settings ("qucs","qucs_s");
settings.beginGroup("QucsActiveFilter");
settings.setValue("x", qucs->x());
settings.setValue("y", qucs->y());
@ -69,7 +68,6 @@ int main(int argc, char *argv[])
// apply default settings
QucsSettings.x = 200;
QucsSettings.y = 100;
QucsSettings.font = QFont("Helvetica", 12);
QucsSettings.showConsole = true;
// is application relocated?
@ -85,8 +83,6 @@ int main(int argc, char *argv[])
loadSettings();
a.setFont(QucsSettings.font);
QTranslator tor( 0 );
QString Lang = QucsSettings.Language;
if(Lang.isEmpty())

View File

@ -35,7 +35,7 @@ struct tQucsSettings QucsSettings;
// Loads the settings file and stores the settings.
bool loadSettings()
{
QSettings settings("qucs","qucs");
QSettings settings("qucs","qucs_s");
settings.beginGroup("QucsAttenuator");
if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt();
if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt();
@ -51,7 +51,7 @@ bool loadSettings()
// Saves the settings in the settings file.
bool saveApplSettings(QucsAttenuator *qucs)
{
QSettings settings ("qucs","qucs");
QSettings settings ("qucs","qucs_s");
settings.beginGroup("QucsAttenuator");
settings.setValue("x", qucs->x());
settings.setValue("y", qucs->y());
@ -69,7 +69,6 @@ int main( int argc, char ** argv )
// apply default settings
QucsSettings.x = 200;
QucsSettings.y = 100;
QucsSettings.font = QFont("Helvetica", 12);
// is application relocated?
char * var = getenv ("QUCSDIR");
@ -92,7 +91,6 @@ int main( int argc, char ** argv )
loadSettings();
a.setFont(QucsSettings.font);
QTranslator tor( 0 );
QString lang = QucsSettings.Language;
if(lang.isEmpty())

View File

@ -42,12 +42,11 @@ struct tQucsSettings QucsSettings;
// Loads the settings file and stores the settings.
bool loadSettings()
{
QSettings settings("qucs","qucs");
QSettings settings("qucs","qucs_s");
settings.beginGroup("QucsFilter");
if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt();
if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt();
settings.endGroup();
if(settings.contains("font"))QucsSettings.font.fromString(settings.value("font").toString());
if(settings.contains("Language"))QucsSettings.Language=settings.value("Language").toString();
return true;
@ -58,7 +57,7 @@ bool loadSettings()
// Saves the settings in the settings file.
bool saveApplSettings(QucsFilter *qucs)
{
QSettings settings ("qucs","qucs");
QSettings settings ("qucs","qucs_s");
settings.beginGroup("QucsFilter");
settings.setValue("x", qucs->x());
settings.setValue("y", qucs->y());
@ -82,7 +81,6 @@ int main(int argc, char *argv[])
// apply default settings
QucsSettings.x = 200;
QucsSettings.y = 100;
QucsSettings.font = QFont("Helvetica", 12);
// is application relocated?
QDir QucsDir;
@ -97,8 +95,6 @@ int main(int argc, char *argv[])
loadSettings();
a.setFont(QucsSettings.font);
QTranslator tor( 0 );
QString lang = QucsSettings.Language;
if(lang.isEmpty())

View File

@ -42,7 +42,7 @@ QDir SysLibDir;
// Loads the settings file and stores the settings.
bool loadSettings()
{
QSettings settings("qucs","qucs");
QSettings settings("qucs","qucs_s");
// Qucs Library Tool specific settings
settings.beginGroup("QucsLib");
if(settings.contains("x"))QucsSettings.x=settings.value("x").toInt();
@ -68,7 +68,7 @@ bool loadSettings()
// Saves the settings in the settings file.
bool saveApplSettings(QucsLib *qucs)
{
QSettings settings ("qucs","qucs");
QSettings settings ("qucs","qucs_s");
settings.beginGroup("QucsLib");
settings.setValue("x", qucs->x());
settings.setValue("y", qucs->y());
@ -115,8 +115,6 @@ int main(int argc, char *argv[])
SysLibDir.setPath(QucsSettings.LibDir);
UserLibDir.setPath(QucsSettings.QucsHomeDir.canonicalPath() + "/user_lib/");
a.setFont(QucsSettings.font);
QTranslator tor( 0 );
QString lang = QucsSettings.Language;
if(lang.isEmpty())

View File

@ -46,6 +46,7 @@ SymbolWidget::SymbolWidget(QWidget *parent) : QWidget(parent)
y1 = 0;
y2 = 0;
PaintText = tr("Symbol:");
setFont(QucsSettings.font);
QFontMetrics metrics(QucsSettings.font, 0); // use the the screen-compatible metric
TextWidth = metrics.width(PaintText) + 4; // get size of text

View File

@ -701,7 +701,8 @@ void QucsSettingsDialog::slotBGColorDialog()
void QucsSettingsDialog::slotDefaultValues()
{
QPalette p;
Font = QFont("Helvetica", 12);
Font = QApplication::font();
Font.setPointSize(12);
FontButton->setText(Font.toString());
LargeFontSizeEdit->setText(QString::number(16.0));