ExportGraphToImageDialog::ExportGraphToImageDialog(QList<QByteArray> formats, Parameters params, QWidget *parent) :
QDialog(parent),
m_curKey(""),
+ m_locale(QLocale::system()),
ui(new Ui::ExportGraphToImageDialog)
{
ui->setupUi(this);
connect(ui->qle_destPath, SIGNAL(textChanged(QString)), this, SLOT(onFileNameChanged(QString)));
ui->qle_destPath->setText(m_lastUsedPath);
- ui->qle_width->setText(QString::number(params.width));
- ui->qle_height->setText(QString::number(params.height));
- ui->qle_dpi->setText(QString::number(params.dpi));
+ ui->qle_width->setText(m_locale.toString(params.width));
+ ui->qle_height->setText(m_locale.toString(params.height));
+ ui->qle_dpi->setText(m_locale.toString(params.dpi));
ui->qcbox_outputFormat->setCurrentIndex(params.formatIdx);
ui->qck_includeInteg->setChecked(params.includePeaks);
}
int ExportGraphToImageDialog::imageDpi() const
{
bool ok;
- int dpi = ui->qle_dpi->text().toInt(&ok);
+ int dpi = m_locale.toInt(ui->qle_dpi->text(), &ok);
if (!ok) return 0;
return dpi;
}
int ExportGraphToImageDialog::imageHeight() const
{
bool ok;
- double h = ui->qle_height->text().toInt(&ok);
+ double h = m_locale.toInt(ui->qle_height->text(), &ok);
if (!ok) return 0;
return h;
}
int ExportGraphToImageDialog::imageWidth() const
{
bool ok;
- double w = ui->qle_width->text().toInt(&ok);
-
+ double w = m_locale.toInt(ui->qle_width->text(), &ok);
if (!ok) return 0;
return w;
}
void ExportGraphToImageDialog::changeBounds(const QString& key)
{
- QLocale l = QLocale::system();
Bounds oldBounds, newBounds;
std::string skey = key.toStdString();
double fX, fY, tX, tY;
try {
oldBounds = m_bounds.at(m_curKey);
- fX = ui->qle_fromX->text().toDouble(&ok);
+ fX = m_locale.toDouble(ui->qle_fromX->text(), &ok);
if (ok) oldBounds.fromX = fX;
- fY = ui->qle_fromY->text().toDouble(&ok);
+ fY = m_locale.toDouble(ui->qle_fromY->text(), &ok);
if (ok) oldBounds.fromY = fY;
- tX = ui->qle_toX->text().toDouble(&ok);
+ tX = m_locale.toDouble(ui->qle_toX->text(), &ok);
if (ok) oldBounds.toX = tX;
- tY = ui->qle_toY->text().toDouble(&ok);
+ tY = m_locale.toDouble(ui->qle_toY->text(), &ok);
if (ok) oldBounds.toY = tY;
m_bounds[m_curKey] = oldBounds;
try {
newBounds = m_bounds.at(skey);
- ui->qle_fromX->setText(l.toString(newBounds.fromX));
- ui->qle_fromY->setText(l.toString(newBounds.fromY));
- ui->qle_toX->setText(l.toString(newBounds.toX));
- ui->qle_toY->setText(l.toString(newBounds.toY));
+ ui->qle_fromX->setText(m_locale.toString(newBounds.fromX));
+ ui->qle_fromY->setText(m_locale.toString(newBounds.fromY));
+ ui->qle_toX->setText(m_locale.toString(newBounds.toX));
+ ui->qle_toY->setText(m_locale.toString(newBounds.toY));
m_curKey = skey;
} catch (std::out_of_range&) {
}
try {
double fX, fY, tX, tY;
bool ok;
- QLocale l = QLocale::system();
const std::string key = ui->qcbox_signal->currentText().toStdString();
Bounds b = m_bounds.at(key);
- fX = l.toDouble(ui->qle_fromX->text(), &ok);
+ fX = m_locale.toDouble(ui->qle_fromX->text(), &ok);
if (ok) b.fromX = fX;
- fY = l.toDouble(ui->qle_fromY->text(), &ok);
+ fY = m_locale.toDouble(ui->qle_fromY->text(), &ok);
if (ok) b.fromY = fY;
- tX = l.toDouble(ui->qle_toX->text(), &ok);
+ tX = m_locale.toDouble(ui->qle_toX->text(), &ok);
if (ok) b.toX = tX;
- tY = l.toDouble(ui->qle_toY->text(), &ok);
+ tY = m_locale.toDouble(ui->qle_toY->text(), &ok);
if (ok) b.toY = tY;
m_bounds[key] = b;