Skip to content

Commit

Permalink
Allow a default graph line thickness to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
iwbnwif committed Nov 17, 2024
1 parent 8b21b3c commit 784c7cb
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion qucs/diagrams/diagramdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "rect3ddiagram.h"
#include "main.h"
#include "misc.h"
#include "settings.h"

#include <cmath>
#include <assert.h>
Expand Down Expand Up @@ -250,7 +251,7 @@ DiagramDialog::DiagramDialog(Diagram *d, QWidget *parent, Graph *currentGraph)
Property2->setValidator(ValInteger);
Property2->setMaximumWidth(25);
Property2->setMaxLength(2);
Property2->setText("0");
Property2->setText(_settings::Get().item<QString>("DefaultGraphLineWidth"));

if((Diag->Name=="Rect") || (Diag->Name=="PS") || (Diag->Name=="SP") || (Diag->Name=="Curve")) {
Label4 = new QLabel(tr("y-Axis:"));
Expand Down
14 changes: 13 additions & 1 deletion qucs/dialogs/qucssettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,12 @@ QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent)
checkTextAntiAliasing = new QCheckBox(appSettingsTab);
checkTextAntiAliasing->setToolTip(tr("Use anti-aliasing for text for a smoother appearance."));
appAppearanceGrid->addWidget(checkTextAntiAliasing, 7, 1);
checkTextAntiAliasing->setChecked(QucsSettings.TextAntiAliasing);
checkTextAntiAliasing->setChecked(QucsSettings.TextAntiAliasing);

appAppearanceGrid->addWidget(new QLabel(tr("Default graph line thickness:"), appSettingsTab), 8, 0);
graphLineWidthEdit = new QLineEdit(appSettingsTab);
graphLineWidthEdit->setValidator(val50);
appAppearanceGrid->addWidget(graphLineWidthEdit, 8, 1);

t->addTab(appAppearanceTab, tr("Appearance"));

Expand Down Expand Up @@ -456,6 +461,7 @@ QucsSettingsDialog::QucsSettingsDialog(QucsApp *parent)
TextFontButton->setText(TextFont.toString());
QString s = QString::number(QucsSettings.largeFontSize, 'f', 1);
LargeFontSizeEdit->setText(s);
graphLineWidthEdit->setText(_settings::Get().item<QString>("DefaultGraphLineWidth"));

p = BGColorButton->palette();
p.setColor(BGColorButton->backgroundRole(), QucsSettings.BGColor);
Expand Down Expand Up @@ -723,6 +729,12 @@ void QucsSettingsDialog::slotApply()
changed = true;
}

if (_settings::Get().item<QString>("DefaultGraphLineWidth") != graphLineWidthEdit->text())
{
_settings::Get().setItem<QString>("DefaultGraphLineWidth", graphLineWidthEdit->text());
changed = true;
}

saveApplSettings(); // also sets the small and large font

// if QucsHome is changed, refresh projects tree
Expand Down
2 changes: 1 addition & 1 deletion qucs/dialogs/qucssettingsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private slots:
QPushButton *FontButton, *AppFontButton, *TextFontButton, *BGColorButton, *GridColorButton;
QLineEdit *LargeFontSizeEdit, *undoNumEdit, *editorEdit, *Input_Suffix,
*Input_Program, *homeEdit, *admsXmlEdit, *ascoEdit, *octaveEdit,
*OpenVAFEdit, *RFLayoutEdit;
*OpenVAFEdit, *RFLayoutEdit, *graphLineWidthEdit;
QTableWidget *fileTypesTableWidget, *pathsTableWidget;
QStandardItemModel *model;
QPushButton *ColorComment, *ColorString, *ColorInteger,
Expand Down
1 change: 1 addition & 0 deletions qucs/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ void settingsManager::initDefaults()
m_Defaults["appFont"] = QApplication::font();
m_Defaults["LargeFontSize"] = static_cast<double>(16.0);
m_Defaults["GridColor"] = QColor(qRgb(25, 25, 25));
m_Defaults["DefaultGraphLineWidth"] = "1";
m_Defaults["maxUndo"] = 20;
m_Defaults["QucsHomeDir"] = QDir::homePath() + QDir::toNativeSeparators("/QucsWorkspace");

Expand Down

0 comments on commit 784c7cb

Please sign in to comment.