forked from qt-creator/qt-creator
QmlDesigner: Properly format edit keyframe dialog values
Change-Id: Ie84a488932e019252515947ce6bbffd424a47a20 Fixes: QDS-1882 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
committed by
Mahmoud Badri
parent
86b16b6b7d
commit
ca72140c30
@@ -26,7 +26,7 @@
|
|||||||
#include "setframevaluedialog.h"
|
#include "setframevaluedialog.h"
|
||||||
#include "ui_setframevaluedialog.h"
|
#include "ui_setframevaluedialog.h"
|
||||||
|
|
||||||
#include <QIntValidator>
|
#include <QtGui/qvalidator.h>
|
||||||
|
|
||||||
namespace QmlDesigner {
|
namespace QmlDesigner {
|
||||||
|
|
||||||
@@ -40,9 +40,13 @@ SetFrameValueDialog::SetFrameValueDialog(qreal frame, const QVariant &value,
|
|||||||
setFixedSize(size());
|
setFixedSize(size());
|
||||||
|
|
||||||
ui->lineEditFrame->setValidator(new QIntValidator(0, 99999, this));
|
ui->lineEditFrame->setValidator(new QIntValidator(0, 99999, this));
|
||||||
|
auto dv = new QDoubleValidator(this);
|
||||||
|
dv->setDecimals(2);
|
||||||
|
ui->lineEditValue->setValidator(dv);
|
||||||
|
|
||||||
ui->lineEditFrame->setText(QString::number(frame));
|
QLocale l;
|
||||||
ui->lineEditValue->setText(value.toString());
|
ui->lineEditFrame->setText(l.toString(qRound(frame)));
|
||||||
|
ui->lineEditValue->setText(l.toString(value.toDouble(), 'f', 2));
|
||||||
ui->labelValue->setText(propertyName);
|
ui->labelValue->setText(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,12 +57,14 @@ SetFrameValueDialog::~SetFrameValueDialog()
|
|||||||
|
|
||||||
qreal SetFrameValueDialog::frame() const
|
qreal SetFrameValueDialog::frame() const
|
||||||
{
|
{
|
||||||
return ui->lineEditFrame->text().toDouble();
|
QLocale l;
|
||||||
|
return l.toDouble(ui->lineEditFrame->text());
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant SetFrameValueDialog::value() const
|
QVariant SetFrameValueDialog::value() const
|
||||||
{
|
{
|
||||||
return QVariant(ui->lineEditValue->text());
|
QLocale l;
|
||||||
|
return QVariant(l.toDouble(ui->lineEditValue->text()));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace QmlDesigner
|
} // namespace QmlDesigner
|
||||||
|
Reference in New Issue
Block a user