CUSTOM_METAOBJECT(DeclarativeCheckBox, QCheckBox)
+// DeclarativeColorDialog
+DeclarativeColorDialog::DeclarativeColorDialog(QObject *parent) : DeclarativeWidgetProxy<QColorDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeColorDialog, QColorDialog)
+
// DeclarativeDialog
DeclarativeDialog::DeclarativeDialog(QObject *parent) : DeclarativeWidgetProxy<QDialog>(parent)
{
CUSTOM_METAOBJECT(DeclarativeDialogButtonBox, QDialogButtonBox)
+// DeclarativeFileDialog
+DeclarativeFileDialog::DeclarativeFileDialog(QObject *parent) : DeclarativeWidgetProxy<FileDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFileDialog, FileDialog)
+
+// DeclarativeFontDialog
+DeclarativeFontDialog::DeclarativeFontDialog(QObject *parent) : DeclarativeWidgetProxy<QFontDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFontDialog, QFontDialog)
+
+// DeclarativeInputDialog
+DeclarativeInputDialog::DeclarativeInputDialog(QObject *parent) : DeclarativeWidgetProxy<InputDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeInputDialog, InputDialog)
+
// DeclarativeLabel
DeclarativeLabel::DeclarativeLabel(QObject *parent) : DeclarativeWidgetProxy<QLabel>(parent)
{
#include <QtGui/QAction>
#include <QtGui/QCalendarWidget>
#include <QtGui/QCheckBox>
+#include <QtGui/QColorDialog>
#include <QtGui/QDialog>
#include <QtGui/QDialogButtonBox>
+#include <QtGui/QFontDialog>
#include <QtGui/QFormLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QLabel>
DeclarativeCheckBox(QObject *parent = 0);
};
+class DeclarativeColorDialog : public DeclarativeWidgetProxy<QColorDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeColorDialog(QObject *parent = 0);
+};
+
class DeclarativeDialog : public DeclarativeWidgetProxy<QDialog>
{
DECLARATIVE_OBJECT
DeclarativeDialogButtonBox(QObject *parent = 0);
};
+class DeclarativeFileDialog : public DeclarativeWidgetProxy<FileDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFileDialog(QObject *parent = 0);
+};
+
+class DeclarativeFontDialog : public DeclarativeWidgetProxy<QFontDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFontDialog(QObject *parent = 0);
+};
+
+class DeclarativeInputDialog : public DeclarativeWidgetProxy<InputDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeInputDialog(QObject *parent = 0);
+};
+
class DeclarativeLabel : public DeclarativeWidgetProxy<QLabel>
{
DECLARATIVE_OBJECT
// widgets
qmlRegisterType<DeclarativeCalendarWidget>("QtGui", 1, 0, "CalendarWidget");
qmlRegisterType<DeclarativeCheckBox>("QtGui", 1, 0, "CheckBox");
+ qmlRegisterType<DeclarativeColorDialog>("QtGui", 1, 0, "ColorDialog");
qmlRegisterType<DeclarativeDialog>("QtGui", 1, 0, "Dialog");
qmlRegisterType<DeclarativeDialogButtonBox>("QtGui", 1, 0, "DialogButtonBox");
+ qmlRegisterType<DeclarativeFileDialog>("QtGui", 1, 0, "FileDialog");
+ qmlRegisterType<DeclarativeFontDialog>("QtGui", 1, 0, "FontDialog");
+ qmlRegisterType<DeclarativeInputDialog>("QtGui", 1, 0, "InputDialog");
qmlRegisterType<DeclarativeLabel>("QtGui", 1, 0, "Label");
qmlRegisterType<DeclarativeMainWindow>("QtGui", 1, 0, "MainWindow");
qmlRegisterType<DeclarativeMenu>("QtGui", 1, 0, "Menu");
QT += declarative
OTHER_FILES += \
- layouts.qml \
animation.qml \
+ dialogs.qml \
editor.qml \
gallery.qml \
+ layouts.qml \
test.qml
--- /dev/null
+import QtGui 1.0
+
+Widget {
+ ColorDialog {
+ id: colorDialog
+ }
+
+ FileDialog {
+ id: fileDialog
+
+ fileMode: FileDialog.ExistingFile
+ viewMode: FileDialog.List
+ }
+
+ FontDialog {
+ id: fontDialog
+ }
+
+ InputDialog {
+ id: intInputDialog
+
+ labelText: qsTr("Percentage")
+ }
+
+ VBoxLayout {
+ PushButton {
+ text: qsTr("Color Dialog...")
+ onClicked: {
+ if (colorDialog.exec())
+ console.log("Selected color: " + colorDialog.currentColor)
+ }
+ }
+
+ PushButton {
+ text: qsTr("File Dialog...")
+ onClicked: {
+ if (fileDialog.exec())
+ console.log("Selected files: " + fileDialog.selectedFiles)
+ }
+ }
+
+ PushButton {
+ text: qsTr("Font Dialog...")
+ onClicked: {
+ if (fontDialog.exec())
+ console.log("Selected font: " + fontDialog.currentFont)
+ }
+ }
+
+ PushButton {
+ text: qsTr("Input Dialog (Int)...")
+ onClicked: {
+ if (intInputDialog.exec())
+ console.log(intInputDialog.intValue + "%")
+ }
+ }
+ }
+}
#include "objectadaptors_p.h"
+FileDialog::FileDialog(QWidget *parent)
+ : QFileDialog(parent)
+{
+}
+
+InputDialog::InputDialog(QWidget *parent)
+ : QInputDialog(parent)
+{
+ connect(this, SIGNAL(textValueChanged(QString)), this, SIGNAL(customTextValueChanged()));
+ connect(this, SIGNAL(intValueChanged(int)), this, SIGNAL(customIntValueChanged()));
+ connect(this, SIGNAL(doubleValueChanged(double)), this, SIGNAL(customDoubleValueChanged()));
+}
+
TextEdit::TextEdit(QWidget *parent)
: QTextEdit(parent)
{
#ifndef OBJECTADAPTORS_P_H
#define OBJECTADAPTORS_P_H
+#include <QtGui/QFileDialog>
+#include <QtGui/QInputDialog>
#include <QtGui/QTextEdit>
+class FileDialog : public QFileDialog
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QStringList selectedFiles READ selectedFiles)
+
+ public:
+ FileDialog(QWidget *parent = 0);
+};
+
+class InputDialog : public QInputDialog
+{
+ Q_OBJECT
+
+ Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode)
+ Q_PROPERTY(QString labelText READ labelText WRITE setLabelText)
+ Q_PROPERTY(InputDialogOptions options READ options WRITE setOptions)
+ Q_PROPERTY(QString textValue READ textValue WRITE setTextValue NOTIFY customTextValueChanged)
+ Q_PROPERTY(int intValue READ intValue WRITE setIntValue NOTIFY customIntValueChanged)
+ Q_PROPERTY(int doubleValue READ doubleValue WRITE setDoubleValue NOTIFY customDoubleValueChanged)
+ Q_PROPERTY(QLineEdit::EchoMode textEchoMode READ textEchoMode WRITE setTextEchoMode)
+ Q_PROPERTY(bool comboBoxEditable READ isComboBoxEditable WRITE setComboBoxEditable)
+ Q_PROPERTY(QStringList comboBoxItems READ comboBoxItems WRITE setComboBoxItems)
+ Q_PROPERTY(int intMinimum READ intMinimum WRITE setIntMinimum)
+ Q_PROPERTY(int intMaximum READ intMaximum WRITE setIntMaximum)
+ Q_PROPERTY(int intStep READ intStep WRITE setIntStep)
+ Q_PROPERTY(double doubleMinimum READ doubleMinimum WRITE setDoubleMinimum)
+ Q_PROPERTY(double doubleMaximum READ doubleMaximum WRITE setDoubleMaximum)
+ Q_PROPERTY(int doubleDecimals READ doubleDecimals WRITE setDoubleDecimals)
+ Q_PROPERTY(QString okButtonText READ okButtonText WRITE setOkButtonText)
+ Q_PROPERTY(QString cancelButtonText READ cancelButtonText WRITE setCancelButtonText)
+
+ Q_ENUMS(InputMode)
+ Q_ENUMS(InputDialogOption)
+
+ public:
+ InputDialog(QWidget *parent = 0);
+
+ Q_SIGNALS:
+ void customTextValueChanged();
+ void customIntValueChanged();
+ void customDoubleValueChanged();
+};
+
class TextEdit : public QTextEdit
{
Q_OBJECT