Hide microstrip filters when Ngspice is set as default #96

This commit is contained in:
Vadim Kuznetsov 2022-08-06 16:26:45 +03:00
parent 098228edc6
commit 20d3207c8b
3 changed files with 18 additions and 0 deletions

View File

@ -48,6 +48,9 @@ bool loadSettings()
if(settings.contains("y"))QucsSettings.y=settings.value("y").toInt();
settings.endGroup();
if(settings.contains("Language"))QucsSettings.Language=settings.value("Language").toString();
if(settings.contains("DefaultSimulator"))
QucsSettings.DefaultSimulator = settings.value("DefaultSimulator").toInt();
else QucsSettings.DefaultSimulator = spicecompat::simNotSpecified;
return true;
}

View File

@ -112,6 +112,17 @@ QucsFilter::QucsFilter()
ComboRealize->addItem("Quarter wave microstrip");
ComboRealize->addItem("Equation-defined");
// microstrip filters cannot be implemented with SPICE
if (QucsSettings.DefaultSimulator != spicecompat::simQucsator) {
QStandardItemModel *model =
qobject_cast<QStandardItemModel *>(ComboRealize->model());
Q_ASSERT(model != nullptr);
for (int i = 2; i < 10; i++) {
QStandardItem *itm = model->item(i);
itm->setFlags(itm->flags() & ~Qt::ItemIsEnabled);
}
}
gbox1->addWidget(ComboRealize, 0,1);
connect(ComboRealize, SIGNAL(activated(int)), SLOT(slotRealizationChanged(int)));

View File

@ -30,12 +30,16 @@ class QLabel;
class QIntValidator;
class QDoubleValidator;
namespace spicecompat {
enum Simulator {simNgspice = 0, simXyceSer = 1, simXycePar = 2, simSpiceOpus = 3, simQucsator = 4, simNotSpecified=10};
}
struct tQucsSettings {
int x, y; // position of main window
QFont font;
QString LangDir;
QString Language;
int DefaultSimulator;
};
extern struct tQucsSettings QucsSettings;