Fix warnings in components and dialogs

This commit is contained in:
Vadim Kuznetsov 2022-02-23 21:51:56 +01:00
parent dee6204858
commit 8b1c17bddb
8 changed files with 16 additions and 13 deletions

View File

@ -42,7 +42,7 @@ RLCG::RLCG()
QFontMetrics smallmetrics(Font, 0);
int fHeight = smallmetrics.lineSpacing();
QString tmp = QObject::tr("RLCG");
int w = smallmetrics.width(tmp);
int w = smallmetrics.boundingRect(tmp).width();
Texts.append(new Text(w/-2, -fHeight, tmp));
Ports.append(new Port(-30, 0));

View File

@ -106,7 +106,7 @@ void SpiceFile::createSymbol()
if(withSim) {
i = fHeight - 2;
tmp = QObject::tr("sim");
w = smallmetrics.width(tmp);
w = smallmetrics.boundingRect(tmp).width();
Texts.append(new Text(w/-2, 0, tmp, Qt::red));
}
tmp = QObject::tr("spice");
@ -119,7 +119,7 @@ void SpiceFile::createSymbol()
Lines.append(new qucs::Line(-30, y,-HALFWIDTH, y,QPen(Qt::darkBlue,2)));
Ports.append(new Port(-30, y));
tmp = PortNames.section(',', i, i).mid(4);
w = smallmetrics.width(tmp);
w = smallmetrics.boundingRect(tmp).width();
Texts.append(new Text(-20-w, y-fHeight-2, tmp)); // text right-aligned
i++;

View File

@ -60,9 +60,9 @@ symTrafo::symTrafo()
Lines.append(new qucs::Line( -1,-57, -1, 57,QPen(Qt::darkBlue,1)));
Lines.append(new qucs::Line( 1,-57, 1, 57,QPen(Qt::darkBlue,1)));
stmp = "T1"; w = smallmetrics.width(stmp); // compute width to right-align
stmp = "T1"; w = smallmetrics.boundingRect(stmp).width(); // compute width to right-align
Texts.append(new Text(-13-w,-57,stmp));
stmp = "T2"; w = smallmetrics.width(stmp); // compute width to right-align
stmp = "T2"; w = smallmetrics.boundingRect(stmp).width(); // compute width to right-align
Texts.append(new Text(-13-w, 22,stmp));
// mark the turn direction

View File

@ -296,10 +296,12 @@ void LoadDialog::slotChangeIcon()
if (line.contains("BitmapFile")){
QString change =
QString(" \"BitmapFile\" : \"%1\",").arg(newIcon);
ba.append(change+"\n");
QString stmp = change + "\n";
ba.append(stmp.toLatin1());
}
else{
ba.append(line+"\n");
QString stmp = line + "\n";
ba.append(stmp.toLatin1());
}
}
}

View File

@ -514,7 +514,7 @@ void QucsSettingsDialog::slotApply()
// if user aborts closing, just return
if(!App->closeAllFiles()) return;
QucsSettings.QucsHomeDir = homeEdit->text();
QucsSettings.QucsHomeDir.setPath(homeEdit->text());
homeDirChanged = true;
// later below the file tree will be refreshed
}
@ -617,8 +617,8 @@ void QucsSettingsDialog::slotApply()
}
/*! Update QucsSettings, tool paths */
QucsSettings.AdmsXmlBinDir = admsXmlEdit->text();
QucsSettings.AscoBinDir = ascoEdit->text();
QucsSettings.AdmsXmlBinDir.setPath(admsXmlEdit->text());
QucsSettings.AscoBinDir.setPath(ascoEdit->text());
QucsSettings.OctaveExecutable = octaveEdit->text();
if (QucsSettings.IgnoreFutureVersion != checkLoadFromFutureVersions->isChecked())

View File

@ -50,7 +50,7 @@ class SaveDialog : public QDialog
SaveSelected
};
SaveDialog(QWidget* p = 0, const char* n = 0, bool modal = true, Qt::WindowFlags fl = 0 );
SaveDialog(QWidget* p = 0, const char* n = 0, bool modal = true, Qt::WindowFlags fl = Qt::WindowFlags() );
~SaveDialog();
void addUnsavedDoc(QucsDoc *doc);
void setApp(QucsApp *a);

View File

@ -49,7 +49,7 @@ QString mySpinBox::textFromValue(int Val) const
{
if (Values == NULL) return "";
qDebug() << "Values + Val" << *(Values+Val) << endl;
//qDebug() << "Values + Val" << *(Values+Val) << endl;
return QString::number(*(Values+Val));
}

View File

@ -17,6 +17,7 @@
#include <QString>
#include <QStringList>
#include <QFontMetrics>
#include <QtGlobal>
#include "xspicegeneric.h"
@ -112,7 +113,7 @@ void XspiceGeneric::createSymbol()
Ports.append(new Port(-40, y));
// tmp = PortNames.section(',', i, i).mid(4);
tmp = n_ports.at(i);
w = smallmetrics.width(tmp);
w = smallmetrics.boundingRect(tmp).width();
Texts.append(new Text(-40-w, y-fHeight-2, tmp)); // text right-aligned
i++;