changeset 216:06e7d3219464

ups....
author SokoL_SD
date Tue, 14 Jul 2009 15:28:22 +0000
parents 8aaa84d48451
children 3855c7a9a5a2
files examples/dialogs/classwizard/classwizard_d1.d examples/dialogs/standarddialogs/dialog_d1.d examples/draganddrop/dropsite/dropsitewindow_d1.d examples/draganddrop/dropsite/helloworld.ui examples/itemviews/customsortfiltermodel/mysortfilterproxymodel_d1.d examples/opengl/hellogl/glwidget_d1.d examples/widgets/calculator/calculator_d1.d
diffstat 7 files changed, 1867 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/classwizard/classwizard_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module classwizard_d1;
+
+import qt.gui.QWizardPage;
+import qt.gui.QCheckBox;
+import qt.gui.QGroupBox;
+import qt.gui.QLabel;
+import qt.gui.QLineEdit;
+import qt.gui.QRadioButton;
+import qt.gui.QMessageBox;
+import qt.gui.QVBoxLayout;
+import qt.gui.QGridLayout;
+import qt.core.QFile;
+import qt.core.QDir;
+import qt.core.QRegExp;
+
+import tango.text.convert.Format;
+import tango.core.Array;
+import tango.text.Ascii;
+
+
+class ClassWizard : public QWizard
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		addPage(new IntroPage);
+		addPage(new ClassInfoPage);
+		addPage(new CodeStylePage);
+		addPage(new OutputFilesPage);
+		addPage(new ConclusionPage);
+
+		setPixmap(QWizard.BannerPixmap, new QPixmap(":/images/banner.png"));
+		setPixmap(QWizard.BackgroundPixmap, new QPixmap(":/images/background.png"));
+
+		setWindowTitle(tr("Class Wizard"));
+	}
+
+	void accept()
+	{
+		string className = field("className").toString();
+		string baseClass = field("baseClass").toString();
+		string macroName = field("macroName").toString();
+		string baseInclude = field("baseInclude").toString();
+
+		string outputDir = field("outputDir").toString();
+		string header = field("header").toString();
+		string implementation = field("implementation").toString();
+
+		string block;
+
+		if (field("comment").toBool()) {
+			block ~= "/*\n";
+			block ~= "    " ~ header ~ "\n";
+			block ~= "*/\n";
+			block ~= "\n";
+		}
+		if (field("protect").toBool()) {
+			block ~= "#ifndef " ~ macroName ~ "\n";
+			block ~= "#define " ~ macroName ~ "\n";
+			block ~= "\n";
+		}
+		if (field("includeBase").toBool()) {
+			block ~= "#include " ~ baseInclude ~ "\n";
+			block ~= "\n";
+		}
+
+		block ~= "class " ~ className;
+		if (baseClass.length)
+			block ~= " : public " ~ baseClass;
+		block ~= "\n";
+		block ~= "{\n";
+
+		/* qmake ignore  */
+
+		if (field("qobjectMacro").toBool()) {
+			block ~= "    \n";
+			block ~= "\n";
+		}
+		block ~= "public:\n";
+
+		if (field("qobjectCtor").toBool()) {
+			block ~= "    " ~ className ~ "(QObject *parent = 0);\n";
+		} else if (field("qwidgetCtor").toBool()) {
+			block ~= "    " ~ className ~ "(QWidget *parent = 0);\n";
+		} else if (field("defaultCtor").toBool()) {
+			block ~= "    " ~ className ~ "();\n";
+			if (field("copyCtor").toBool()) {
+				block ~= "    " ~ className ~ "(const " ~ className ~ " &other);\n";
+				block ~= "\n";
+				block ~= "    " ~ className ~ " &operator=" ~ "(const " ~ className ~ " &other);\n";
+			}
+		}
+		block ~= "};\n";
+
+		if (field("protect").toBool()) {
+			block ~= "\n";
+			block ~= "#endif\n";
+		}
+
+		auto headerFile = new QFile(outputDir ~ "/" ~ header);
+		if (!headerFile.open(QFile.WriteOnly | QFile.Text)) {
+			QMessageBox.warning(null, tr("Simple Wizard"),
+					Format(tr("Cannot write file {}:\n{}"),
+					headerFile.fileName(),
+					headerFile.errorString()));
+			return;
+		}
+		headerFile.write(block);
+
+		block.length = 0;
+
+		if (field("comment").toBool()) {
+			block ~= "/*\n";
+			block ~= "    " ~ implementation ~ "\n";
+			block ~= "*/\n";
+			block ~= "\n";
+		}
+		block ~= "#include \"" ~ header ~ "\"\n";
+		block ~= "\n";
+
+		if (field("qobjectCtor").toBool()) {
+			block ~= className ~ "." ~ className ~ "(QObject *parent)\n";
+			block ~= "    : " ~ baseClass ~ "(parent)\n";
+			block ~= "{\n";
+			block ~= "}\n";
+		} else if (field("qwidgetCtor").toBool()) {
+			block ~= className ~ "." ~ className ~ "(QWidget *parent)\n";
+			block ~= "    : " ~ baseClass ~ "(parent)\n";
+			block ~= "{\n";
+			block ~= "}\n";
+		} else if (field("defaultCtor").toBool()) {
+			block ~= className ~ "." ~ className ~ "()\n";
+			block ~= "{\n";
+			block ~= "    // missing code\n";
+			block ~= "}\n";
+
+			if (field("copyCtor").toBool()) {
+				block ~= "\n";
+				block ~= className ~ "." ~ className ~ "(const " ~ className ~ " &other)\n";
+				block ~= "{\n";
+				block ~= "    *this = other;\n";
+				block ~= "}\n";
+				block ~= "\n";
+				block ~= className ~ " &" ~ className ~ ".operator=(const " ~ className ~ " &other)\n";
+				block ~= "{\n";
+				if (baseClass.length)
+					block ~= "    " ~ baseClass ~ ".operator=(other);\n";
+				block ~= "    // missing code\n";
+				block ~= "    return *this;\n";
+				block ~= "}\n";
+			}
+		}
+
+		auto implementationFile = new QFile(outputDir ~ "/" ~ implementation);
+		if (!implementationFile.open(QFile.WriteOnly | QFile.Text)) {
+			QMessageBox.warning(null, tr("Simple Wizard"),
+					Format(tr("Cannot write file {}:\n{}"),
+					implementationFile.fileName(),
+					implementationFile.errorString()));
+			return;
+		}
+		implementationFile.write(block);
+
+		QDialog.accept();
+	}
+}
+
+
+class IntroPage : public QWizardPage
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		setTitle(tr("Introduction"));
+		setPixmap(QWizard.WatermarkPixmap, new QPixmap(":/images/watermark1.png"));
+
+		label = new QLabel(tr("This wizard will generate a skeleton C++ class "
+				"definition, including a few functions. You simply "
+				"need to specify the class name and set a few "
+				"options to produce a header file and an "
+				"implementation file for your new C++ class."));
+		label.setWordWrap(true);
+
+		QVBoxLayout layout = new QVBoxLayout;
+		layout.addWidget(label);
+		setLayout(layout);
+	}
+
+private:
+
+	QLabel label;
+}
+	
+class ClassInfoPage : public QWizardPage
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		setTitle(tr("Class Information"));
+		setSubTitle(tr("Specify basic information about the class for which you want to generate skeleton source code files."));
+		setPixmap(QWizard.LogoPixmap, new QPixmap(":/images/logo1.png"));
+
+		classNameLabel = new QLabel(tr("&Class name:"));
+		classNameLineEdit = new QLineEdit;
+		classNameLabel.setBuddy(classNameLineEdit);
+
+		baseClassLabel = new QLabel(tr("B&ase class:"));
+		baseClassLineEdit = new QLineEdit;
+		baseClassLabel.setBuddy(baseClassLineEdit);
+
+		qobjectMacroCheckBox = new QCheckBox(tr("Generate  &macro"));
+
+		groupBox = new QGroupBox(tr("C&onstructor"));
+
+		qobjectCtorRadioButton = new QRadioButton(tr("&QObject-style constructor"));
+		qwidgetCtorRadioButton = new QRadioButton(tr("Q&Widget-style constructor"));
+		defaultCtorRadioButton = new QRadioButton(tr("&Default constructor"));
+		copyCtorCheckBox = new QCheckBox(tr("&Generate copy constructor and operator="));
+
+		defaultCtorRadioButton.setChecked(true);
+		defaultCtorRadioButton.toggled.connect(&copyCtorCheckBox.setEnabled);
+
+		registerField("className*", classNameLineEdit);
+		registerField("baseClass", baseClassLineEdit);
+		registerField("qobjectMacro", qobjectMacroCheckBox);
+		registerField("qobjectCtor", qobjectCtorRadioButton);
+		registerField("qwidgetCtor", qwidgetCtorRadioButton);
+		registerField("defaultCtor", defaultCtorRadioButton);
+		registerField("copyCtor", copyCtorCheckBox);
+
+		QVBoxLayout groupBoxLayout = new QVBoxLayout;
+
+		groupBoxLayout.addWidget(qobjectCtorRadioButton);
+		groupBoxLayout.addWidget(qwidgetCtorRadioButton);
+		groupBoxLayout.addWidget(defaultCtorRadioButton);
+		groupBoxLayout.addWidget(copyCtorCheckBox);
+		groupBox.setLayout(groupBoxLayout);
+
+		QGridLayout layout = new QGridLayout;
+		layout.addWidget(classNameLabel, 0, 0);
+		layout.addWidget(classNameLineEdit, 0, 1);
+		layout.addWidget(baseClassLabel, 1, 0);
+		layout.addWidget(baseClassLineEdit, 1, 1);
+		layout.addWidget(qobjectMacroCheckBox, 2, 0, 1, 2);
+		layout.addWidget(groupBox, 3, 0, 1, 2);
+		setLayout(layout);
+	}
+
+private:
+
+	QLabel classNameLabel;
+	QLabel baseClassLabel;
+	QLineEdit classNameLineEdit;
+	QLineEdit baseClassLineEdit;
+	QCheckBox qobjectMacroCheckBox;
+	QGroupBox groupBox;
+	QRadioButton qobjectCtorRadioButton;
+	QRadioButton qwidgetCtorRadioButton;
+	QRadioButton defaultCtorRadioButton;
+	QCheckBox copyCtorCheckBox;
+}
+
+class CodeStylePage : public QWizardPage
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		setTitle(tr("Code Style Options"));
+		setSubTitle(tr("Choose the formatting of the generated code."));
+		setPixmap(QWizard.LogoPixmap, new QPixmap(":/images/logo2.png"));
+
+		commentCheckBox = new QCheckBox(tr("&Start generated files with a comment"));
+		commentCheckBox.setChecked(true);
+
+		protectCheckBox = new QCheckBox(tr("&Protect header file against multiple inclusions"));
+		protectCheckBox.setChecked(true);
+
+		macroNameLabel = new QLabel(tr("&Macro name:"));
+		macroNameLineEdit = new QLineEdit;
+		macroNameLabel.setBuddy(macroNameLineEdit);
+
+		includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));
+		baseIncludeLabel = new QLabel(tr("Base class include:"));
+		baseIncludeLineEdit = new QLineEdit;
+		baseIncludeLabel.setBuddy(baseIncludeLineEdit);
+
+		protectCheckBox.toggled.connect(&macroNameLabel.setEnabled);
+		protectCheckBox.toggled.connect(&macroNameLabel.setEnabled);
+		includeBaseCheckBox.toggled.connect(&macroNameLabel.setEnabled);
+		includeBaseCheckBox.toggled.connect(&macroNameLabel.setEnabled);
+
+		registerField("comment", commentCheckBox);
+		registerField("protect", protectCheckBox);
+		registerField("macroName", macroNameLineEdit);
+		registerField("includeBase", includeBaseCheckBox);
+		registerField("baseInclude", baseIncludeLineEdit);
+
+		QGridLayout layout = new QGridLayout;
+		layout.setColumnMinimumWidth(0, 20);
+		layout.addWidget(commentCheckBox, 0, 0, 1, 3);
+		layout.addWidget(protectCheckBox, 1, 0, 1, 3);
+		layout.addWidget(macroNameLabel, 2, 1);
+		layout.addWidget(macroNameLineEdit, 2, 2);
+		layout.addWidget(includeBaseCheckBox, 3, 0, 1, 3);
+		layout.addWidget(baseIncludeLabel, 4, 1);
+		layout.addWidget(baseIncludeLineEdit, 4, 2);
+
+		setLayout(layout);
+	}
+
+protected:
+
+	void initializePage()
+	{
+		string className = field("className").toString();
+		macroNameLineEdit.setText(toUpper(className) ~ "_H");
+
+		string baseClass = field("baseClass").toString();
+
+		includeBaseCheckBox.setChecked(baseClass.length != 0);
+		includeBaseCheckBox.setEnabled(baseClass.length != 0);
+		baseIncludeLabel.setEnabled(baseClass.length != 0);
+		baseIncludeLineEdit.setEnabled(baseClass.length != 0);
+
+		if (baseClass.length == 0) {
+			baseIncludeLineEdit.clear();
+		} else if ((new QRegExp("Q[A-Z].*")).exactMatch(baseClass)) {
+			baseIncludeLineEdit.setText("<" ~ baseClass ~ ">");
+		} else {
+			baseIncludeLineEdit.setText("\"" ~ toLower(baseClass) ~ ".h\"");
+		}
+	}
+
+private:
+
+	QCheckBox commentCheckBox;
+	QCheckBox protectCheckBox;
+	QCheckBox includeBaseCheckBox;
+	QLabel macroNameLabel;
+	QLabel baseIncludeLabel;
+	QLineEdit macroNameLineEdit;
+	QLineEdit baseIncludeLineEdit;
+}
+
+class OutputFilesPage : public QWizardPage
+{
+public:    
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		setTitle(tr("Output Files"));
+		setSubTitle(tr("Specify where you want the wizard to put the generated skeleton code."));
+		setPixmap(QWizard.LogoPixmap, new QPixmap(":/images/logo3.png"));
+
+		outputDirLabel = new QLabel(tr("&Output directory:"));
+		outputDirLineEdit = new QLineEdit;
+		outputDirLabel.setBuddy(outputDirLineEdit);
+
+		headerLabel = new QLabel(tr("&Header file name:"));
+		headerLineEdit = new QLineEdit;
+		headerLabel.setBuddy(headerLineEdit);
+
+		implementationLabel = new QLabel(tr("&Implementation file name:"));
+		implementationLineEdit = new QLineEdit;
+		implementationLabel.setBuddy(implementationLineEdit);
+
+		registerField("outputDir*", outputDirLineEdit);
+		registerField("header*", headerLineEdit);
+		registerField("implementation*", implementationLineEdit);
+
+		QGridLayout layout = new QGridLayout;
+		layout.addWidget(outputDirLabel, 0, 0);
+		layout.addWidget(outputDirLineEdit, 0, 1);
+		layout.addWidget(headerLabel, 1, 0);
+		layout.addWidget(headerLineEdit, 1, 1);
+		layout.addWidget(implementationLabel, 2, 0);
+		layout.addWidget(implementationLineEdit, 2, 1);
+		setLayout(layout);
+	}
+
+protected:
+
+	void initializePage()
+	{
+		string className = field("className").toString();
+		headerLineEdit.setText(toLower(className) ~ ".h");
+		implementationLineEdit.setText(toLower(className) ~ ".cpp");
+		outputDirLineEdit.setText(QDir.convertSeparators(QDir.tempPath()));
+	}
+
+private:
+
+	QLabel outputDirLabel;
+	QLabel headerLabel;
+	QLabel implementationLabel;
+	QLineEdit outputDirLineEdit;
+	QLineEdit headerLineEdit;
+	QLineEdit implementationLineEdit;
+}
+
+class ConclusionPage : public QWizardPage
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		setTitle(tr("Conclusion"));
+		setPixmap(QWizard.WatermarkPixmap, new QPixmap(":/images/watermark2.png"));
+
+		label = new QLabel;
+		label.setWordWrap(true);
+
+		QVBoxLayout layout = new QVBoxLayout;
+		layout.addWidget(label);
+		setLayout(layout);
+	}
+
+protected:
+
+	void initializePage()
+	{
+		string finishText = wizard().buttonText(QWizard.FinishButton).dup;	
+		label.setText(Format(tr("Click {} to generate the class skeleton."), finishText));
+	}
+
+private:
+
+	QLabel label;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/dialogs/standarddialogs/dialog_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,421 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module dialog_d1;
+
+
+import qt.gui.QDialog;
+import qt.gui.QCheckBox;
+import qt.gui.QLabel;
+import qt.gui.QMessageBox;
+import qt.gui.QGridLayout;
+import qt.gui.QErrorMessage;
+import qt.gui.QFileDialog;
+import qt.gui.QLineEdit;
+import qt.gui.QInputDialog;
+import qt.gui.QColorDialog;
+import qt.gui.QFontDialog;
+import qt.gui.QFileDialog;
+import qt.core.QFile;
+
+import tango.text.convert.Format;
+
+
+string MESSAGE = tr("<p>Message boxes have a caption, a text, "
+               "and any number of buttons, each with standard or custom texts."
+               "<p>Click a button to close the message box. Pressing the Esc button "
+               "will activate the detected escape button (if any).");
+
+
+class Dialog : public QDialog
+{
+public:
+
+	this(QWidget parent = null)
+	{
+		super(parent);
+		errorMessageDialog = new QErrorMessage(this);
+
+		int frameStyle = QFrame.Sunken | QFrame.Panel;
+
+		integerLabel = new QLabel;
+		integerLabel.setFrameStyle(frameStyle);
+		QPushButton integerButton = new QPushButton(tr("QInputget&Int()"));
+
+		doubleLabel = new QLabel;
+		doubleLabel.setFrameStyle(frameStyle);
+		QPushButton doubleButton = new QPushButton(tr("QInputget&Double()"));
+
+		itemLabel = new QLabel;
+		itemLabel.setFrameStyle(frameStyle);
+		QPushButton itemButton = new QPushButton(tr("QInputgetIte&m()"));
+
+		textLabel = new QLabel;
+		textLabel.setFrameStyle(frameStyle);
+		QPushButton textButton = new QPushButton(tr("QInputget&Text()"));
+
+		colorLabel = new QLabel;
+		colorLabel.setFrameStyle(frameStyle);
+		QPushButton colorButton = new QPushButton(tr("QColorget&Color()"));
+
+		fontLabel = new QLabel;
+		fontLabel.setFrameStyle(frameStyle);
+		QPushButton fontButton = new QPushButton(tr("QFontget&Font()"));
+
+		directoryLabel = new QLabel;
+		directoryLabel.setFrameStyle(frameStyle);
+		QPushButton directoryButton = new QPushButton(tr("QFilegetE&xistingDirectory()"));
+
+		openFileNameLabel = new QLabel;
+		openFileNameLabel.setFrameStyle(frameStyle);
+		QPushButton openFileNameButton = new QPushButton(tr("QFileget&OpenFileName()"));
+
+		openFileNamesLabel = new QLabel;
+		openFileNamesLabel.setFrameStyle(frameStyle);
+		QPushButton openFileNamesButton = new QPushButton(tr("QFile&getOpenFileNames()"));
+
+		saveFileNameLabel = new QLabel;
+		saveFileNameLabel.setFrameStyle(frameStyle);
+		QPushButton saveFileNameButton = new QPushButton(tr("QFileget&SaveFileName()"));
+
+		criticalLabel = new QLabel;
+		criticalLabel.setFrameStyle(frameStyle);
+		QPushButton criticalButton = new QPushButton(tr("QMessageBox.critica&l()"));
+
+		informationLabel = new QLabel;
+		informationLabel.setFrameStyle(frameStyle);
+		QPushButton informationButton = new QPushButton(tr("QMessageBox.i&nformation()"));
+
+		questionLabel = new QLabel;
+		questionLabel.setFrameStyle(frameStyle);
+		QPushButton questionButton = new QPushButton(tr("QMessageBox.&question()"));
+
+		warningLabel = new QLabel;
+		warningLabel.setFrameStyle(frameStyle);
+		QPushButton warningButton = new QPushButton(tr("QMessageBox.&warning()"));
+
+		errorLabel = new QLabel;
+		errorLabel.setFrameStyle(frameStyle);
+		QPushButton errorButton = new QPushButton(tr("QErrorMessage.show&M&essage()"));
+
+		integerButton.clicked.connect(&this.setInteger);
+		doubleButton.clicked.connect(&this.setDouble);
+		itemButton.clicked.connect(&this.setItem);
+		textButton.clicked.connect(&this.setText);
+		colorButton.clicked.connect(&this.setColor);
+		fontButton.clicked.connect(&this.setFont);
+		directoryButton.clicked.connect(&this.setExistingDirectory);
+		openFileNameButton.clicked.connect(&this.setOpenFileName);
+		openFileNamesButton.clicked.connect(&this.setOpenFileNames);
+		saveFileNameButton.clicked.connect(&this.setSaveFileName);
+		criticalButton.clicked.connect(&this.criticalMessage);
+		informationButton.clicked.connect(&this.informationMessage);
+		questionButton.clicked.connect(&this.questionMessage);
+		warningButton.clicked.connect(&this.warningMessage);
+		errorButton.clicked.connect(&this.errorMessage);
+
+		native = new QCheckBox(this);
+		native.setText("Use native file dialog.");
+		native.setChecked(true);
+		
+		version(windows) {} else
+		{
+			version(mac) {} else
+			{
+				native.hide();
+			}
+		}
+
+		QGridLayout layout = new QGridLayout;
+		layout.setColumnStretch(1, 1);
+		layout.setColumnMinimumWidth(1, 250);
+		layout.addWidget(integerButton, 0, 0);
+		layout.addWidget(integerLabel, 0, 1);
+		layout.addWidget(doubleButton, 1, 0);
+		layout.addWidget(doubleLabel, 1, 1);
+		layout.addWidget(itemButton, 2, 0);
+		layout.addWidget(itemLabel, 2, 1);
+		layout.addWidget(textButton, 3, 0);
+		layout.addWidget(textLabel, 3, 1);
+		layout.addWidget(colorButton, 4, 0);
+		layout.addWidget(colorLabel, 4, 1);
+		layout.addWidget(fontButton, 5, 0);
+		layout.addWidget(fontLabel, 5, 1);
+		layout.addWidget(directoryButton, 6, 0);
+		layout.addWidget(directoryLabel, 6, 1);
+		layout.addWidget(openFileNameButton, 7, 0);
+		layout.addWidget(openFileNameLabel, 7, 1);
+		layout.addWidget(openFileNamesButton, 8, 0);
+		layout.addWidget(openFileNamesLabel, 8, 1);
+		layout.addWidget(saveFileNameButton, 9, 0);
+		layout.addWidget(saveFileNameLabel, 9, 1);
+		layout.addWidget(criticalButton, 10, 0);
+		layout.addWidget(criticalLabel, 10, 1);
+		layout.addWidget(informationButton, 11, 0);
+		layout.addWidget(informationLabel, 11, 1);
+		layout.addWidget(questionButton, 12, 0);
+		layout.addWidget(questionLabel, 12, 1);
+		layout.addWidget(warningButton, 13, 0);
+		layout.addWidget(warningLabel, 13, 1);
+		layout.addWidget(errorButton, 14, 0);
+		layout.addWidget(errorLabel, 14, 1);
+		layout.addWidget(native, 15, 0);
+		setLayout(layout);
+
+		setWindowTitle(tr("Standard Dialogs"));
+	}
+
+private:
+
+	void setInteger()
+	{
+		bool ok;
+		int i = QInputDialog.getInt(this, tr("QInputgetInteger()"), tr("Percentage:"), 25, 0, 100, 1, ok);
+		if (ok)
+			version(Tango) 
+				integerLabel.setText(Format("{}", i)); 
+			else
+				integerLabel.setText(format("%d", i)); 
+	}
+
+	void setDouble()
+	{
+		bool ok;
+		double d = QInputDialog.getDouble(this, tr("QInputgetDouble()"),
+						tr("Amount:"), 37.56, -10000, 10000, 2, ok);
+		if (ok)
+			version(Tango) 
+				doubleLabel.setText(Format("${}", d));
+			else
+				integerLabel.setText(format("%g", d)); 	
+	}
+
+	void setItem()
+	{
+		string[] items =  [tr("Spring"), tr("Summer"), tr("Fall"), tr("Winter")];
+
+		bool ok;
+		string item = QInputDialog.getItem(this, tr("QInputgetItem()"),
+						tr("Season:"), items, 0, false, ok);
+		if (ok && item.length)
+			itemLabel.setText(item);
+	}
+
+	void setText()
+	{
+		bool ok;
+		string text = QInputDialog.getText(this, tr("QInputgetText()"),
+						tr("User name:"), QLineEdit_EchoMode.Normal,
+		QDir.home().dirName(), ok);
+		if (ok && text.length)
+			textLabel.setText(text);
+	}
+
+	void setColor()
+	{
+		QColor color = QColorDialog.getColor(QColor.Green, this);
+		if (color.isValid()) {
+			colorLabel.setText(color.name());
+			colorLabel.setPalette(new QPalette(color));
+			colorLabel.setAutoFillBackground(true);
+		}
+	}
+
+	void setFont()
+	{
+		bool ok;
+		QFont font = QFontDialog.getFont(&ok, new QFont(fontLabel.text()), this);
+		if (ok) {
+			fontLabel.setText(font.key());
+			fontLabel.setFont(font);
+		}
+	}
+
+	void setExistingDirectory()
+	{
+		int options = QFileDialog_Option.DontResolveSymlinks | QFileDialog_Option.ShowDirsOnly;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string directory = QFileDialog.getExistingDirectory(this,
+						tr("QFilegetExistingDirectory()"),
+						directoryLabel.text(),
+						options);
+		if (directory.length)
+			directoryLabel.setText(directory);
+	}
+
+	void setOpenFileName()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string fileName = QFileDialog.getOpenFileName(this,
+						tr("QFilegetOpenFileName()"),
+						openFileNameLabel.text(),
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (fileName.length)
+			openFileNameLabel.setText(fileName);
+	}
+
+	void setOpenFileNames()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string[] files = QFileDialog.getOpenFileNames(
+						this, tr("QFilegetOpenFileNames()"),
+						openFilesPath,
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (files.length) {
+			openFilesPath = files[0];
+			version(Tango) 
+				openFileNamesLabel.setText(Format("{}", files));
+			else
+			{
+				openFileNamesLabel.setText(join(files, "; "));
+			}
+		}
+	}
+
+	void setSaveFileName()
+	{
+		int options;
+		if (!native.isChecked())
+			options |= QFileDialog_Option.DontUseNativeDialog;
+		string selectedFilter;
+		string fileName = QFileDialog.getSaveFileName(this,
+						tr("QFilegetSaveFileName()"),
+						saveFileNameLabel.text(),
+						tr("All Files (*);;Text Files (*.txt)"),
+						selectedFilter,
+						options);
+		if (fileName.length)
+			saveFileNameLabel.setText(fileName);
+	}
+
+	void criticalMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.critical(this, tr("QMessageBox.critical()"),
+						MESSAGE,
+						QMessageBox.Abort | QMessageBox.Retry | QMessageBox.Ignore);
+		if (reply == QMessageBox.Abort)
+			criticalLabel.setText(tr("Abort"));
+		else if (reply == QMessageBox.Retry)
+			criticalLabel.setText(tr("Retry"));
+		else
+			criticalLabel.setText(tr("Ignore"));
+	}
+
+	void informationMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.information(this, tr("QMessageBox.information()"), MESSAGE);
+		if (reply == QMessageBox.Ok)
+			informationLabel.setText(tr("OK"));
+		else
+			informationLabel.setText(tr("Escape"));
+	}
+
+	void questionMessage()
+	{
+		QMessageBox.StandardButton reply;
+		reply = QMessageBox.question(this, tr("QMessageBox.question()"),
+						MESSAGE,
+						QMessageBox.Yes | QMessageBox.No | QMessageBox.Cancel);
+		if (reply == QMessageBox.Yes)
+			questionLabel.setText(tr("Yes"));
+		else if (reply == QMessageBox.No)
+			questionLabel.setText(tr("No"));
+		else
+			questionLabel.setText(tr("Cancel"));
+	}
+
+	void warningMessage()
+	{
+		auto msgBox = new QMessageBox(QMessageBox.Warning, tr("QMessageBox.warning()"), MESSAGE, 0, this);
+		msgBox.addButton(tr("Save &Again"), QMessageBox.AcceptRole);
+		msgBox.addButton(tr("&Continue"), QMessageBox.RejectRole);
+		if (msgBox.exec() == QMessageBox.AcceptRole)
+			warningLabel.setText(tr("Save Again"));
+		else
+			warningLabel.setText(tr("Continue"));
+	}
+
+	void errorMessage()
+	{
+		errorMessageDialog.showMessage(
+				tr("This dialog shows and remembers error messages. "
+				"If the checkbox is checked (as it is by default), "
+				"the shown message will be shown again, "
+				"but if the user unchecks the box the message "
+				"will not appear again if QErrorMessage.showMessage() "
+				"is called with the same message."));
+		errorLabel.setText(tr("If the box is unchecked, the message won't appear again."));
+	}
+
+private:
+
+	QCheckBox native;
+	QLabel integerLabel;
+	QLabel doubleLabel;
+	QLabel itemLabel;
+	QLabel textLabel;
+	QLabel colorLabel;
+	QLabel fontLabel;
+	QLabel directoryLabel;
+	QLabel openFileNameLabel;
+	QLabel openFileNamesLabel;
+	QLabel saveFileNameLabel;
+	QLabel criticalLabel;
+	QLabel informationLabel;
+	QLabel questionLabel;
+	QLabel warningLabel;
+	QLabel errorLabel;
+	QErrorMessage errorMessageDialog;
+
+	string openFilesPath;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/draganddrop/dropsite/dropsitewindow_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+module dropsitewindow_d1;
+
+import tango.text.Util;
+import tango.text.Ascii;
+import tango.text.convert.Format;
+
+import qt.gui.QWidget;
+import qt.gui.QLabel;
+import qt.gui.QTableWidget;
+import qt.gui.QPushButton;
+import qt.gui.QVBoxLayout;
+import qt.gui.QDialogButtonBox;
+
+import droparea;
+
+
+class DropSiteWindow : public QWidget
+{
+public:
+	
+	this()
+	{
+		abstractLabel = new QLabel(tr("This example accepts drags from other "
+			"applications and displays the MIME types "
+			"provided by the drag object."));
+		
+		abstractLabel.setWordWrap(true);
+		abstractLabel.adjustSize();
+
+		dropArea = new DropArea;
+		dropArea.changed.connect(&updateFormatsTable);
+
+		string[] labels;
+		labels ~= tr("Format");
+		labels ~= tr("Content");
+
+		formatsTable = new QTableWidget;
+		formatsTable.setColumnCount(2);
+		formatsTable.setEditTriggers(QAbstractItemView.NoEditTriggers);
+		formatsTable.setHorizontalHeaderLabels(labels);
+		formatsTable.horizontalHeader().setStretchLastSection(true);
+
+		clearButton = new QPushButton(tr("Clear"));
+		quitButton = new QPushButton(tr("Quit"));
+
+		buttonBox = new QDialogButtonBox;
+		buttonBox.addButton(clearButton, QDialogButtonBox.ActionRole);
+		buttonBox.addButton(quitButton, QDialogButtonBox.RejectRole);
+
+		quitButton.pressed.connect(&close);
+		clearButton.pressed.connect(&dropArea.clearArea);
+
+		QVBoxLayout mainLayout = new QVBoxLayout;
+		mainLayout.addWidget(abstractLabel);
+		mainLayout.addWidget(dropArea);
+		mainLayout.addWidget(formatsTable);
+		mainLayout.addWidget(buttonBox);
+		setLayout(mainLayout);
+
+		setWindowTitle(tr("Drop Site"));
+		setMinimumSize(350, 500);
+	}
+
+	void updateFormatsTable(QMimeData mimeData)
+	{
+		formatsTable.setRowCount(0);
+		if (!mimeData)
+			return;
+
+		foreach (string format; mimeData.formats()) {
+			QTableWidgetItem formatItem = new QTableWidgetItem(format);
+			formatItem.setFlags(Qt.ItemIsEnabled);
+			formatItem.setTextAlignment(Qt.AlignTop | Qt.AlignLeft);
+
+			string text;
+			if (format == "text/plain") {
+				text = trim(mimeData.text());
+			} else if (format == "text/html") {
+				text = trim(mimeData.html());
+			} else if (format == "text/uri-list") {
+				QUrl[] urlList = mimeData.urls();
+				for (int i = 0; i < urlList.length && i < 32; ++i) {
+					string url = urlList[i].path();
+					text ~= url ~ " ";
+				}
+			} else {
+				QByteArray data = mimeData.data(format);
+				for (int i = 0; i < data.size() && i < 32; ++i) {
+					string hex = toUpper(Format("{0:x}", data.at(i)));				
+					text ~= hex ~ " ";
+				}
+			}
+
+			int row = formatsTable.rowCount();
+			formatsTable.insertRow(row);
+			formatsTable.setItem(row, 0, new QTableWidgetItem(format));
+			formatsTable.setItem(row, 1, new QTableWidgetItem(text));
+		}
+
+		formatsTable.resizeColumnToContents(0);
+	}
+
+private:
+
+	DropArea dropArea;
+	QLabel abstractLabel;
+	QTableWidget formatsTable;
+
+	QPushButton clearButton;
+	QPushButton quitButton;
+	QDialogButtonBox buttonBox;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/draganddrop/dropsite/helloworld.ui	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,27 @@
+<ui version="4.0" >
+ <class>HelloWorldForm</class>
+ <widget class="QWidget" name="HelloWorldForm" >
+  <property name="geometry" >
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>96</width>
+    <height>48</height>
+   </rect>
+  </property>
+  <property name="windowTitle" >
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" >
+   <item>
+    <widget class="QLabel" name="label" >
+     <property name="text" >
+      <string>Hello World!</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/itemviews/customsortfiltermodel/mysortfilterproxymodel_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module mysortfilterproxymodel_d1;
+
+import qt.core.QDate;
+import qt.core.QVariant;
+import qt.core.QDateTime;
+import qt.gui.QSortFilterProxyModel;
+
+
+class MySortFilterProxyModel : public QSortFilterProxyModel
+{
+public:
+
+	this(QObject parent = null)
+	{
+		super(parent);
+		minDate = new QDate();
+		maxDate = new QDate();
+	}
+
+	QDate filterMinimumDate()
+	{
+		return minDate;
+	}
+	
+	void setFilterMinimumDate(QDate date)
+	{
+		minDate = date;
+		invalidateFilter();
+	}
+
+	QDate filterMaximumDate()
+	{
+		return maxDate;
+	}
+	
+	void setFilterMaximumDate(QDate date)
+	{
+		maxDate = date;
+		invalidateFilter();
+	}
+
+protected:
+
+	override bool filterAcceptsRow(int sourceRow, QModelIndex sourceParent)
+	{
+		QModelIndex index0 = sourceModel().index(sourceRow, 0, sourceParent);
+		QModelIndex index1 = sourceModel().index(sourceRow, 1, sourceParent);
+		QModelIndex index2 = sourceModel().index(sourceRow, 2, sourceParent);
+
+		static bool contains(string str, QRegExp rx1)
+		{
+			auto rx2 = new QRegExp(rx1);
+			return (rx2.indexIn(str, 0) != -1);
+		}
+		
+		return (contains(sourceModel().data(index0).toString(), filterRegExp())
+			|| contains(sourceModel().data(index1).toString(), filterRegExp()))
+			&& dateInRange(sourceModel().data(index2).toDate());
+	}
+
+	override bool lessThan(QModelIndex left, QModelIndex right)
+	{
+		QVariant leftData = sourceModel().data(left);
+		QVariant rightData = sourceModel().data(right);
+
+		if (leftData.type() == QVariant.Type.DateTime) {
+			return leftData.toDateTime() < rightData.toDateTime();
+		} else {
+			QRegExp emailPattern = new QRegExp("([\\w\\.]*@[\\w\\.]*)");
+
+			string leftString = leftData.toString();
+			if(left.column() == 1 && emailPattern.indexIn(leftString) != -1)
+				leftString = emailPattern.cap(1);
+
+			string rightString = rightData.toString();
+			if(right.column() == 1 && emailPattern.indexIn(rightString) != -1)
+				rightString = emailPattern.cap(1);
+
+			return leftString < rightString;
+		}
+	}
+
+private:
+
+	bool dateInRange(QDate date)
+	{
+		return (!minDate.isValid() || date > minDate) && (!maxDate.isValid() || date < maxDate);
+	}
+
+	QDate minDate;
+	QDate maxDate;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/opengl/hellogl/glwidget_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,267 @@
+/****************************************************************************
+**
+** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the example classes of the Qt Toolkit.
+**
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License versions 2.0 or 3.0 as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file.  Please review the following information
+** to ensure GNU General Public Licensing requirements will be met:
+** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
+** http://www.gnu.org/copyleft/gpl.html.  In addition, as a special
+** exception, Nokia gives you certain additional rights. These rights
+** are described in the Nokia Qt GPL Exception version 1.3, included in
+** the file GPL_EXCEPTION.txt in this package.
+**
+** Qt for Windows(R) Licensees
+** As a special exception, Nokia, as the sole copyright holder for Qt
+** Designer, grants users of the Qt/Eclipse Integration plug-in the
+** right for the Qt/Eclipse Integration to link to functionality
+** provided by Qt Designer and its related libraries.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+**
+****************************************************************************/
+
+
+import tango.math.Math;
+
+import qt.core.QPoint;
+import qt.gui.QMouseEvent;
+import qt.opengl.QGLWidget;
+import qt.gui.QColor;
+import qt.core.QSize;
+import qt.opengl.gl;
+import qt.opengl.glu;
+
+class GLWidget : QGLWidget
+{
+//    Q_OBJECT
+
+    public:
+        this(QWidget parent = null)
+        {
+            super(parent);
+            object = 0;
+            xRot = 0;
+            yRot = 0;
+            zRot = 0;
+
+            trolltechGreen = QColor.fromCmykF(0.40, 0.0, 1.0, 0.0);
+            trolltechPurple = QColor.fromCmykF(0.39, 0.39, 0.0, 0.0);
+        }
+
+        ~this()
+        {
+            makeCurrent();
+            glDeleteLists(object, 1);
+        }
+
+        QSize minimumSizeHint()
+        {
+            return QSize(50, 50);
+        }
+
+        QSize sizeHint()
+        {
+            return QSize(400, 400);
+        }
+
+
+    public: // slots:
+        void setXRotation(int angle)
+        {
+            normalizeAngle(&angle);
+            if (angle != xRot) {
+                xRot = angle;
+                xRotationChanged.emit(angle);
+                updateGL();
+            }
+        }
+
+        void setYRotation(int angle)
+        {
+            normalizeAngle(&angle);
+            if (angle != yRot) {
+                yRot = angle;
+                yRotationChanged.emit(angle);
+                updateGL();
+            }
+        }
+
+        void setZRotation(int angle)
+        {
+            normalizeAngle(&angle);
+            if (angle != zRot) {
+                zRot = angle;
+                zRotationChanged.emit(angle);
+                updateGL();
+            }
+        }
+
+        mixin Signal!("xRotationChanged", int);
+        mixin Signal!("yRotationChanged", int);
+        mixin Signal!("zRotationChanged", int);
+
+
+    protected:
+        void initializeGL()
+        {
+            qglClearColor(trolltechPurple.darker());
+            object = makeObject();
+            glShadeModel(GL_FLAT);
+            glEnable(GL_DEPTH_TEST);
+            glEnable(GL_CULL_FACE);
+        }
+
+        void paintGL()
+        {
+            glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+            glLoadIdentity();
+            glTranslated(0.0, 0.0, -10.0);
+            glRotated(xRot / 16.0, 1.0, 0.0, 0.0);
+            glRotated(yRot / 16.0, 0.0, 1.0, 0.0);
+            glRotated(zRot / 16.0, 0.0, 0.0, 1.0);
+            glCallList(object);
+        }
+
+        void resizeGL(int width, int height)
+        {
+            int side = qMin(width, height);
+            glViewport((width - side) / 2, (height - side) / 2, side, side);
+
+            glMatrixMode(GL_PROJECTION);
+            glLoadIdentity();
+            glOrtho(-0.5, +0.5, +0.5, -0.5, 4.0, 15.0);
+            glMatrixMode(GL_MODELVIEW);
+        }
+
+        void mousePressEvent(QMouseEvent event)
+        {
+            lastPos = QPoint(event.pos.x, event.pos.y);
+        }
+
+        void mouseMoveEvent(QMouseEvent event)
+        {
+            int dx = event.x - lastPos.x;
+            int dy = event.y - lastPos.y;
+
+            if (event.buttons() & Qt.LeftButton) {
+                setXRotation(xRot + 8 * dy);
+                setYRotation(yRot + 8 * dx);
+            } else if (event.buttons() & Qt.RightButton) {
+                setXRotation(xRot + 8 * dy);
+                setZRotation(zRot + 8 * dx);
+            }
+            lastPos = QPoint(event.pos.x, event.pos.y);
+        }
+    private:
+        GLuint makeObject()
+        {
+            GLuint list = glGenLists(1);
+            glNewList(list, GL_COMPILE);
+
+            glBegin(GL_QUADS);
+
+            GLdouble x1 = +0.06;
+            GLdouble y1 = -0.14;
+            GLdouble x2 = +0.14;
+            GLdouble y2 = -0.06;
+            GLdouble x3 = +0.08;
+            GLdouble y3 = +0.00;
+            GLdouble x4 = +0.30;
+            GLdouble y4 = +0.22;
+
+            quad(x1, y1, x2, y2, y2, x2, y1, x1);
+            quad(x3, y3, x4, y4, y4, x4, y3, x3);
+
+            extrude(x1, y1, x2, y2);
+            extrude(x2, y2, y2, x2);
+            extrude(y2, x2, y1, x1);
+            extrude(y1, x1, x1, y1);
+            extrude(x3, y3, x4, y4);
+            extrude(x4, y4, y4, x4);
+            extrude(y4, x4, y3, x3);
+
+            const double Pi = 3.14159265358979323846;
+            const int NumSectors = 200;
+
+            for (int i = 0; i < NumSectors; ++i) {
+                double angle1 = (i * 2 * Pi) / NumSectors;
+                GLdouble x5 = 0.30 * sin(angle1);
+                GLdouble y5 = 0.30 * cos(angle1);
+                GLdouble x6 = 0.20 * sin(angle1);
+                GLdouble y6 = 0.20 * cos(angle1);
+
+                double angle2 = ((i + 1) * 2 * Pi) / NumSectors;
+                GLdouble x7 = 0.20 * sin(angle2);
+                GLdouble y7 = 0.20 * cos(angle2);
+                GLdouble x8 = 0.30 * sin(angle2);
+                GLdouble y8 = 0.30 * cos(angle2);
+
+                quad(x5, y5, x6, y6, x7, y7, x8, y8);
+
+                extrude(x6, y6, x7, y7);
+                extrude(x8, y8, x5, y5);
+            }
+
+            glEnd();
+
+            glEndList();
+            return list;
+        }
+
+        void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
+                   GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
+        {
+            qglColor(trolltechGreen);
+
+            glVertex3d(x1, y1, -0.05);
+            glVertex3d(x2, y2, -0.05);
+            glVertex3d(x3, y3, -0.05);
+            glVertex3d(x4, y4, -0.05);
+
+            glVertex3d(x4, y4, +0.05);
+            glVertex3d(x3, y3, +0.05);
+            glVertex3d(x2, y2, +0.05);
+            glVertex3d(x1, y1, +0.05);
+        }
+
+        void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
+        {
+            qglColor(trolltechGreen.darker(rndint(250 + (100 * x1))));
+
+            glVertex3d(x1, y1, +0.05);
+            glVertex3d(x2, y2, +0.05);
+            glVertex3d(x2, y2, -0.05);
+            glVertex3d(x1, y1, -0.05);
+        }
+
+        void normalizeAngle(int *angle)
+        {
+            while (*angle < 0)
+                *angle += 360 * 16;
+            while (*angle > 360 * 16)
+                *angle -= 360 * 16;
+        }
+
+        GLuint object;
+        int xRot;
+        int yRot;
+        int zRot;
+        QPoint lastPos;
+        QColor trolltechGreen;
+        QColor trolltechPurple;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/widgets/calculator/calculator_d1.d	Tue Jul 14 15:28:22 2009 +0000
@@ -0,0 +1,388 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the example classes of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+module calculator_d1;
+
+import button;
+import qt.gui.QDialog;
+import qt.gui.QGridLayout;
+import qt.gui.QLineEdit;
+import qt.gui.QFont;
+
+import tango.math.Math;     
+import tango.math.Math : pow, sqrt;
+import Float = tango.text.convert.Float;
+import Integer = tango.text.convert.Integer;
+import tango.core.Array;    
+
+class Calculator : public QDialog
+{
+        
+public:
+        
+        this(QWidget parent = null)
+        {
+                super(parent);
+
+                sumInMemory = 0.0;
+                sumSoFar = 0.0;
+                factorSoFar = 0.0;
+                waitingForOperand = true;
+
+                display = new QLineEdit("0");
+                display.setReadOnly(true);
+                display.setAlignment(Qt.AlignRight);
+                display.setMaxLength(15);
+
+		auto font = new QFont(display.font());
+                font.setPointSize(font.pointSize() + 8);
+                display.setFont(font);
+
+                for (int i = 0; i < NumDigitButtons; ++i) {
+                        digitButtons[i] = createButton(Integer.toString(i), &digitClicked);
+                }
+
+                Button pointButton = createButton(tr("."), &pointClicked);
+                Button changeSignButton = createButton(tr("+/-"), &changeSignClicked);
+
+                Button backspaceButton = createButton(tr("Backspace"), &backspaceClicked);
+                Button clearButton = createButton(tr("Clear"), &clear);
+                Button clearAllButton = createButton(tr("Clear All"), &clearAll);
+
+                Button clearMemoryButton = createButton(tr("MC"), &clearMemory);
+                Button readMemoryButton = createButton(tr("MR"), &readMemory);
+                Button setMemoryButton = createButton(tr("MS"), &setMemory);
+                Button addToMemoryButton = createButton(tr("M+"), &addToMemory);
+
+                Button divisionButton = createButton(tr("/"), &multiplicativeOperatorClicked);
+                Button timesButton = createButton(tr("*"), &multiplicativeOperatorClicked);
+                Button minusButton = createButton(tr("-"), &additiveOperatorClicked);
+                Button plusButton = createButton(tr("+"), &additiveOperatorClicked);
+
+                Button squareRootButton = createButton(tr("Sqrt"), &unaryOperatorClicked);
+                Button powerButton = createButton(tr("x^2"), &unaryOperatorClicked);
+                Button reciprocalButton = createButton(tr("1/x"), &unaryOperatorClicked);
+                Button equalButton = createButton(tr("="), &equalClicked);
+
+                QGridLayout mainLayout = new QGridLayout();
+
+                mainLayout.setSizeConstraint(QLayout.SetFixedSize);
+
+                mainLayout.addWidget(display, 0, 0, 1, 6);
+                mainLayout.addWidget(backspaceButton, 1, 0, 1, 2);
+                mainLayout.addWidget(clearButton, 1, 2, 1, 2);
+                mainLayout.addWidget(clearAllButton, 1, 4, 1, 2);
+
+                mainLayout.addWidget(clearMemoryButton, 2, 0);
+                mainLayout.addWidget(readMemoryButton, 3, 0);
+                mainLayout.addWidget(setMemoryButton, 4, 0);
+                mainLayout.addWidget(addToMemoryButton, 5, 0);
+
+                for (int i = 1; i < NumDigitButtons; ++i) {
+                        int row = ((9 - i) / 3) + 2;
+                        int column = ((i - 1) % 3) + 1;
+                        mainLayout.addWidget(digitButtons[i], row, column);
+                }
+
+                mainLayout.addWidget(digitButtons[0], 5, 1);
+                mainLayout.addWidget(pointButton, 5, 2);
+                mainLayout.addWidget(changeSignButton, 5, 3);
+
+                mainLayout.addWidget(divisionButton, 2, 4);
+                mainLayout.addWidget(timesButton, 3, 4);
+                mainLayout.addWidget(minusButton, 4, 4);
+                mainLayout.addWidget(plusButton, 5, 4);
+
+                mainLayout.addWidget(squareRootButton, 2, 5);
+                mainLayout.addWidget(powerButton, 3, 5);
+                mainLayout.addWidget(reciprocalButton, 4, 5);
+                mainLayout.addWidget(equalButton, 5, 5);
+                setLayout(mainLayout);
+
+                setWindowTitle(tr("Calculator"));
+        }
+
+//private slots:
+        void digitClicked()
+        {
+                Button clickedButton = cast(Button) signalSender();
+                int digitValue = Integer.toInt(clickedButton.text);
+                if (display.text() == "0" && digitValue == 0.0)
+                        return;
+
+                if (waitingForOperand) {
+                        display.clear();
+                        waitingForOperand = false;
+                }
+                display.setText(display.text() ~ Integer.toString(digitValue));
+        }
+
+        void unaryOperatorClicked()
+        {
+                Button clickedButton = cast(Button) signalSender();
+                string clickedOperator = clickedButton.text();
+                double operand = Float.toFloat(display.text);
+                double result = 0.0;
+
+                if (clickedOperator == tr("Sqrt")) {
+                        if (operand < 0.0) {
+                                abortOperation();
+                                return;
+                        }
+                        result = sqrt(operand);
+                } else if (clickedOperator == tr("x^2")) {
+                        result = pow(operand, 2.0);
+                } else if (clickedOperator == tr("1/x")) {
+                        if (operand == 0.0) {
+                                abortOperation();
+                                return;
+                        }
+                        result = 1.0 / operand;
+                }
+                display.setText(Float.toString(result, 4));
+                waitingForOperand = true;
+        }
+
+        void additiveOperatorClicked()
+        {
+                Button clickedButton = cast(Button) signalSender();
+                string clickedOperator = clickedButton.text();
+                double operand = Float.toFloat(display.text);
+
+                if (pendingMultiplicativeOperator.length) {
+                        if (!calculate(operand, pendingMultiplicativeOperator)) {
+                                abortOperation();
+                                return;
+                        }
+                        display.setText(Float.toString(factorSoFar, 4));
+                        operand = factorSoFar;
+                        factorSoFar = 0.0;
+                        pendingMultiplicativeOperator = null;
+                }
+
+                if (pendingAdditiveOperator.length) {
+                        if (!calculate(operand, pendingAdditiveOperator)) {
+                                abortOperation();
+                                return;
+                        }
+                        display.setText(Float.toString(sumSoFar, 4));
+                } else {
+                        sumSoFar = operand;
+                }
+
+                pendingAdditiveOperator = clickedOperator;
+                waitingForOperand = true;
+        }
+
+        void multiplicativeOperatorClicked()
+        {
+                Button clickedButton = cast(Button) signalSender();
+                string clickedOperator = clickedButton.text();
+                double operand = Float.toFloat(display.text);
+
+                if (pendingMultiplicativeOperator.length) {
+                        if (!calculate(operand, pendingMultiplicativeOperator)) {
+                                abortOperation();
+                                return;
+                        }
+                        display.setText(Float.toString(factorSoFar, 4));
+                } else {
+                        factorSoFar = operand;
+                }
+
+                pendingMultiplicativeOperator = clickedOperator;
+                waitingForOperand = true;
+        }
+
+        void equalClicked()
+        {
+                double operand = Float.toFloat(display.text);
+
+                if (pendingMultiplicativeOperator.length) {
+                        if (!calculate(operand, pendingMultiplicativeOperator)) {
+                                abortOperation();
+                                return;
+                        }
+                        operand = factorSoFar;
+                        factorSoFar = 0.0;
+                        pendingMultiplicativeOperator = null;
+                }
+                if (pendingAdditiveOperator.length) {
+                        if (!calculate(operand, pendingAdditiveOperator)) {
+                                abortOperation();
+                                return;
+                        }
+                        pendingAdditiveOperator = null;
+                } else {
+                        sumSoFar = operand;
+                }
+
+                display.setText(Float.toString(sumSoFar, 4));
+                sumSoFar = 0.0;
+                waitingForOperand = true;
+        }
+
+        void pointClicked()
+        {
+                string text = display.text;
+
+                if (waitingForOperand)
+                        display.setText("0");
+
+                if (find(text, '.') >= text.length)
+                        display.setText(text ~ tr("."));
+                
+                waitingForOperand = false;
+        }
+
+        void changeSignClicked()
+        {
+                string text = display.text();
+                double value = Float.toFloat(text);
+
+                if (value > 0.0) {
+                        text = "-" ~ text;
+                } else if (value < 0.0) {
+                        text = text[1..$];
+                }
+                display.setText(text);
+        }
+
+        void backspaceClicked()
+        {
+                if (waitingForOperand)
+                        return;
+
+                string text = display.text();
+                text = text[0..$-1];
+                if (text.length == 0) {
+                        text = "0";
+                        waitingForOperand = true;
+                }
+                display.setText(text);
+        }
+
+
+        void clear()
+        {
+                if (waitingForOperand)
+                        return;
+
+                display.setText("0");
+                waitingForOperand = true;
+        }
+
+        void clearAll()
+        {
+                sumSoFar = 0.0;
+                factorSoFar = 0.0;
+                pendingAdditiveOperator = null;
+                pendingMultiplicativeOperator = null;
+                display.setText("0");
+                waitingForOperand = true;
+        }
+
+        void clearMemory()
+        {
+                sumInMemory = 0.0;
+        }
+
+        void readMemory()
+        {
+                display.setText(Float.toString(sumInMemory, 4));
+                waitingForOperand = true;
+        }
+
+        void setMemory()
+        {
+                equalClicked();
+                sumInMemory = Float.toFloat(display.text);
+        }
+
+        void addToMemory()
+        {
+                equalClicked();
+                sumInMemory += Float.toFloat(display.text);
+        }
+
+private:
+
+        Button createButton(string text, void delegate() member)
+        {
+                Button button = new Button(text);
+                button.clicked.connect(member);
+                return button;
+        }
+
+        void abortOperation()
+        {
+                clearAll();
+                display.setText(tr("####"));
+        }
+
+        bool calculate(double rightOperand, string pendingOperator)
+        {
+                if (pendingOperator == tr("+")) {
+                        sumSoFar += rightOperand;
+                } else if (pendingOperator == tr("-")) {
+                        sumSoFar -= rightOperand;
+                } else if (pendingOperator == tr("*")) {
+                        factorSoFar *= rightOperand;
+                } else if (pendingOperator == tr("/")) {
+                        if (rightOperand == 0.0)
+                                return false;
+                        factorSoFar /= rightOperand;
+                }
+                return true;
+        }
+
+        double sumInMemory;
+        double sumSoFar;
+        double factorSoFar;
+        string pendingAdditiveOperator;
+        string pendingMultiplicativeOperator;
+        bool waitingForOperand;
+
+        QLineEdit display;
+
+        enum { NumDigitButtons = 10 };
+        Button[NumDigitButtons] digitButtons;
+}