Mercurial > projects > qtd
diff examples/widgets/calculator/calculator.d @ 350:31520b2c0b3c
Removed dependency on parent trait and stringof
author | Max Samukha <maxter@spambox.com> |
---|---|
date | Thu, 20 May 2010 15:49:08 +0300 |
parents | 7a3c43424dca |
children |
line wrap: on
line diff
--- a/examples/widgets/calculator/calculator.d Mon May 17 21:48:15 2010 +0300 +++ b/examples/widgets/calculator/calculator.d Thu May 20 15:49:08 2010 +0300 @@ -49,13 +49,12 @@ import std.math; import std.conv; -import std.string; +import std.string : format, indexOf; class Calculator : public QDialog { - + public: - this(QWidget parent = null) { super(parent); @@ -70,7 +69,7 @@ display.setAlignment(Qt.AlignRight); display.setMaxLength(15); - auto font = new QFont(display.font()); + auto font = new QFont(display.font()); font.setPointSize(font.pointSize() + 8); display.setFont(font); @@ -150,7 +149,8 @@ display.clear(); waitingForOperand = false; } - display.setText(display.text() ~ format("%g", digitValue)); + + display.setText(display.text() ~ format("%s", digitValue)); } void slot_unaryOperatorClicked() @@ -267,7 +267,7 @@ if (indexOf(text, '.') >= text.length) display.setText(text ~ tr(".")); - + waitingForOperand = false; }