Skip to content

Commit

Permalink
D.C bias points calculation bug fix.
Browse files Browse the repository at this point in the history
D.C bias points calculation bug fix; cleanup.

Removed commented out test code.
  • Loading branch information
nvdl committed Jun 18, 2015
1 parent ced40f9 commit 51ab6de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
13 changes: 10 additions & 3 deletions qucs/qucs/dialogs/sweepdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ mySpinBox::mySpinBox(int Min, int Max, int Step, double *Val, QWidget *Parent)
using namespace std;
QString mySpinBox::textFromValue(int Val) const
{
if (Values == NULL) return "";

cout<<"Values + Val"<<*(Values+Val)<<endl;
return QString::number(*(Values+Val));
}

QValidator::State mySpinBox::validate ( QString & text, int & pos ) const
{
if (Values == NULL) return QValidator::Invalid;

if(pos>ValueSize)return QValidator::Invalid;
if(QString::number(*(Values+pos))==text)
return QValidator::Acceptable;
Expand Down Expand Up @@ -128,15 +132,18 @@ void SweepDialog::slotNewValue(int)
DataX *pD = pGraph->cPointsX.first();
int Factor = 1, Index = 0;
QList<mySpinBox *>::const_iterator it;
for(it = BoxList.constBegin(); it != BoxList.constEnd(); it++) {

for (it = BoxList.constBegin(); it != BoxList.constEnd(); it++) {
Index += (*it)->value() * Factor;
Factor *= pD->count;
}

Index *= 2; // because of complex values

QList<Node *>::iterator node_it;
QList<double *>::const_iterator value_it;
for(node_it = NodeList.begin(); node_it != NodeList.end(); node_it++) {
QList<double *>::const_iterator value_it = ValueList.begin();

for (node_it = NodeList.begin(); node_it != NodeList.end(); node_it++) {
(*node_it)->Name = misc::num2str(*((*value_it)+Index));
(*node_it)->Name += ((*node_it)->x1 & 0x10)? "A" : "V";
value_it++;
Expand Down
2 changes: 1 addition & 1 deletion qucs/qucs/dialogs/sweepdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class mySpinBox : public QSpinBox {
QValidator::State validate ( QString & text, int & pos ) const;

private:
double *Values;
double *Values = NULL;
int ValueSize;
};

Expand Down

0 comments on commit 51ab6de

Please sign in to comment.