51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import QtCore 1.0
import QtGui 1.0
TabWidget {
DateTimeEdit {}
+ ComboBox {
+ model: StringListModel {
+ stringList: [ qsTr("Entry 1"), qsTr("Entry 2"), qsTr("Entry 3") ]
+ }
+
+ onCurrentIndexChanged: console.log( "combobox current index=" + currentIndex + ", text=" + currentText );
+ }
+
Dial {}
ScrollBar {
--- /dev/null
+/*
+ Copyright (C) 2012-2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, kevin.krammer@kdab.com
+ Author: Tobias Koenig, tobias.koenig@kdab.com
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#include "declarativecomboboxextension_p.h"
+
+#include <QComboBox>
+
+DeclarativeComboBoxExtension::DeclarativeComboBoxExtension(QObject *parent)
+ : DeclarativeWidgetExtension(parent)
+{
+}
+
+QComboBox *DeclarativeComboBoxExtension::extendedComboBox() const
+{
+ QComboBox *comboBox = qobject_cast<QComboBox*>(extendedWidget());
+ Q_ASSERT(comboBox);
+
+ return comboBox;
+}
+#include <QDebug>
+void DeclarativeComboBoxExtension::setModel(QAbstractItemModel *model)
+{
+ QComboBox *comboBox = extendedComboBox();
+
+ if (comboBox->model() == model)
+ return;
+
+ comboBox->setModel(model);
+
+ emit modelChanged();
+}
+
+QAbstractItemModel *DeclarativeComboBoxExtension::model() const
+{
+ return extendedComboBox()->model();
+}
--- /dev/null
+/*
+ Copyright (C) 2012-2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, kevin.krammer@kdab.com
+ Author: Tobias Koenig, tobias.koenig@kdab.com
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifndef DECLARATIVECOMBOBOXEXTENSION_P_H
+#define DECLARATIVECOMBOBOCEXTENSION_P_H
+
+#include "declarativewidgetextension.h"
+
+class QComboBox;
+class QAbstractItemModel;
+
+class DeclarativeComboBoxExtension : public DeclarativeWidgetExtension
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel NOTIFY modelChanged)
+
+ // repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+
+ Q_CLASSINFO("DefaultProperty", "data")
+
+ public:
+ explicit DeclarativeComboBoxExtension(QObject *parent = 0);
+
+ QComboBox *extendedComboBox() const;
+
+ void setModel(QAbstractItemModel *model);
+ QAbstractItemModel *model() const;
+
+ Q_SIGNALS:
+ void modelChanged();
+};
+
+#endif
#include "declarativeaction_p.h"
#include "declarativebuttongroupextension_p.h"
#include "declarativecolordialog_p.h"
+#include "declarativecomboboxextension_p.h"
#include "declarativedeclarativecontext_p.h"
#include "declarativedeclarativeviewextension_p.h"
#include "declarativefiledialog_p.h"
#include <QCalendarWidget>
#include <QCheckBox>
#include <QColumnView>
+#include <QComboBox>
#include <QCommandLinkButton>
#include <QCoreApplication>
#include <QDateTimeEdit>
qmlRegisterExtendedType<DeclarativeColorDialog, DeclarativeWidgetExtension>("QtGui", 1, 0, "ColorDialog");
qmlRegisterExtendedType<QColumnView, DeclarativeItemViewExtension>("QtGui", 1, 0, "ColumnView");
qmlRegisterExtendedType<QCommandLinkButton, DeclarativeWidgetExtension>("QtGui", 1, 0, "CommandLinkButton");
+ qmlRegisterExtendedType<QComboBox, DeclarativeComboBoxExtension>("QtGui", 1, 0, "ComboBox");
qmlRegisterExtendedType<QDateEdit, DeclarativeWidgetExtension>("QtGui", 1, 0, "DateEdit");
qmlRegisterExtendedType<QDateTimeEdit, DeclarativeWidgetExtension>("QtGui", 1, 0, "DateTimeEdit");
qmlRegisterExtendedType<QDeclarativeView, DeclarativeDeclarativeViewExtension>("QtGui", 1, 0, "DeclarativeView");
declarativeboxlayout_p.h \
declarativebuttongroupextension_p.h \
declarativecolordialog_p.h \
+ declarativecomboboxextension_p.h \
declarativedeclarativecontext_p.h \
declarativedeclarativeviewextension_p.h \
declarativefiledialog_p.h \
declarativeboxlayout.cpp \
declarativebuttongroupextension.cpp \
declarativecolordialog.cpp \
+ declarativecomboboxextension.cpp \
declarativedeclarativecontext.cpp \
declarativedeclarativeviewextension.cpp \
declarativefiledialog.cpp \