--- /dev/null
+If you wish to use this software in ways incompatible with the GPL, please contact sales@kdab.com, and we'll work something out.
+++ /dev/null
-#include "declarativeobjects_p.h"
-
-#include "qmetaobjectbuilder_p.h"
-
-#include <QDebug>
-
-#define CUSTOM_METAOBJECT(ClassName, ProxyObjectType) \
-QMetaObject ClassName::staticMetaObject;\
-bool ClassName::metaObjectInitialized = ClassName::initializeMetaObject(); \
-bool ClassName::initializeMetaObject() \
-{ \
- QMetaObjectBuilder builder; \
- const QMetaObject *mo = &ProxyObjectType::staticMetaObject; \
- builder.addMetaObject(mo); \
- builder.addMetaObject(&AbstractDeclarativeObject::staticMetaObject); \
- builder.setSuperClass(ProxyObjectType::staticMetaObject.superClass()); \
- builder.setClassName(""#ClassName); \
- ClassName::staticMetaObject = *builder.toMetaObject(); \
- return true; \
-} \
-const QMetaObject &ClassName::getStaticMetaObject() \
-{ \
- return ClassName::staticMetaObject; \
-} \
-const QMetaObject* ClassName::metaObject() const \
-{ \
- return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; \
-} \
-void* ClassName::qt_metacast(const char*) \
-{ \
- return 0; \
-} \
-int ClassName::qt_metacall(QMetaObject::Call call, int id, void **argv) \
-{ \
- if (call == QMetaObject::ReadProperty || call == QMetaObject::WriteProperty) { \
- if (id >= ProxyObjectType::staticMetaObject.propertyCount()) { \
- id = AbstractDeclarativeObject::qt_metacall(call, id - ProxyObjectType::staticMetaObject.propertyCount() + 1, argv); \
- id += ProxyObjectType::staticMetaObject.propertyCount() - 1; \
- } else { \
- id = m_proxiedObject->qt_metacall(call, id, argv); \
- } \
- if (id < 0) \
- return 0; \
- } else if (call == QMetaObject::InvokeMetaMethod) {\
- if (ClassName::staticMetaObject.method(id).methodType() == QMetaMethod::Signal) \
- QMetaObject::activate(this, id, argv); \
- else \
- id = m_proxiedObject->qt_metacall(call, id, argv); \
- id -= 1; \
- } \
- return id; \
-}
-
-// AbstractDeclarativeObject
-AbstractDeclarativeObject::AbstractDeclarativeObject(QObject *parent)
- : QObject(parent)
-{
-}
-
-AbstractDeclarativeObject::~AbstractDeclarativeObject()
-{
-}
-
-QDeclarativeListProperty<QObject> AbstractDeclarativeObject::data()
-{
- return QDeclarativeListProperty<QObject>(this, 0, AbstractDeclarativeObject::data_append,
- AbstractDeclarativeObject::data_count,
- AbstractDeclarativeObject::data_at,
- AbstractDeclarativeObject::data_clear);
-}
-
-void AbstractDeclarativeObject::dataAppend(QObject *)
-{
-}
-
-int AbstractDeclarativeObject::dataCount() const
-{
- return 0;
-}
-
-QObject* AbstractDeclarativeObject::dataAt(int) const
-{
- return 0;
-}
-
-void AbstractDeclarativeObject::dataClear()
-{
-}
-
-static void connectAllSignals(QObject *sender, QObject *receiver, const QSet<QByteArray> &blacklist = QSet<QByteArray>())
-{
- for (int i = 0; i < sender->metaObject()->methodCount(); ++i) {
- const QMetaMethod method = sender->metaObject()->method(i);
- if (method.methodType() == QMetaMethod::Signal) {
- if (blacklist.contains(method.signature()))
- continue;
-
- const QByteArray signature = "2" + QByteArray(method.signature());
- QObject::connect(sender, signature.data(), receiver, signature.data());
- }
- }
-}
-
-void AbstractDeclarativeObject::data_append(QDeclarativeListProperty<QObject> *property, QObject *object)
-{
- if (!object)
- return;
-
- AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
- if (that)
- that->dataAppend(object);
- else
- qWarning("cast went wrong in data_append");
-}
-
-int AbstractDeclarativeObject::data_count(QDeclarativeListProperty<QObject> *property)
-{
- AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
- if (that)
- return that->dataCount();
- else {
- qWarning("cast went wrong in data_count");
- return 0;
- }
-}
-
-QObject* AbstractDeclarativeObject::data_at(QDeclarativeListProperty<QObject> *property, int index)
-{
- AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
- if (that)
- return that->dataAt(index);
- else {
- qWarning("cast went wrong in data_at");
- return 0;
- }
-}
-
-void AbstractDeclarativeObject::data_clear(QDeclarativeListProperty<QObject> *property)
-{
- AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
- if (that)
- that->dataClear();
- else
- qWarning("cast went wrong in data_clear");
-}
-
-//// Objects ////
-
-// DeclarativeAction
-DeclarativeAction::DeclarativeAction(QObject *parent) : DeclarativeObjectProxy<QAction, true>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeAction, QAction)
-
-// DeclarativeActionItem
-DeclarativeActionItem::DeclarativeActionItem(QObject *parent) : DeclarativeObjectProxy<ActionItem>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeActionItem, ActionItem)
-
-// DeclarativeButtonGroup
-DeclarativeButtonGroup::DeclarativeButtonGroup(QObject *parent) : DeclarativeObjectProxy<ButtonGroup>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeButtonGroup, ButtonGroup)
-
-// DeclarativeSeparator
-DeclarativeSeparator::DeclarativeSeparator(QObject *parent) : DeclarativeObjectProxy<QAction, true>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeSeparator, QAction)
-
-//// Layouts ////
-class DeclarativeBoxLayoutAttached::Private
-{
- public:
- Private(QWidget *w, QLayout *l) : stretch(0), alignment(0), widget(w), layout(l) {}
-
- int stretch;
- Qt::Alignment alignment;
-
- QPointer<QWidget> widget;
- QPointer<QLayout> layout;
- QPointer<QBoxLayout> parentLayout;
-};
-
-DeclarativeBoxLayoutAttached::DeclarativeBoxLayoutAttached(QWidget *widget, QObject *parent)
- : QObject(parent), d(new Private(widget, 0))
-{
-}
-
-DeclarativeBoxLayoutAttached::DeclarativeBoxLayoutAttached(QLayout *layout, QObject *parent)
- : QObject(parent), d(new Private(0, layout))
-{
-}
-
-DeclarativeBoxLayoutAttached::~DeclarativeBoxLayoutAttached()
-{
- delete d;
-}
-
-void DeclarativeBoxLayoutAttached::setParentLayout(QBoxLayout *parentLayout)
-{
- d->parentLayout = parentLayout;
-}
-
-void DeclarativeBoxLayoutAttached::setStretch(int stretch)
-{
- if (stretch == d->stretch)
- return;
-
- d->stretch = stretch;
- emit stretchChanged(stretch);
-}
-
-int DeclarativeBoxLayoutAttached::stretch() const
-{
- return d->stretch;
-}
-
-void DeclarativeBoxLayoutAttached::setAlignment(Qt::Alignment alignment)
-{
- if (alignment == d->alignment)
- return;
-
- d->alignment = alignment;
- emit alignmentChanged(alignment);
-
- if (d->parentLayout) {
- if (d->widget)
- d->parentLayout->setAlignment(d->widget, d->alignment);
-
- if (d->layout)
- d->parentLayout->setAlignment(d->layout, d->alignment);
- }
-}
-
-Qt::Alignment DeclarativeBoxLayoutAttached::alignment() const
-{
- return d->alignment;
-}
-
-class DeclarativeFormLayoutAttached::Private
-{
- public:
- QString label;
-};
-
-DeclarativeFormLayoutAttached::DeclarativeFormLayoutAttached(QObject *parent)
- : QObject(parent), d(new Private)
-{
-}
-
-DeclarativeFormLayoutAttached::~DeclarativeFormLayoutAttached()
-{
- delete d;
-}
-
-void DeclarativeFormLayoutAttached::setLabel(const QString &label)
-{
- if (label == d->label)
- return;
-
- d->label = label;
- emit labelChanged(label);
-}
-
-class DeclarativeGridLayoutAttached::Private
-{
- public:
- Private(QWidget *w, QLayout *l)
- : row(0), column(0), rowSpan(1), columnSpan(1), alignment(0),
- widget(w), layout(l)
- {}
-
- int row;
- int column;
- int rowSpan;
- int columnSpan;
- Qt::Alignment alignment;
-
- QPointer<QWidget> widget;
- QPointer<QLayout> layout;
- QPointer<QGridLayout> parentLayout;
-};
-
-DeclarativeGridLayoutAttached::DeclarativeGridLayoutAttached(QWidget *widget, QObject *parent)
- : QObject(parent), d(new Private(widget, 0))
-{
-}
-
-DeclarativeGridLayoutAttached::DeclarativeGridLayoutAttached(QLayout *layout, QObject *parent)
- : QObject(parent), d(new Private(0, layout))
-{
-}
-
-DeclarativeGridLayoutAttached::~DeclarativeGridLayoutAttached()
-{
- delete d;
-}
-
-void DeclarativeGridLayoutAttached::setParentLayout(QGridLayout *parentLayout)
-{
- d->parentLayout = parentLayout;
-}
-
-void DeclarativeGridLayoutAttached::setRow(int row)
-{
- if (row == d->row)
- return;
-
- d->row = row;
- emit rowChanged(row);
-}
-
-int DeclarativeGridLayoutAttached::row() const
-{
- return d->row;
-}
-
-void DeclarativeGridLayoutAttached::setColumn(int column)
-{
- if (column == d->column)
- return;
-
- d->column = column;
- emit columnChanged(column);
-}
-
-int DeclarativeGridLayoutAttached::column() const
-{
- return d->column;
-}
-
-void DeclarativeGridLayoutAttached::setRowSpan(int rowSpan)
-{
- if (rowSpan == d->rowSpan)
- return;
-
- d->rowSpan = rowSpan;
- emit rowSpanChanged(rowSpan);
-}
-
-int DeclarativeGridLayoutAttached::rowSpan() const
-{
- return d->rowSpan;
-}
-
-void DeclarativeGridLayoutAttached::setColumnSpan(int columnSpan)
-{
- if (columnSpan == d->columnSpan)
- return;
-
- d->columnSpan = columnSpan;
- emit columnSpanChanged(columnSpan);
-}
-
-int DeclarativeGridLayoutAttached::columnSpan() const
-{
- return d->columnSpan;
-}
-
-void DeclarativeGridLayoutAttached::setAlignment(Qt::Alignment alignment)
-{
- if (alignment == d->alignment)
- return;
-
- d->alignment = alignment;
- emit alignmentChanged(alignment);
-
- if (d->parentLayout) {
- if (d->widget)
- d->parentLayout->setAlignment(d->widget, d->alignment);
-
- if (d->layout)
- d->parentLayout->setAlignment(d->layout, d->alignment);
- }
-}
-
-Qt::Alignment DeclarativeGridLayoutAttached::alignment() const
-{
- return d->alignment;
-}
-
-QString DeclarativeFormLayoutAttached::label() const
-{
- return d->label;
-}
-
-// DeclarativeFormLayout
-DeclarativeFormLayout::DeclarativeFormLayout(QObject *parent) : DeclarativeLayoutProxy<QFormLayout>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeFormLayoutAttached *DeclarativeFormLayout::qmlAttachedProperties(QObject *parent)
-{
- return new DeclarativeFormLayoutAttached(parent);
-}
-
-void DeclarativeFormLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeFormLayout>(declarativeObject, false);
- DeclarativeFormLayoutAttached *properties = qobject_cast<DeclarativeFormLayoutAttached*>(attachedProperties);
- if (properties) {
- if (!properties->label().isEmpty()) {
- m_proxiedObject->addRow(properties->label(), widget);
- m_children.append(declarativeObject);
- return;
- }
- }
-
- m_proxiedObject->addRow(widget);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeFormLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeFormLayout>(declarativeObject, false);
- DeclarativeFormLayoutAttached *properties = qobject_cast<DeclarativeFormLayoutAttached*>(attachedProperties);
- if (properties) {
- if (!properties->label().isEmpty()) {
- m_proxiedObject->addRow(properties->label(), layout);
- m_children.append(declarativeObject);
- return;
- }
- }
- m_proxiedObject->addRow(layout);
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeFormLayout, QFormLayout)
-
-// DeclarativeGridLayout
-DeclarativeGridLayout::DeclarativeGridLayout(QObject *parent) : DeclarativeLayoutProxy<QGridLayout>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeGridLayoutAttached *DeclarativeGridLayout::qmlAttachedProperties(QObject *parent)
-{
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject) {
- QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
- if (widget)
- return new DeclarativeGridLayoutAttached(widget, parent);
-
- QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
- if (layout)
- return new DeclarativeGridLayoutAttached(layout, parent);
- }
-
- qmlInfo(parent) << "Can only attach GridLayout to widgets and layouts";
- return 0;
-}
-
-void DeclarativeGridLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- int row = 0;
- int column = 0;
- int rowSpan = 1;
- int columnSpan = 1;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeGridLayout>(declarativeObject, false);
- DeclarativeGridLayoutAttached *properties = qobject_cast<DeclarativeGridLayoutAttached*>(attachedProperties);
- if (properties) {
- row = properties->row();
- column = properties->column();
- rowSpan = properties->rowSpan();
- columnSpan = properties->columnSpan();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addWidget(widget, row, column, rowSpan, columnSpan, alignment);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeGridLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- int row = 0;
- int column = 0;
- int rowSpan = 1;
- int columnSpan = 1;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeGridLayout>(declarativeObject, false);
- DeclarativeGridLayoutAttached *properties = qobject_cast<DeclarativeGridLayoutAttached*>(attachedProperties);
- if (properties) {
- row = properties->row();
- column = properties->column();
- rowSpan = properties->rowSpan();
- columnSpan = properties->columnSpan();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addLayout(layout, row, column, rowSpan, columnSpan, alignment);
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeGridLayout, QGridLayout)
-
-// DeclarativeHBoxLayout
-DeclarativeHBoxLayout::DeclarativeHBoxLayout(QObject *parent) : DeclarativeLayoutProxy<QHBoxLayout>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeBoxLayoutAttached *DeclarativeHBoxLayout::qmlAttachedProperties(QObject *parent)
-{
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject) {
- QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
- if (widget)
- return new DeclarativeBoxLayoutAttached(widget, parent);
-
- QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
- if (layout)
- return new DeclarativeBoxLayoutAttached(layout, parent);
- }
-
- qmlInfo(parent) << "Can only attach HBoxLayout to widgets and layouts";
- return 0;
-}
-
-void DeclarativeHBoxLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- int stretch = 0;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeHBoxLayout>(declarativeObject, false);
- DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
- if (properties) {
- stretch = properties->stretch();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addWidget(widget, stretch, alignment);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeHBoxLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- int stretch = 0;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeHBoxLayout>(declarativeObject, false);
- DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
- if (properties) {
- stretch = properties->stretch();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addLayout(layout, stretch);
- m_proxiedObject->setAlignment(layout, alignment);
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeHBoxLayout, QHBoxLayout)
-
-// DeclarativeStackedLayout
-DeclarativeStackedLayout::DeclarativeStackedLayout(QObject *parent) : DeclarativeLayoutProxy<StackedLayout>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeStackedLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- m_proxiedObject->addWidget(widget);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeStackedLayout::addLayout(QLayout*, AbstractDeclarativeObject *declarativeObject)
-{
- qmlInfo(declarativeObject) << "StackedLayout does not support child layouts";
-}
-
-CUSTOM_METAOBJECT(DeclarativeStackedLayout, StackedLayout)
-
-// DeclarativeVBoxLayout
-DeclarativeVBoxLayout::DeclarativeVBoxLayout(QObject *parent) : DeclarativeLayoutProxy<QVBoxLayout>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeBoxLayoutAttached *DeclarativeVBoxLayout::qmlAttachedProperties(QObject *parent)
-{
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject) {
- QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
- if (widget)
- return new DeclarativeBoxLayoutAttached(widget, parent);
-
- QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
- if (layout)
- return new DeclarativeBoxLayoutAttached(layout, parent);
- }
-
- qmlInfo(parent) << "Can only attach VBoxLayout to widgets and layouts";
- return 0;
-}
-
-void DeclarativeVBoxLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- int stretch = 0;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeVBoxLayout>(declarativeObject, false);
- DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
- if (properties) {
- stretch = properties->stretch();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addWidget(widget, stretch, alignment);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeVBoxLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- int stretch = 0;
- Qt::Alignment alignment = 0;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeVBoxLayout>(declarativeObject, false);
- DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
- if (properties) {
- stretch = properties->stretch();
- alignment = properties->alignment();
-
- properties->setParentLayout(m_proxiedObject);
- }
-
- m_proxiedObject->addLayout(layout, stretch);
- m_proxiedObject->setAlignment(layout, alignment);
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeVBoxLayout, QVBoxLayout)
-
-//// Widgets ////
-
-// DeclarativeCalendarWidget
-DeclarativeCalendarWidget::DeclarativeCalendarWidget(QObject *parent) : DeclarativeWidgetProxy<QCalendarWidget>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeCalendarWidget, QCalendarWidget)
-
-// DeclarativeCheckBox
-DeclarativeCheckBox::DeclarativeCheckBox(QObject *parent) : DeclarativeWidgetProxy<QCheckBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeCheckBox, QCheckBox)
-
-// DeclarativeColorDialog
-class DeclarativeColorDialogAttached::Private
-{
- public:
- Private() : options(0) {}
-
- public:
- QPointer<QObject> dialogParent;
- QString title;
- QColorDialog::ColorDialogOptions options;
-};
-
-DeclarativeColorDialogAttached::DeclarativeColorDialogAttached(QObject *parent)
- : QObject(parent), d(new Private)
-{
-}
-
-DeclarativeColorDialogAttached::~DeclarativeColorDialogAttached()
-{
- delete d;
-}
-
-void DeclarativeColorDialogAttached::setDialogParent(QObject *parent)
-{
- if (parent == d->dialogParent)
- return;
-
- d->dialogParent = parent;
- emit dialogParentChanged(parent);
-}
-
-QObject *DeclarativeColorDialogAttached::dialogParent() const
-{
- return d->dialogParent;
-}
-
-void DeclarativeColorDialogAttached::setTitle(const QString &title)
-{
- if (title == d->title)
- return;
-
- d->title = title;
- emit titleChanged(title);
-}
-
-QString DeclarativeColorDialogAttached::title() const
-{
- return d->title;
-}
-
-QColor DeclarativeColorDialogAttached::getColor(const QColor &initialColor)
-{
- QWidget *parent = bestParentWindow(d->dialogParent);
- if (!d->title.isEmpty() || d->options != 0)
- return QColorDialog::getColor(initialColor, parent, d->title, d->options);
- else
- return QColorDialog::getColor(initialColor, parent);
-}
-
-QWidget *DeclarativeColorDialogAttached::bestParentWindow(QObject *parent) const
-{
- if (!parent)
- parent = this->parent();
-
- // if parent is a Declarative Object, search the proxied hierarchy
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject)
- parent = declarativeObject->object();
-
- while (parent) {
- QWidget *widget = qobject_cast<QWidget*>(parent);
- if (widget)
- return widget->topLevelWidget();
-
- parent = parent->parent();
- }
-
- return 0;
-}
-
-DeclarativeColorDialog::DeclarativeColorDialog(QObject *parent) : DeclarativeWidgetProxy<QColorDialog>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeColorDialogAttached *DeclarativeColorDialog::qmlAttachedProperties(QObject *parent)
-{
- return new DeclarativeColorDialogAttached(parent);
-}
-
-CUSTOM_METAOBJECT(DeclarativeColorDialog, QColorDialog)
-
-// DeclarativeColumnView
-DeclarativeColumnView::DeclarativeColumnView(QObject *parent) : DeclarativeWidgetProxy<ColumnView>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeColumnView, ColumnView)
-
-// DeclarativeCommandLinkButton
-DeclarativeCommandLinkButton::DeclarativeCommandLinkButton(QObject *parent) : DeclarativeWidgetProxy<QCommandLinkButton>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeCommandLinkButton, QCommandLinkButton)
-
-// DeclarativeDateEdit
-DeclarativeDateEdit::DeclarativeDateEdit(QObject *parent) : DeclarativeWidgetProxy<QDateEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDateEdit, QDateEdit)
-
-// DeclarativeDateTimeEdit
-DeclarativeDateTimeEdit::DeclarativeDateTimeEdit(QObject *parent) : DeclarativeWidgetProxy<QDateTimeEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDateTimeEdit, QDateTimeEdit)
-
-// DeclarativeDial
-DeclarativeDial::DeclarativeDial(QObject *parent) : DeclarativeWidgetProxy<QDial>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDial, QDial)
-
-// DeclarativeDialog
-DeclarativeDialog::DeclarativeDialog(QObject *parent) : DeclarativeWidgetProxy<QDialog>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDialog, QDialog)
-
-// DeclarativeDialogButtonBox
-DeclarativeDialogButtonBox::DeclarativeDialogButtonBox(QObject *parent) : DeclarativeWidgetProxy<QDialogButtonBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDialogButtonBox, QDialogButtonBox)
-
-// DeclarativeDoubleSpinBox
-DeclarativeDoubleSpinBox::DeclarativeDoubleSpinBox(QObject *parent) : DeclarativeWidgetProxy<QDoubleSpinBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeDoubleSpinBox, QDoubleSpinBox)
-
-// DeclarativeFileDialog
-class DeclarativeFileDialogAttached::Private
-{
- public:
- QPointer<QObject> dialogParent;
- QString caption;
- QString dir;
- QStringList nameFilters;
- QString selectedFilter;
-};
-
-DeclarativeFileDialogAttached::DeclarativeFileDialogAttached(QObject *parent)
- : QObject(parent), d(new Private)
-{
-}
-
-DeclarativeFileDialogAttached::~DeclarativeFileDialogAttached()
-{
- delete d;
-}
-
-void DeclarativeFileDialogAttached::setDialogParent(QObject *parent)
-{
- if (parent == d->dialogParent)
- return;
-
- d->dialogParent = parent;
- emit dialogParentChanged(parent);
-}
-
-QObject *DeclarativeFileDialogAttached::dialogParent() const
-{
- return d->dialogParent;
-}
-
-void DeclarativeFileDialogAttached::setCaption(const QString &caption)
-{
- if (caption == d->caption)
- return;
-
- d->caption = caption;
- emit captionChanged(caption);
-}
-
-QString DeclarativeFileDialogAttached::caption() const
-{
- return d->caption;
-}
-
-void DeclarativeFileDialogAttached::setDir(const QString &dir)
-{
- if (dir == d->dir)
- return;
-
- d->dir = dir;
- emit dirChanged(dir);
-}
-
-QString DeclarativeFileDialogAttached::dir() const
-{
- return d->dir;
-}
-
-void DeclarativeFileDialogAttached::setNameFilters(const QStringList &nameFilters)
-{
- if (nameFilters == d->nameFilters)
- return;
-
- d->nameFilters = nameFilters;
- emit nameFiltersChanged(nameFilters);
-}
-
-QStringList DeclarativeFileDialogAttached::nameFilters() const
-{
- return d->nameFilters;
-}
-
-QString DeclarativeFileDialogAttached::selectedFilter() const
-{
- return d->selectedFilter;
-}
-
-QString DeclarativeFileDialogAttached::getExistingDirectory()
-{
- return QFileDialog::getExistingDirectory(bestParentWindow(d->dialogParent), d->caption, d->dir, QFileDialog::ShowDirsOnly);
-}
-
-QString DeclarativeFileDialogAttached::getOpenFileName()
-{
- QString selectedFilter;
- const QString retVal = QFileDialog::getOpenFileName(bestParentWindow(d->dialogParent), d->caption, d->dir,
- d->nameFilters.join(";;"), &selectedFilter, 0);
- setSelectedFilter(selectedFilter);
- return retVal;
-}
-
-QStringList DeclarativeFileDialogAttached::getOpenFileNames()
-{
- QString selectedFilter;
- const QStringList retVal = QFileDialog::getOpenFileNames(bestParentWindow(d->dialogParent), d->caption, d->dir,
- d->nameFilters.join(";;"), &selectedFilter, 0);
- setSelectedFilter(selectedFilter);
- return retVal;
-}
-
-QString DeclarativeFileDialogAttached::getSaveFileName()
-{
- QString selectedFilter;
- const QString retVal = QFileDialog::getSaveFileName(bestParentWindow(d->dialogParent), d->caption, d->dir,
- d->nameFilters.join(";;"), &selectedFilter, 0);
- setSelectedFilter(selectedFilter);
- return retVal;
-}
-
-QWidget *DeclarativeFileDialogAttached::bestParentWindow(QObject *parent) const
-{
- if (!parent)
- parent = this->parent();
-
- // if parent is a Declarative Object, search the proxied hierarchy
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject)
- parent = declarativeObject->object();
-
- while (parent) {
- QWidget *widget = qobject_cast<QWidget*>(parent);
- if (widget)
- return widget->topLevelWidget();
-
- parent = parent->parent();
- }
-
- return 0;
-}
-
-void DeclarativeFileDialogAttached::setSelectedFilter(const QString &filter)
-{
- if (filter == d->selectedFilter)
- return;
-
- d->selectedFilter = filter;
- emit selectedFilterChanged(filter);
-}
-
-DeclarativeFileDialog::DeclarativeFileDialog(QObject *parent) : DeclarativeWidgetProxy<FileDialog>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeFileDialogAttached *DeclarativeFileDialog::qmlAttachedProperties(QObject *parent)
-{
- return new DeclarativeFileDialogAttached(parent);
-}
-
-CUSTOM_METAOBJECT(DeclarativeFileDialog, FileDialog)
-
-// DeclarativeFontDialog
-DeclarativeFontDialog::DeclarativeFontDialog(QObject *parent) : DeclarativeWidgetProxy<QFontDialog>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeFontDialog, QFontDialog)
-
-// DeclarativeFrame
-DeclarativeFrame::DeclarativeFrame(QObject *parent) : DeclarativeWidgetProxy<QFrame>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeFrame, QFrame)
-
-// DeclarativeGroupBox
-DeclarativeGroupBox::DeclarativeGroupBox(QObject *parent) : DeclarativeWidgetProxy<QGroupBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeGroupBox, QGroupBox)
-
-// DeclarativeInputDialog
-class DeclarativeInputDialogAttached::Private
-{
- public:
- Private() : dialogAccepted(false),
- value(0), min(-2147483647), max(2147483647), decimals(1), step(1),
- currentItem(0), itemsEditable(true),
- echoMode(QLineEdit::Normal)
- {}
-
- public:
- QPointer<QObject> dialogParent;
- QString title;
- QString label;
- bool dialogAccepted;
-
- QVariant value;
- QVariant min;
- QVariant max;
- int decimals;
- int step;
-
- int currentItem;
- bool itemsEditable;
-
- QLineEdit::EchoMode echoMode;
- QString text;
-};
-
-DeclarativeInputDialogAttached::DeclarativeInputDialogAttached(QObject *parent)
- : QObject(parent), d(new Private)
-{
-}
-
-DeclarativeInputDialogAttached::~DeclarativeInputDialogAttached()
-{
- delete d;
-}
-
-void DeclarativeInputDialogAttached::setDialogParent(QObject *parent)
-{
- if (parent == d->dialogParent)
- return;
-
- d->dialogParent = parent;
- emit dialogParentChanged(parent);
-}
-
-QObject *DeclarativeInputDialogAttached::dialogParent() const
-{
- return d->dialogParent;
-}
-
-void DeclarativeInputDialogAttached::setTitle(const QString &title)
-{
- if (title == d->title)
- return;
-
- d->title = title;
- emit titleChanged(title);
-}
-
-QString DeclarativeInputDialogAttached::title() const
-{
- return d->title;
-}
-
-void DeclarativeInputDialogAttached::setLabel(const QString &label)
-{
- if (label == d->label)
- return;
-
- d->label = label;
- emit labelChanged(label);
-}
-
-QString DeclarativeInputDialogAttached::label() const
-{
- return d->label;
-}
-
-bool DeclarativeInputDialogAttached::dialogAccepted() const
-{
- return d->dialogAccepted;
-}
-
-void DeclarativeInputDialogAttached::setValue(const QVariant &value)
-{
- if (value == d->value)
- return;
-
- d->value = value;
- emit valueChanged(value);
-}
-
-QVariant DeclarativeInputDialogAttached::value() const
-{
- return d->value;
-}
-
-void DeclarativeInputDialogAttached::setMin(const QVariant &min)
-{
- if (min == d->min)
- return;
-
- d->min = min;
- emit minChanged(min);
-}
-
-QVariant DeclarativeInputDialogAttached::min() const
-{
- return d->min;
-}
-
-void DeclarativeInputDialogAttached::setMax(const QVariant &max)
-{
- if (max == d->max)
- return;
-
- d->max = max;
- emit maxChanged(max);
-}
-
-QVariant DeclarativeInputDialogAttached::max() const
-{
- return d->max;
-}
-
-void DeclarativeInputDialogAttached::setDecimals(int decimals)
-{
- if (decimals == d->decimals)
- return;
-
- d->decimals = decimals;
- emit decimalsChanged(decimals);
-}
-
-int DeclarativeInputDialogAttached::decimals() const
-{
- return d->decimals;
-}
-
-void DeclarativeInputDialogAttached::setStep(int step)
-{
- if (step == d->step)
- return;
-
- d->step = step;
- emit stepChanged(step);
-}
-
-int DeclarativeInputDialogAttached::step() const
-{
- return d->step;
-}
-
-void DeclarativeInputDialogAttached::setCurrentItem(int current)
-{
- if (current == d->currentItem)
- return;
-
- d->currentItem = current;
- emit currentItemChanged(current);
-}
-
-int DeclarativeInputDialogAttached::currentItem() const
-{
- return d->currentItem;
-}
-
-void DeclarativeInputDialogAttached::setItemsEditable(bool editable)
-{
- if (editable == d->itemsEditable)
- return;
-
- d->itemsEditable = editable;
- emit itemsEditableChanged(editable);
-}
-
-bool DeclarativeInputDialogAttached::itemsEditable() const
-{
- return d->itemsEditable;
-}
-
-void DeclarativeInputDialogAttached::setEchoMode(QLineEdit::EchoMode echoMode)
-{
- if (echoMode == d->echoMode)
- return;
-
- d->echoMode = echoMode;
- emit echoModeChanged(echoMode);
-}
-
-QLineEdit::EchoMode DeclarativeInputDialogAttached::echoMode() const
-{
- return d->echoMode;
-}
-
-void DeclarativeInputDialogAttached::setText(const QString &text)
-{
- if (text == d->text)
- return;
-
- d->text = text;
- emit textChanged(text);
-}
-
-QString DeclarativeInputDialogAttached::text() const
-{
- return d->text;
-}
-
-double DeclarativeInputDialogAttached::getDouble()
-{
- QWidget *parent = bestParentWindow(d->dialogParent);
- bool ok = false;
- const double value = d->value.canConvert<double>() ? d->value.value<double>() : 0.0;
- const double min = d->min.canConvert<double>() ? d->min.value<double>() : -2147483647;
- const double max = d->max.canConvert<double>() ? d->max.value<double>() : 2147483647;
-
- const double retVal = QInputDialog::getDouble(parent, d->title, d->label, value, min, max, d->decimals, &ok);
-
- setDialogAccepted(ok);
- return retVal;
-}
-
-int DeclarativeInputDialogAttached::getInt()
-{
- QWidget *parent = bestParentWindow(d->dialogParent);
- bool ok = false;
- const int value = d->value.canConvert<int>() ? d->value.value<int>() : 0;
- const int min = d->min.canConvert<int>() ? d->min.value<int>() : -2147483647;
- const int max = d->max.canConvert<int>() ? d->max.value<int>() : 2147483647;
-
- const int retVal = QInputDialog::getInt(parent, d->title, d->label, value, min, max, d->step, &ok);
-
- setDialogAccepted(ok);
- return retVal;
-}
-
-QString DeclarativeInputDialogAttached::getItem(const QStringList &items)
-{
- QWidget *parent = bestParentWindow(d->dialogParent);
- bool ok = false;
-
- const QString retVal = QInputDialog::getItem(parent, d->title, d->label, items, d->currentItem, d->itemsEditable, &ok);
-
- setDialogAccepted(ok);
- return retVal;
-}
-
-QString DeclarativeInputDialogAttached::getText()
-{
- QWidget *parent = bestParentWindow(d->dialogParent);
- bool ok = false;
-
- const QString retVal = QInputDialog::getText(parent, d->title, d->label, d->echoMode, d->text, &ok);
-
- setDialogAccepted(ok);
- return retVal;
-}
-
-void DeclarativeInputDialogAttached::setDialogAccepted(bool accepted)
-{
- if (accepted == d->dialogAccepted)
- return;
-
- d->dialogAccepted = accepted;
- emit dialogAcceptedChanged(accepted);
-}
-
-QWidget *DeclarativeInputDialogAttached::bestParentWindow(QObject *parent) const
-{
- if (!parent)
- parent = this->parent();
-
- // if parent is a Declarative Object, search the proxied hierarchy
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject)
- parent = declarativeObject->object();
-
- while (parent) {
- QWidget *widget = qobject_cast<QWidget*>(parent);
- if (widget)
- return widget->topLevelWidget();
-
- parent = parent->parent();
- }
-
- return 0;
-}
-
-DeclarativeInputDialog::DeclarativeInputDialog(QObject *parent) : DeclarativeWidgetProxy<InputDialog>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeInputDialogAttached *DeclarativeInputDialog::qmlAttachedProperties(QObject *parent)
-{
- return new DeclarativeInputDialogAttached(parent);
-}
-
-CUSTOM_METAOBJECT(DeclarativeInputDialog, InputDialog)
-
-// DeclarativeLabel
-DeclarativeLabel::DeclarativeLabel(QObject *parent) : DeclarativeWidgetProxy<QLabel>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeLabel, QLabel)
-
-// DeclarativeLCDNumber
-DeclarativeLCDNumber::DeclarativeLCDNumber(QObject *parent) : DeclarativeWidgetProxy<QLCDNumber>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeLCDNumber, QLCDNumber)
-
-// DeclarativeLineEdit
-DeclarativeLineEdit::DeclarativeLineEdit(QObject *parent) : DeclarativeWidgetProxy<QLineEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeLineEdit, QLineEdit)
-
-// DeclarativeListView
-DeclarativeListView::DeclarativeListView(QObject *parent) : DeclarativeWidgetProxy<ListView>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeListView, ListView)
-
-// DeclarativeMainWindow
-DeclarativeMainWindow::DeclarativeMainWindow(QObject *parent) : DeclarativeWidgetProxy<QMainWindow>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeMainWindow::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- QMenuBar *menuBar = qobject_cast<QMenuBar*>(widget);
- QToolBar *toolBar = qobject_cast<QToolBar*>(widget);
- QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget);
- QDialog *dialog = qobject_cast<QDialog*>(widget);
-
- if (menuBar) {
- m_proxiedObject->setMenuBar(menuBar);
- } else if (toolBar) {
- m_proxiedObject->addToolBar(toolBar);
- } else if (statusBar) {
- m_proxiedObject->setStatusBar(statusBar);
- } else if (dialog) {
- // We allow to place dialogs on the mainwindow
- dialog->setParent(m_proxiedObject, dialog->windowFlags());
- } else if (widget) {
- if (m_proxiedObject->centralWidget()) {
- qmlInfo(declarativeObject) << "The QMainWindow contains a central widget already";
- return;
- }
-
- m_proxiedObject->setCentralWidget(widget);
- }
-
- m_children.append(declarativeObject);
-}
-
-void DeclarativeMainWindow::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not set a QLayout to a QMainWindow";
-}
-
-CUSTOM_METAOBJECT(DeclarativeMainWindow, QMainWindow)
-
-// DeclarativeMenu
-DeclarativeMenu::DeclarativeMenu(QObject *parent) : DeclarativeWidgetProxy<QMenu>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeMenu::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- QMenu *menu = qobject_cast<QMenu*>(widget);
- if (!menu) {
- qmlInfo(declarativeObject) << "The QMenu can only contain QMenu, QAction or Separator";
- return;
- }
-
- m_proxiedObject->addMenu(menu);
-
- m_children.append(declarativeObject);
-}
-
-void DeclarativeMenu::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not set a QLayout to a QMenu";
-}
-
-void DeclarativeMenu::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
-{
- DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
-
- if (separator) {
- m_proxiedObject->addSeparator();
- } else {
- m_proxiedObject->addAction(action);
- }
-
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeMenu, QMenu)
-
-// DeclarativeMenuBar
-DeclarativeMenuBar::DeclarativeMenuBar(QObject *parent) : DeclarativeWidgetProxy<QMenuBar>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeMenuBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- QMenu *menu = qobject_cast<QMenu*>(widget);
- if (!menu) {
- qmlInfo(declarativeObject) << "The QMenuBar can only contain QMenus";
- return;
- }
-
- m_proxiedObject->addMenu(menu);
-
- m_children.append(declarativeObject);
-}
-
-void DeclarativeMenuBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not set a QLayout to a QMenuBar";
-}
-
-void DeclarativeMenuBar::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(action)
-
- DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
-
- if (separator) {
- m_proxiedObject->addSeparator();
- }
-
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeMenuBar, QMenuBar)
-
-// DeclarativeMessageBox
-DeclarativeMessageBoxAttached::DeclarativeMessageBoxAttached(QObject *parent) : QObject(parent)
-{
-}
-
-void DeclarativeMessageBoxAttached::about(QObject *parent, const QString &title, const QString &text)
-{
- QMessageBox::about(bestParentWindow(parent), title, text);
-}
-
-void DeclarativeMessageBoxAttached::aboutQt(QObject *parent, const QString &title)
-{
- QMessageBox::aboutQt(bestParentWindow(parent), title);
-}
-
-int DeclarativeMessageBoxAttached::critical(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
-{
- return QMessageBox::critical(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
-}
-
-int DeclarativeMessageBoxAttached::information(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
-{
- return QMessageBox::information(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
-}
-
-int DeclarativeMessageBoxAttached::question(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
-{
- return QMessageBox::question(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
-}
-
-int DeclarativeMessageBoxAttached::warning(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
-{
- return QMessageBox::warning(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
-}
-
-QWidget *DeclarativeMessageBoxAttached::bestParentWindow(QObject *parent) const
-{
- if (!parent)
- parent = this->parent();
-
- // if parent is a Declarative Object, search the proxied hierarchy
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
- if (declarativeObject)
- parent = declarativeObject->object();
-
- while (parent) {
- QWidget *widget = qobject_cast<QWidget*>(parent);
- if (widget)
- return widget->topLevelWidget();
-
- parent = parent->parent();
- }
-
- return 0;
-}
-
-DeclarativeMessageBox::DeclarativeMessageBox(QObject *parent) : DeclarativeObjectProxy<QMessageBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-DeclarativeMessageBoxAttached *DeclarativeMessageBox::qmlAttachedProperties(QObject *parent)
-{
- return new DeclarativeMessageBoxAttached(parent);
-}
-
-CUSTOM_METAOBJECT(DeclarativeMessageBox, QMessageBox)
-
-// DeclarativePlainTextEdit
-DeclarativePlainTextEdit::DeclarativePlainTextEdit(QObject *parent) : DeclarativeWidgetProxy<QPlainTextEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativePlainTextEdit, QPlainTextEdit)
-
-// DeclarativeProgressBar
-DeclarativeProgressBar::DeclarativeProgressBar(QObject *parent) : DeclarativeWidgetProxy<QProgressBar>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeProgressBar, QProgressBar)
-
-// DeclarativePushButton
-DeclarativePushButton::DeclarativePushButton(QObject *parent) : DeclarativeWidgetProxy<QPushButton>(parent)
-{
- connectAllSignals(m_proxiedObject, this, QSet<QByteArray>() << "clicked()");
-}
-
-CUSTOM_METAOBJECT(DeclarativePushButton, QPushButton)
-
-// DeclarativeRadioButton
-DeclarativeRadioButton::DeclarativeRadioButton(QObject *parent) : DeclarativeWidgetProxy<QRadioButton>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeRadioButton, QRadioButton)
-
-// DeclarativeScrollArea
-DeclarativeScrollArea::DeclarativeScrollArea(QObject *parent) : DeclarativeWidgetProxy<QScrollArea>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeScrollArea::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- if (m_proxiedObject->widget()) {
- qmlInfo(declarativeObject) << "Can not add multiple Widgets to ScrollArea";
- } else {
- m_proxiedObject->setWidget(widget);
- }
-
- m_children.append(declarativeObject);
-}
-
-void DeclarativeScrollArea::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not add Layout to ScrollArea";
-}
-
-CUSTOM_METAOBJECT(DeclarativeScrollArea, QScrollArea)
-
-// DeclarativeScrollBar
-DeclarativeScrollBar::DeclarativeScrollBar(QObject *parent) : DeclarativeWidgetProxy<QScrollBar>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeScrollBar, QScrollBar)
-
-// DeclarativeSlider
-DeclarativeSlider::DeclarativeSlider(QObject *parent) : DeclarativeWidgetProxy<QSlider>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeSlider, QSlider)
-
-// DeclarativeSpinBox
-DeclarativeSpinBox::DeclarativeSpinBox(QObject *parent) : DeclarativeWidgetProxy<QSpinBox>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeSpinBox, QSpinBox)
-
-// DeclarativeStackedWidget
-DeclarativeStackedWidget::DeclarativeStackedWidget(QObject *parent) : DeclarativeWidgetProxy<QStackedWidget>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeStackedWidget::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- m_proxiedObject->addWidget(widget);
- m_children.append(declarativeObject);
-}
-
-void DeclarativeStackedWidget::setLayout(QLayout*, AbstractDeclarativeObject *declarativeObject)
-{
- qmlInfo(declarativeObject) << "StackedWidget does not support child layouts";
-}
-
-CUSTOM_METAOBJECT(DeclarativeStackedWidget, QStackedWidget)
-
-// DeclarativeStatusBar
-class DeclarativeStatusBarAttached::Private
-{
- public:
- int stretch;
-};
-
-DeclarativeStatusBarAttached::DeclarativeStatusBarAttached(QObject *parent)
- : QObject(parent), d(new DeclarativeStatusBarAttached::Private)
-{
- d->stretch = 0;
-}
-
-DeclarativeStatusBarAttached::~DeclarativeStatusBarAttached()
-{
- delete d;
-}
-
-void DeclarativeStatusBarAttached::setStretch(int stretch)
-{
- if (d->stretch == stretch)
- return;
-
- d->stretch = stretch;
- emit stretchChanged();
-}
-
-int DeclarativeStatusBarAttached::stretch() const
-{
- return d->stretch;
-}
-
-DeclarativeStatusBar::DeclarativeStatusBar(QObject *parent) : DeclarativeWidgetProxy<QStatusBar>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeStatusBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- // TODO: error when layout is set
-
- m_children.append(declarativeObject);
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeStatusBar>(declarativeObject, false);
- DeclarativeStatusBarAttached *attached = qobject_cast<DeclarativeStatusBarAttached*>(attachedProperties);
-
- int stretch = 0;
- if (attached) {
- stretch = attached->stretch();
- }
-
- m_proxiedObject->addPermanentWidget(widget, stretch);
-}
-
-void DeclarativeStatusBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not add QLayout to QStatusBar";
-}
-
-DeclarativeStatusBarAttached *DeclarativeStatusBar::qmlAttachedProperties(QObject *object)
-{
- return new DeclarativeStatusBarAttached(object);
-}
-
-CUSTOM_METAOBJECT(DeclarativeStatusBar, QStatusBar)
-
-// DeclarativeTableView
-DeclarativeTableView::DeclarativeTableView(QObject *parent) : DeclarativeWidgetProxy<TableView>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTableView, TableView)
-
-// DeclarativeTabWidget
-class DeclarativeTabWidgetAttached::Private
-{
- public:
- QString label;
- QIcon icon;
- QPointer<QTabWidget> tabWidget;
- int index;
-};
-
-DeclarativeTabWidgetAttached::DeclarativeTabWidgetAttached(QObject *parent)
- : QObject(parent), d(new DeclarativeTabWidgetAttached::Private)
-{
-}
-
-DeclarativeTabWidgetAttached::~DeclarativeTabWidgetAttached()
-{
- delete d;
-}
-
-void DeclarativeTabWidgetAttached::setLabel(const QString &label)
-{
- if (label == d->label)
- return;
-
- d->label = label;
-
- if (d->tabWidget)
- d->tabWidget->setTabText(d->index, d->label);
-
- emit labelChanged(label);
-}
-
-QString DeclarativeTabWidgetAttached::label() const
-{
- return d->label;
-}
-
-void DeclarativeTabWidgetAttached::setIcon(const QIcon &icon)
-{
- d->icon = icon;
-
- if (d->tabWidget)
- d->tabWidget->setTabIcon(d->index, d->icon);
-
- emit iconChanged(icon);
-}
-
-QIcon DeclarativeTabWidgetAttached::icon() const
-{
- return d->icon;
-}
-
-void DeclarativeTabWidgetAttached::setAssociation(QTabWidget *widget, int index)
-{
- d->tabWidget = widget;
- d->index = index;
-}
-
-DeclarativeTabWidget::DeclarativeTabWidget(QObject *parent) : DeclarativeWidgetProxy<QTabWidget>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeTabWidget::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- // TODO: error when layout is set
-
- m_children.append(declarativeObject);
-
- QString label;
- QIcon icon;
-
- QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeTabWidget>(declarativeObject, false);
- DeclarativeTabWidgetAttached *tabHeader = qobject_cast<DeclarativeTabWidgetAttached*>(attachedProperties);
- if (tabHeader) {
- label = tabHeader->label();
- icon = tabHeader->icon();
- }
-
- const int index = m_proxiedObject->addTab(widget, icon, label);
- if (tabHeader)
- tabHeader->setAssociation(m_proxiedObject, index);
-}
-
-void DeclarativeTabWidget::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not add QLayout to QTabWidget";
-}
-
-DeclarativeTabWidgetAttached *DeclarativeTabWidget::qmlAttachedProperties(QObject *object)
-{
- return new DeclarativeTabWidgetAttached(object);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTabWidget, QTabWidget)
-
-// DeclarativeTextBrowser
-DeclarativeTextBrowser::DeclarativeTextBrowser(QObject *parent) : DeclarativeWidgetProxy<QTextBrowser>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTextBrowser, QTextBrowser)
-
-// DeclarativeTextEdit
-DeclarativeTextEdit::DeclarativeTextEdit(QObject *parent) : DeclarativeWidgetProxy<TextEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTextEdit, TextEdit)
-
-// DeclarativeTimeEdit
-DeclarativeTimeEdit::DeclarativeTimeEdit(QObject *parent) : DeclarativeWidgetProxy<QTimeEdit>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTimeEdit, QTimeEdit)
-
-// DeclarativeToolBar
-DeclarativeToolBar::DeclarativeToolBar(QObject *parent) : DeclarativeWidgetProxy<QToolBar>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-void DeclarativeToolBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
-{
- m_proxiedObject->addWidget(widget);
-
- m_children.append(declarativeObject);
-}
-
-void DeclarativeToolBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
-{
- Q_UNUSED(layout);
- Q_UNUSED(declarativeObject);
- qmlInfo(this) << "Can not set a QLayout to a QToolBar";
-}
-
-void DeclarativeToolBar::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
-{
- DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
-
- if (separator) {
- m_proxiedObject->addSeparator();
- } else {
- m_proxiedObject->addAction(action);
- }
-
- m_children.append(declarativeObject);
-}
-
-CUSTOM_METAOBJECT(DeclarativeToolBar, QToolBar)
-
-// DeclarativeToolButton
-DeclarativeToolButton::DeclarativeToolButton(QObject *parent) : DeclarativeWidgetProxy<QToolButton>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeToolButton, QToolButton)
-
-// DeclarativeTreeView
-DeclarativeTreeView::DeclarativeTreeView(QObject *parent) : DeclarativeWidgetProxy<TreeView>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTreeView, TreeView)
-
-// DeclarativeWebView
-DeclarativeWebView::DeclarativeWebView(QObject *parent) : DeclarativeWidgetProxy<QWebView>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeWebView, QWebView)
-
-// DeclarativeWidget
-DeclarativeWidget::DeclarativeWidget(QObject *parent) : DeclarativeWidgetProxy<QWidget>(parent)
-{
- connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeWidget, QWidget)
-
+++ /dev/null
-#ifndef DECLARATIVEOBJECTS_H
-#define DECLARATIVEOBJECTS_H
-
-#include "objectadaptors_p.h"
-
-#include <QtCore/QObject>
-#include <QtCore/QPointer>
-#include <QtGui/QAction>
-#include <QtGui/QCalendarWidget>
-#include <QtGui/QCheckBox>
-#include <QtGui/QColorDialog>
-#include <QtGui/QCommandLinkButton>
-#include <QtGui/QDateTimeEdit>
-#include <QtGui/QDial>
-#include <QtGui/QDialog>
-#include <QtGui/QDialogButtonBox>
-#include <QtGui/QFontDialog>
-#include <QtGui/QFormLayout>
-#include <QtGui/QGroupBox>
-#include <QtGui/QHBoxLayout>
-#include <QtGui/QLabel>
-#include <QtGui/QLCDNumber>
-#include <QtGui/QLineEdit>
-#include <QtGui/QMainWindow>
-#include <QtGui/QMenu>
-#include <QtGui/QMenuBar>
-#include <QtGui/QMessageBox>
-#include <QtGui/QPlainTextEdit>
-#include <QtGui/QProgressBar>
-#include <QtGui/QPushButton>
-#include <QtGui/QRadioButton>
-#include <QtGui/QScrollArea>
-#include <QtGui/QScrollBar>
-#include <QtGui/QSlider>
-#include <QtGui/QSpinBox>
-#include <QtGui/QStackedWidget>
-#include <QtGui/QStatusBar>
-#include <QtGui/QTabWidget>
-#include <QtGui/QTextBrowser>
-#include <QtGui/QToolBar>
-#include <QtGui/QToolButton>
-#include <QtGui/QVBoxLayout>
-#include <QtWebKit/QWebView>
-#include <QtDeclarative/QDeclarativeListProperty>
-#include <QtDeclarative/qdeclarativeinfo.h>
-#include <qdeclarative.h>
-
-#include "objectadaptors_p.h"
-
-Q_DECLARE_METATYPE(QAction*)
-
-#define DECLARATIVE_OBJECT \
- public: \
- Q_OBJECT_CHECK \
- static QMetaObject staticMetaObject; \
- static bool metaObjectInitialized; \
- static bool initializeMetaObject(); \
- static const QMetaObject &getStaticMetaObject(); \
- virtual const QMetaObject *metaObject() const; \
- virtual void *qt_metacast(const char *); \
- virtual int qt_metacall(QMetaObject::Call, int, void **); \
- private: \
-
-class AbstractDeclarativeObject : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
-
- Q_CLASSINFO("DefaultProperty", "data")
-
- public:
- AbstractDeclarativeObject(QObject *parent = 0);
- virtual ~AbstractDeclarativeObject();
-
- virtual QObject* object() const = 0;
-
- protected:
- virtual void dataAppend(QObject *);
- virtual int dataCount() const;
- virtual QObject *dataAt(int) const;
- virtual void dataClear();
-
- private:
- QDeclarativeListProperty<QObject> data();
-
- static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
- static int data_count(QDeclarativeListProperty<QObject> *);
- static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
- static void data_clear(QDeclarativeListProperty<QObject> *);
-};
-
-template <class T, bool needsParentInitialization = false>
-class DeclarativeObjectProxy : public AbstractDeclarativeObject
-{
-};
-
-template <class T>
-class DeclarativeObjectProxy<T, false> : public AbstractDeclarativeObject
-{
- public:
- DeclarativeObjectProxy(QObject *parent = 0) : AbstractDeclarativeObject(parent), m_proxiedObject(new T) {}
- ~DeclarativeObjectProxy() { delete m_proxiedObject; }
-
- virtual QObject *object() const { return m_proxiedObject.data(); }
-
- protected:
- virtual void dataAppend(QObject *object)
- {
- m_children.append(object);
- }
-
- virtual int dataCount() const { return m_children.count(); }
- virtual QObject *dataAt(int index) const { return m_children.at(index); }
- virtual void dataClear()
- {
- qDeleteAll(m_children);
- m_children.clear();
- }
-
- protected:
- QPointer<T> m_proxiedObject;
- QVector<QObject*> m_children;
-};
-
-template <class T>
-class DeclarativeObjectProxy<T, true> : public AbstractDeclarativeObject
-{
- public:
- DeclarativeObjectProxy(QObject *parent = 0) : AbstractDeclarativeObject(parent), m_proxiedObject(new T(0)) {}
- ~DeclarativeObjectProxy() { delete m_proxiedObject; }
-
- virtual QObject *object() const { return m_proxiedObject.data(); }
-
- protected:
- virtual void dataAppend(QObject *object)
- {
- m_children.append(object);
- }
-
- virtual int dataCount() const { return m_children.count(); }
- virtual QObject *dataAt(int index) const { return m_children.at(index); }
- virtual void dataClear()
- {
- qDeleteAll(m_children);
- m_children.clear();
- }
-
- protected:
- QPointer<T> m_proxiedObject;
- QVector<QObject*> m_children;
-};
-
-class DeclarativeActionItem : public DeclarativeObjectProxy<ActionItem>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeActionItem(QObject *parent = 0);
-};
-
-template <class T>
-class DeclarativeWidgetProxy : public DeclarativeObjectProxy<T>
-{
- public:
- DeclarativeWidgetProxy(QObject *parent = 0) : DeclarativeObjectProxy<T>(parent) {}
-
- protected:
- virtual void dataAppend(QObject *object)
- {
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(object);
- if (declarativeObject) {
- QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
- if (widget) {
- addWidget(widget, declarativeObject);
- return;
- }
-
- QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
- if (layout) {
- // TODO: error when widget is set
-
- if (DeclarativeObjectProxy<T>::m_proxiedObject->layout()) {
- qmlInfo(this) << "Can not add a second Layout";
- return;
- }
-
- setLayout(layout, declarativeObject);
- return;
- }
-
- DeclarativeActionItem *declarativeActionItem = dynamic_cast<DeclarativeActionItem*>(object);
- if (declarativeActionItem) {
- addAction(qobject_cast<ActionItem*>(declarativeActionItem->object())->action(), declarativeObject);
- return;
- }
-
- QAction *action = qobject_cast<QAction*>(declarativeObject->object());
- if (action) {
- addAction(action, declarativeObject);
- return;
- }
-
- addQObject(declarativeObject->object(), declarativeObject);
- return;
- }
-
- DeclarativeObjectProxy<T>::dataAppend(object);
- }
-
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
- {
- Q_UNUSED(declarativeObject);
- DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
- widget->setParent(DeclarativeObjectProxy<T>::m_proxiedObject, widget->windowFlags());
- }
-
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
- {
- DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
- DeclarativeObjectProxy<T>::m_proxiedObject->setLayout(layout);
- }
-
- virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
- {
- DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
- DeclarativeObjectProxy<T>::m_proxiedObject->addAction(action);
- }
-
- virtual void addQObject(QObject *object, AbstractDeclarativeObject *declarativeObject)
- {
- object->setParent(DeclarativeObjectProxy<T>::m_proxiedObject);
- DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
- }
-};
-
-template <class T>
-class DeclarativeLayoutProxy : public DeclarativeObjectProxy<T>
-{
- public:
- DeclarativeLayoutProxy(QObject *parent = 0) : DeclarativeObjectProxy<T>(parent) {}
-
- protected:
- virtual void dataAppend(QObject *object)
- {
- AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(object);
- if (declarativeObject) {
- QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
- if (widget) {
- addWidget(widget, declarativeObject);
- return;
- }
-
- QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
- if (layout) {
- addLayout(layout, declarativeObject);
- return;
- }
- }
-
- DeclarativeObjectProxy<T>::dataAppend(object);
- }
-
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
- {
- DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
- DeclarativeObjectProxy<T>::m_proxiedObject->addWidget(widget);
- }
-
- virtual void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject) = 0;
-};
-
-//// Objects ///
-class DeclarativeAction : public DeclarativeObjectProxy<QAction, true>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeAction(QObject *parent = 0);
-};
-Q_DECLARE_METATYPE(DeclarativeAction*)
-
-class DeclarativeButtonGroup : public DeclarativeObjectProxy<ButtonGroup>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeButtonGroup(QObject *parent = 0);
-};
-
-class DeclarativeSeparator : public DeclarativeObjectProxy<QAction, true>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeSeparator(QObject *parent = 0);
-};
-
-//// Layouts ////
-class DeclarativeBoxLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int stretch READ stretch WRITE setStretch NOTIFY stretchChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
-
- public:
- DeclarativeBoxLayoutAttached(QWidget *widget, QObject *parent);
- DeclarativeBoxLayoutAttached(QLayout *layout, QObject *parent);
- ~DeclarativeBoxLayoutAttached();
-
- void setParentLayout(QBoxLayout *parentLayout);
-
- void setStretch(int stretch);
- int stretch() const;
-
- void setAlignment(Qt::Alignment alignment);
- Qt::Alignment alignment() const;
-
- Q_INVOKABLE QString foo() const { qDebug() << Q_FUNC_INFO; return "foo"; }
-
- Q_SIGNALS:
- void stretchChanged(int stretch);
- void alignmentChanged(Qt::Alignment alignment);
-
- private:
- class Private;
- Private *const d;
-};
-
-class DeclarativeFormLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
-
- public:
- DeclarativeFormLayoutAttached(QObject *parent);
- ~DeclarativeFormLayoutAttached();
-
- void setLabel(const QString &label);
- QString label() const;
-
- Q_SIGNALS:
- void labelChanged(const QString &label);
-
- private:
- class Private;
- Private *const d;
-};
-
-class DeclarativeGridLayoutAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged)
- Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged)
- Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan NOTIFY rowSpanChanged)
- Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan NOTIFY columnSpanChanged)
- Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
-
- public:
- DeclarativeGridLayoutAttached(QWidget *widget, QObject *parent);
- DeclarativeGridLayoutAttached(QLayout *layout, QObject *parent);
- ~DeclarativeGridLayoutAttached();
-
- void setParentLayout(QGridLayout *parentLayout);
-
- void setRow(int row);
- int row() const;
-
- void setColumn(int column);
- int column() const;
-
- void setRowSpan(int rowSpan);
- int rowSpan() const;
-
- void setColumnSpan(int columnSpan);
- int columnSpan() const;
-
- void setAlignment(Qt::Alignment alignment);
- Qt::Alignment alignment() const;
-
- Q_SIGNALS:
- void rowChanged(int row);
- void columnChanged(int column);
- void rowSpanChanged(int rowSpan);
- void columnSpanChanged(int columnSpan);
- void alignmentChanged(Qt::Alignment alignment);
-
- private:
- class Private;
- Private *const d;
-};
-
-class DeclarativeFormLayout : public DeclarativeLayoutProxy<QFormLayout>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeFormLayout(QObject *parent = 0);
-
- static DeclarativeFormLayoutAttached *qmlAttachedProperties(QObject *parent);
-
- protected:
- void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeFormLayout, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeGridLayout : public DeclarativeLayoutProxy<QGridLayout>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeGridLayout(QObject *parent = 0);
-
- static DeclarativeGridLayoutAttached *qmlAttachedProperties(QObject *parent);
-
- protected:
- void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeGridLayout, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeHBoxLayout : public DeclarativeLayoutProxy<QHBoxLayout>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeHBoxLayout(QObject *parent = 0);
-
- static DeclarativeBoxLayoutAttached *qmlAttachedProperties(QObject *parent);
-
- protected:
- void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-
-QML_DECLARE_TYPEINFO(DeclarativeHBoxLayout, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeStackedLayout : public DeclarativeLayoutProxy<StackedLayout>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeStackedLayout(QObject *parent = 0);
-
- protected:
- void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeVBoxLayout : public DeclarativeLayoutProxy<QVBoxLayout>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeVBoxLayout(QObject *parent = 0);
-
- static DeclarativeBoxLayoutAttached *qmlAttachedProperties(QObject *parent);
-
- protected:
- void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeVBoxLayout, QML_HAS_ATTACHED_PROPERTIES)
-
-//// Widgets ////
-class DeclarativeCalendarWidget : public DeclarativeWidgetProxy<QCalendarWidget>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeCalendarWidget(QObject *parent = 0);
-};
-
-class DeclarativeCheckBox : public DeclarativeWidgetProxy<QCheckBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeCheckBox(QObject *parent = 0);
-};
-
-class DeclarativeColorDialogAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
- Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
- // TODO option
-
- public:
- DeclarativeColorDialogAttached(QObject *parent = 0);
- ~DeclarativeColorDialogAttached();
-
- void setDialogParent(QObject *parent);
- QObject *dialogParent() const;
-
- void setTitle(const QString &title);
- QString title() const;
-
- Q_INVOKABLE QColor getColor(const QColor &initialColor);
-
- Q_SIGNALS:
- void dialogParentChanged(QObject *parent);
- void titleChanged(const QString &title);
-
- private:
- QWidget *bestParentWindow(QObject *parent) const;
-
- class Private;
- Private *const d;
-};
-
-class DeclarativeColorDialog : public DeclarativeWidgetProxy<QColorDialog>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeColorDialog(QObject *parent = 0);
-
- static DeclarativeColorDialogAttached *qmlAttachedProperties(QObject *parent);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeColorDialog, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeColumnView : public DeclarativeWidgetProxy<ColumnView>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeColumnView(QObject *parent = 0);
-};
-
-class DeclarativeCommandLinkButton : public DeclarativeWidgetProxy<QCommandLinkButton>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeCommandLinkButton(QObject *parent = 0);
-};
-
-class DeclarativeDateEdit : public DeclarativeWidgetProxy<QDateEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDateEdit(QObject *parent = 0);
-};
-
-class DeclarativeDateTimeEdit : public DeclarativeWidgetProxy<QDateTimeEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDateTimeEdit(QObject *parent = 0);
-};
-
-class DeclarativeDial : public DeclarativeWidgetProxy<QDial>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDial(QObject *parent = 0);
-};
-
-class DeclarativeDialog : public DeclarativeWidgetProxy<QDialog>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDialog(QObject *parent = 0);
-};
-
-class DeclarativeDialogButtonBox : public DeclarativeWidgetProxy<QDialogButtonBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDialogButtonBox(QObject *parent = 0);
-};
-
-class DeclarativeDoubleSpinBox : public DeclarativeWidgetProxy<QDoubleSpinBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeDoubleSpinBox(QObject *parent = 0);
-};
-
-class DeclarativeFileDialogAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
- Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged)
- Q_PROPERTY(QString dir READ dir WRITE setDir NOTIFY dirChanged)
- Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
- // TODO dialog option
- Q_PROPERTY(QString selectedFilter READ selectedFilter NOTIFY selectedFilterChanged)
-
- public:
- DeclarativeFileDialogAttached(QObject *parent = 0);
- ~DeclarativeFileDialogAttached();
-
- void setDialogParent(QObject *parent);
- QObject *dialogParent() const;
-
- void setCaption(const QString &caption);
- QString caption() const;
-
- void setDir(const QString &dir);
- QString dir() const;
-
- void setNameFilters(const QStringList &nameFilters);
- QStringList nameFilters() const;
-
- QString selectedFilter() const;
-
- Q_INVOKABLE QString getExistingDirectory();
-
- Q_INVOKABLE QString getOpenFileName();
-
- Q_INVOKABLE QStringList getOpenFileNames();
-
- Q_INVOKABLE QString getSaveFileName();
-
- Q_SIGNALS:
- void dialogParentChanged(QObject *parent);
- void captionChanged(const QString &caption);
- void dirChanged(const QString &dir);
- void nameFiltersChanged(const QStringList &filters);
- void selectedFilterChanged(const QString &filter);
-
- private:
- QWidget *bestParentWindow(QObject *parent) const;
- void setSelectedFilter(const QString &filter);
-
- class Private;
- Private *const d;
-};
-
-class DeclarativeFileDialog : public DeclarativeWidgetProxy<FileDialog>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeFileDialog(QObject *parent = 0);
-
- static DeclarativeFileDialogAttached *qmlAttachedProperties(QObject *parent);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeFileDialog, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeFontDialog : public DeclarativeWidgetProxy<QFontDialog>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeFontDialog(QObject *parent = 0);
-};
-
-class DeclarativeFrame : public DeclarativeWidgetProxy<QFrame>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeFrame(QObject *parent = 0);
-};
-
-class DeclarativeGroupBox : public DeclarativeWidgetProxy<QGroupBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeGroupBox(QObject *parent = 0);
-};
-
-class DeclarativeInputDialogAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
- Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
- Q_PROPERTY(bool ok READ dialogAccepted NOTIFY dialogAcceptedChanged)
-
- Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
- Q_PROPERTY(QVariant min READ min WRITE setMin NOTIFY minChanged)
- Q_PROPERTY(QVariant max READ max WRITE setMax NOTIFY maxChanged)
- Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
- Q_PROPERTY(int step READ step WRITE setStep NOTIFY stepChanged)
-
- Q_PROPERTY(int current READ currentItem WRITE setCurrentItem NOTIFY currentItemChanged)
- Q_PROPERTY(bool editable READ itemsEditable WRITE setItemsEditable NOTIFY itemsEditableChanged)
-
- Q_PROPERTY(QLineEdit::EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
- Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
-
- public:
- DeclarativeInputDialogAttached(QObject *parent = 0);
- ~DeclarativeInputDialogAttached();
-
- void setDialogParent(QObject *parent);
- QObject *dialogParent() const;
-
- void setTitle(const QString &title);
- QString title() const;
-
- void setLabel(const QString &label);
- QString label() const;
-
- bool dialogAccepted() const;
-
- void setValue(const QVariant &value);
- QVariant value() const;
-
- void setMin(const QVariant &min);
- QVariant min() const;
-
- void setMax(const QVariant &max);
- QVariant max() const;
-
- void setDecimals(int decimals);
- int decimals() const;
-
- void setStep(int step);
- int step() const;
-
- void setCurrentItem(int current);
- int currentItem() const;
-
- void setItemsEditable(bool editable);
- bool itemsEditable() const;
-
- void setEchoMode(QLineEdit::EchoMode echoMode);
- QLineEdit::EchoMode echoMode() const;
-
- void setText(const QString &text);
- QString text() const;
-
- Q_INVOKABLE double getDouble();
-
- Q_INVOKABLE int getInt();
-
- Q_INVOKABLE QString getItem(const QStringList &items);
-
- Q_INVOKABLE QString getText();
-
- Q_SIGNALS:
- void dialogParentChanged(QObject *parent);
- void titleChanged(const QString &title);
- void labelChanged(const QString &label);
- void dialogAcceptedChanged(bool accepted);
-
- void valueChanged(const QVariant &value);
- void minChanged(const QVariant &min);
- void maxChanged(const QVariant &max);
- void decimalsChanged(int decimals);
- void stepChanged(int step);
-
- void currentItemChanged(int current);
- void itemsEditableChanged(bool editable);
-
- void echoModeChanged(QLineEdit::EchoMode echoMode);
- void textChanged(const QString &text);
-
- private:
- void setDialogAccepted(bool accepted);
- QWidget *bestParentWindow(QObject *parent) const;
-
- class Private;
- Private *const d;
-};
-
-class DeclarativeInputDialog : public DeclarativeWidgetProxy<InputDialog>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeInputDialog(QObject *parent = 0);
-
- static DeclarativeInputDialogAttached *qmlAttachedProperties(QObject *parent);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeInputDialog, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeLabel : public DeclarativeWidgetProxy<QLabel>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeLabel(QObject *parent = 0);
-};
-
-class DeclarativeLCDNumber : public DeclarativeWidgetProxy<QLCDNumber>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeLCDNumber(QObject *parent = 0);
-};
-
-class DeclarativeLineEdit : public DeclarativeWidgetProxy<QLineEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeLineEdit(QObject *parent = 0);
-};
-
-class DeclarativeListView : public DeclarativeWidgetProxy<ListView>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeListView(QObject *parent = 0);
-};
-
-class DeclarativeMainWindow : public DeclarativeWidgetProxy<QMainWindow>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeMainWindow(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeMenu : public DeclarativeWidgetProxy<QMenu>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeMenu(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
- virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeMenuBar : public DeclarativeWidgetProxy<QMenuBar>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeMenuBar(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
- virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeMessageBoxAttached : public QObject
-{
- Q_OBJECT
-
- public:
- DeclarativeMessageBoxAttached(QObject *parent = 0);
-
- Q_INVOKABLE void about(QObject *parent, const QString &title, const QString &text);
- Q_INVOKABLE void aboutQt(QObject *parent, const QString &title);
- Q_INVOKABLE int critical(QObject *parent, const QString &title, const QString &text,
- int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
- Q_INVOKABLE int information(QObject *parent, const QString &title, const QString &text,
- int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
- Q_INVOKABLE int question(QObject *parent, const QString &title, const QString &text,
- int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
- Q_INVOKABLE int warning(QObject *parent, const QString &title, const QString &text,
- int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
-
- private:
- QWidget *bestParentWindow(QObject *parent) const;
-};
-
-class DeclarativeMessageBox : public DeclarativeObjectProxy<QMessageBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeMessageBox(QObject *parent = 0);
-
- static DeclarativeMessageBoxAttached *qmlAttachedProperties(QObject *parent);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeMessageBox, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativePlainTextEdit : public DeclarativeWidgetProxy<QPlainTextEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativePlainTextEdit(QObject *parent = 0);
-};
-
-class DeclarativeProgressBar : public DeclarativeWidgetProxy<QProgressBar>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeProgressBar(QObject *parent = 0);
-};
-
-class DeclarativePushButton : public DeclarativeWidgetProxy<QPushButton>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativePushButton(QObject *parent = 0);
-};
-
-class DeclarativeRadioButton : public DeclarativeWidgetProxy<QRadioButton>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeRadioButton(QObject *parent = 0);
-};
-
-class DeclarativeScrollArea : public DeclarativeWidgetProxy<QScrollArea>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeScrollArea(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeScrollBar : public DeclarativeWidgetProxy<QScrollBar>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeScrollBar(QObject *parent = 0);
-};
-
-class DeclarativeSlider : public DeclarativeWidgetProxy<QSlider>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeSlider(QObject *parent = 0);
-};
-
-class DeclarativeSpinBox : public DeclarativeWidgetProxy<QSpinBox>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeSpinBox(QObject *parent = 0);
-};
-
-class DeclarativeStackedWidget : public DeclarativeWidgetProxy<QStackedWidget>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeStackedWidget(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-// attached property for DeclarativeStatusBar
-class DeclarativeStatusBarAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(int stretch READ stretch WRITE setStretch NOTIFY stretchChanged)
-
- public:
- DeclarativeStatusBarAttached(QObject *parent = 0);
- ~DeclarativeStatusBarAttached();
-
- void setStretch(int stretch);
- int stretch() const;
-
- Q_SIGNALS:
- void stretchChanged();
-
- private:
- class Private;
- Private *const d;
-};
-
-class DeclarativeStatusBar : public DeclarativeWidgetProxy<QStatusBar>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeStatusBar(QObject *parent = 0);
-
- static DeclarativeStatusBarAttached *qmlAttachedProperties(QObject *object);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeStatusBar, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeTableView : public DeclarativeWidgetProxy<TableView>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTableView(QObject *parent = 0);
-};
-
-// attached property for DeclarativeTabWidget
-class DeclarativeTabWidgetAttached : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
- Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
-
- public:
- DeclarativeTabWidgetAttached(QObject *parent = 0);
- ~DeclarativeTabWidgetAttached();
-
- void setLabel(const QString &label);
- QString label() const;
-
- void setIcon(const QIcon &icon);
- QIcon icon() const;
-
- void setAssociation(QTabWidget *widget, int index);
-
- Q_SIGNALS:
- void labelChanged(const QString &label);
- void iconChanged(const QIcon &icon);
-
- private:
- class Private;
- Private *const d;
-};
-
-class DeclarativeTabWidget : public DeclarativeWidgetProxy<QTabWidget>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTabWidget(QObject *parent = 0);
-
- static DeclarativeTabWidgetAttached *qmlAttachedProperties(QObject *object);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
-};
-
-QML_DECLARE_TYPEINFO(DeclarativeTabWidget, QML_HAS_ATTACHED_PROPERTIES)
-
-class DeclarativeTextBrowser : public DeclarativeWidgetProxy<QTextBrowser>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTextBrowser(QObject *parent = 0);
-};
-
-class DeclarativeTextEdit : public DeclarativeWidgetProxy<TextEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTextEdit(QObject *parent = 0);
-};
-
-class DeclarativeTimeEdit : public DeclarativeWidgetProxy<QTimeEdit>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTimeEdit(QObject *parent = 0);
-};
-
-class DeclarativeToolBar : public DeclarativeWidgetProxy<QToolBar>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeToolBar(QObject *parent = 0);
-
- protected:
- virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
- virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
- virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
-};
-
-class DeclarativeToolButton : public DeclarativeWidgetProxy<QToolButton>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeToolButton(QObject *parent = 0);
-};
-
-class DeclarativeTreeView : public DeclarativeWidgetProxy<TreeView>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeTreeView(QObject *parent = 0);
-};
-
-class DeclarativeWebView : public DeclarativeWidgetProxy<QWebView>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeWebView(QObject *parent = 0);
-};
-
-class DeclarativeWidget : public DeclarativeWidgetProxy<QWidget>
-{
- DECLARATIVE_OBJECT
-
- public:
- DeclarativeWidget(QObject *parent = 0);
-};
-
-#endif
+++ /dev/null
-#ifndef DECLARATIVEWIDGETDOCUMENT_H
-#define DECLARATIVEWIDGETDOCUMENT_H
-
-#include <QtCore/QObject>
-#include <QtCore/QUrl>
-
-class QDeclarativeEngine;
-
-class DeclarativeWidgetDocument : public QObject
-{
- Q_OBJECT
-
- public:
- DeclarativeWidgetDocument(const QUrl &url, QObject *parent = 0);
- ~DeclarativeWidgetDocument();
-
- void setContextProperty(const QString &name, const QVariant &value);
- void setContextProperty(const QString &name, QObject *object);
-
- QDeclarativeEngine* engine() const;
-
- template <typename T>
- T* create()
- {
- QWidget *widget = createWidget();
- if (!widget)
- return 0;
-
- return qobject_cast<T*>(widget);
- }
-
- private:
- QWidget* createWidget();
-
- class Private;
- Private* const d;
-};
-
-#endif
TEMPLATE = app
TARGET =
DEPENDPATH += .
-INCLUDEPATH += .
+INCLUDEPATH += . lib/
# Input
+LIB_HEADERS = \
+ lib/abstractdeclarativeobject_p.h \
+ lib/declarativeactionitem_p.h \
+ lib/declarativeaction_p.h \
+ lib/declarativeboxlayout_p.h \
+ lib/declarativebuttongroup_p.h \
+ lib/declarativecalendarwidget_p.h \
+ lib/declarativecheckbox_p.h \
+ lib/declarativecolordialog_p.h \
+ lib/declarativecolumnview_p.h \
+ lib/declarativecommandlinkbutton_p.h \
+ lib/declarativedateedit_p.h \
+ lib/declarativedatetimeedit_p.h \
+ lib/declarativedialogbuttonbox_p.h \
+ lib/declarativedialog_p.h \
+ lib/declarativedial_p.h \
+ lib/declarativedoublespinbox_p.h \
+ lib/declarativefiledialog_p.h \
+ lib/declarativefontdialog_p.h \
+ lib/declarativeformlayout_p.h \
+ lib/declarativeframe_p.h \
+ lib/declarativegridlayout_p.h \
+ lib/declarativegroupbox_p.h \
+ lib/declarativehboxlayout_p.h \
+ lib/declarativeinputdialog_p.h \
+ lib/declarativelabel_p.h \
+ lib/declarativelayoutproxy_p.h \
+ lib/declarativelcdnumber_p.h \
+ lib/declarativelineedit_p.h \
+ lib/declarativelistview_p.h \
+ lib/declarativemainwindow_p.h \
+ lib/declarativemenubar_p.h \
+ lib/declarativemenu_p.h \
+ lib/declarativemessagebox_p.h \
+ lib/declarativeobjectproxy_p.h \
+ lib/declarativeplaintextedit_p.h \
+ lib/declarativeprogressbar_p.h \
+ lib/declarativepushbutton_p.h \
+ lib/declarativeradiobutton_p.h \
+ lib/declarativescrollarea_p.h \
+ lib/declarativescrollbar_p.h \
+ lib/declarativeseparator_p.h \
+ lib/declarativeslider_p.h \
+ lib/declarativespinbox_p.h \
+ lib/declarativestackedlayout_p.h \
+ lib/declarativestackedwidget_p.h \
+ lib/declarativestatusbar_p.h \
+ lib/declarativetableview_p.h \
+ lib/declarativetabwidget_p.h \
+ lib/declarativetextbrowser_p.h \
+ lib/declarativetextedit_p.h \
+ lib/declarativetimeedit_p.h \
+ lib/declarativetoolbar_p.h \
+ lib/declarativetoolbutton_p.h \
+ lib/declarativetreeview_p.h \
+ lib/declarativevboxlayout_p.h \
+ lib/declarativewebview_p.h \
+ lib/declarativewidget_p.h \
+ lib/declarativewidgetproxy_p.h \
+ lib/declarativewidgetsdocument.h \
+ lib/objectadaptors_p.h \
+ lib/qmetaobjectbuilder_p.h
+
+LIB_SOURCES = \
+ lib/abstractdeclarativeobject.cpp \
+ lib/declarativeaction.cpp \
+ lib/declarativeactionitem.cpp \
+ lib/declarativeboxlayout.cpp \
+ lib/declarativebuttongroup.cpp \
+ lib/declarativecalendarwidget.cpp \
+ lib/declarativecheckbox.cpp \
+ lib/declarativecolordialog.cpp \
+ lib/declarativecolumnview.cpp \
+ lib/declarativecommandlinkbutton.cpp \
+ lib/declarativedateedit.cpp \
+ lib/declarativedatetimeedit.cpp \
+ lib/declarativedial.cpp \
+ lib/declarativedialogbuttonbox.cpp \
+ lib/declarativedialog.cpp \
+ lib/declarativedoublespinbox.cpp \
+ lib/declarativefiledialog.cpp \
+ lib/declarativefontdialog.cpp \
+ lib/declarativeformlayout.cpp \
+ lib/declarativeframe.cpp \
+ lib/declarativegridlayout.cpp \
+ lib/declarativegroupbox.cpp \
+ lib/declarativehboxlayout.cpp \
+ lib/declarativeinputdialog.cpp \
+ lib/declarativelabel.cpp \
+ lib/declarativelcdnumber.cpp \
+ lib/declarativelineedit.cpp \
+ lib/declarativelistview.cpp \
+ lib/declarativemainwindow.cpp \
+ lib/declarativemenubar.cpp \
+ lib/declarativemenu.cpp \
+ lib/declarativemessagebox.cpp \
+ lib/declarativeplaintextedit.cpp \
+ lib/declarativeprogressbar.cpp \
+ lib/declarativepushbutton.cpp \
+ lib/declarativeradiobutton.cpp \
+ lib/declarativescrollarea.cpp \
+ lib/declarativescrollbar.cpp \
+ lib/declarativeseparator.cpp \
+ lib/declarativeslider.cpp \
+ lib/declarativespinbox.cpp \
+ lib/declarativestackedlayout.cpp \
+ lib/declarativestackedwidget.cpp \
+ lib/declarativestatusbar.cpp \
+ lib/declarativetableview.cpp \
+ lib/declarativetabwidget.cpp \
+ lib/declarativetextbrowser.cpp \
+ lib/declarativetextedit.cpp \
+ lib/declarativetimeedit.cpp \
+ lib/declarativetoolbar.cpp \
+ lib/declarativetoolbutton.cpp \
+ lib/declarativetreeview.cpp \
+ lib/declarativevboxlayout.cpp \
+ lib/declarativewebview.cpp \
+ lib/declarativewidget.cpp \
+ lib/declarativewidgetsdocument.cpp \
+ lib/objectadaptors.cpp \
+ lib/qmetaobjectbuilder.cpp
+
HEADERS += \
- declarativeobjects_p.h \
- declarativewidgetdocument.h \
- objectadaptors_p.h \
- qmetaobjectbuilder_p.h
+ $$LIB_HEADERS
SOURCES += \
- declarativeobjects.cpp \
- declarativewidgetdocument.cpp \
- main.cpp \
- objectadaptors.cpp \
- qmetaobjectbuilder.cpp
+ $$LIB_SOURCES \
+ main.cpp
QT += declarative webkit
OTHER_FILES += \
- animation.qml \
- browser.qml \
- dialogs.qml \
- editor.qml \
- gallery.qml \
- layouts.qml \
- test.qml \
- messagebox.qml
+ examples/animation.qml \
+ examples/browser.qml \
+ examples/dialogs.qml \
+ examples/editor.qml \
+ examples/gallery.qml \
+ examples/layouts.qml \
+ examples/test.qml \
+ examples/messagebox.qml
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "abstractdeclarativeobject_p.h"
+
+#include <QMetaMethod>
+
+AbstractDeclarativeObject::AbstractDeclarativeObject(QObject *parent)
+ : QObject(parent)
+{
+}
+
+AbstractDeclarativeObject::~AbstractDeclarativeObject()
+{
+}
+
+QDeclarativeListProperty<QObject> AbstractDeclarativeObject::data()
+{
+ return QDeclarativeListProperty<QObject>(this, 0, AbstractDeclarativeObject::data_append,
+ AbstractDeclarativeObject::data_count,
+ AbstractDeclarativeObject::data_at,
+ AbstractDeclarativeObject::data_clear);
+}
+
+void AbstractDeclarativeObject::dataAppend(QObject *)
+{
+}
+
+int AbstractDeclarativeObject::dataCount() const
+{
+ return 0;
+}
+
+QObject* AbstractDeclarativeObject::dataAt(int) const
+{
+ return 0;
+}
+
+void AbstractDeclarativeObject::dataClear()
+{
+}
+
+void AbstractDeclarativeObject::connectAllSignals(QObject *sender, QObject *receiver, const QSet<QByteArray> &blacklist) const
+{
+ for (int i = 0; i < sender->metaObject()->methodCount(); ++i) {
+ const QMetaMethod method = sender->metaObject()->method(i);
+ if (method.methodType() == QMetaMethod::Signal) {
+ if (blacklist.contains(method.signature()))
+ continue;
+
+ const QByteArray signature = "2" + QByteArray(method.signature());
+ QObject::connect(sender, signature.data(), receiver, signature.data());
+ }
+ }
+}
+
+void AbstractDeclarativeObject::data_append(QDeclarativeListProperty<QObject> *property, QObject *object)
+{
+ if (!object)
+ return;
+
+ AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
+ if (that)
+ that->dataAppend(object);
+ else
+ qWarning("cast went wrong in data_append");
+}
+
+int AbstractDeclarativeObject::data_count(QDeclarativeListProperty<QObject> *property)
+{
+ AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
+ if (that)
+ return that->dataCount();
+ else {
+ qWarning("cast went wrong in data_count");
+ return 0;
+ }
+}
+
+QObject* AbstractDeclarativeObject::data_at(QDeclarativeListProperty<QObject> *property, int index)
+{
+ AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
+ if (that)
+ return that->dataAt(index);
+ else {
+ qWarning("cast went wrong in data_at");
+ return 0;
+ }
+}
+
+void AbstractDeclarativeObject::data_clear(QDeclarativeListProperty<QObject> *property)
+{
+ AbstractDeclarativeObject *that = dynamic_cast<AbstractDeclarativeObject*>(property->object);
+ if (that)
+ that->dataClear();
+ else
+ qWarning("cast went wrong in data_clear");
+}
+
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 ABSTRACTDECLARATIVEOBJECT_P_H
+#define ABSTRACTDECLARATIVEOBJECT_P_H
+
+#include <QDeclarativeListProperty>
+#include <QObject>
+#include <QSet>
+
+class AbstractDeclarativeObject : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+
+ Q_CLASSINFO("DefaultProperty", "data")
+
+ public:
+ AbstractDeclarativeObject(QObject *parent = 0);
+ virtual ~AbstractDeclarativeObject();
+
+ virtual QObject* object() const = 0;
+
+ protected:
+ virtual void dataAppend(QObject *);
+ virtual int dataCount() const;
+ virtual QObject *dataAt(int) const;
+ virtual void dataClear();
+
+ void connectAllSignals(QObject *sender, QObject *receiver, const QSet<QByteArray> &blacklist = QSet<QByteArray>()) const;
+
+ private:
+ QDeclarativeListProperty<QObject> data();
+
+ static void data_append(QDeclarativeListProperty<QObject> *, QObject *);
+ static int data_count(QDeclarativeListProperty<QObject> *);
+ static QObject *data_at(QDeclarativeListProperty<QObject> *, int);
+ static void data_clear(QDeclarativeListProperty<QObject> *);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeaction_p.h"
+
+DeclarativeAction::DeclarativeAction(QObject *parent)
+ : DeclarativeObjectProxy<QAction, true>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeAction, QAction)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEACTION_P_H
+#define DECLARATIVEACTION_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include <QAction>
+
+class DeclarativeAction : public DeclarativeObjectProxy<QAction, true>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeAction(QObject *parent = 0);
+};
+Q_DECLARE_METATYPE(DeclarativeAction*)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeactionitem_p.h"
+
+DeclarativeActionItem::DeclarativeActionItem(QObject *parent)
+ : DeclarativeObjectProxy<ActionItem>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeActionItem, ActionItem)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEACTIONITEM_P_H
+#define DECLARATIVEACTIONITEM_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeActionItem : public DeclarativeObjectProxy<ActionItem>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeActionItem(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeboxlayout_p.h"
+
+#include <QPointer>
+#include <QWidget>
+
+class DeclarativeBoxLayoutAttached::Private
+{
+ public:
+ Private(QWidget *w, QLayout *l) : stretch(0), alignment(0), widget(w), layout(l) {}
+
+ int stretch;
+ Qt::Alignment alignment;
+
+ QPointer<QWidget> widget;
+ QPointer<QLayout> layout;
+ QPointer<QBoxLayout> parentLayout;
+};
+
+DeclarativeBoxLayoutAttached::DeclarativeBoxLayoutAttached(QWidget *widget, QObject *parent)
+ : QObject(parent), d(new Private(widget, 0))
+{
+}
+
+DeclarativeBoxLayoutAttached::DeclarativeBoxLayoutAttached(QLayout *layout, QObject *parent)
+ : QObject(parent), d(new Private(0, layout))
+{
+}
+
+DeclarativeBoxLayoutAttached::~DeclarativeBoxLayoutAttached()
+{
+ delete d;
+}
+
+void DeclarativeBoxLayoutAttached::setParentLayout(QBoxLayout *parentLayout)
+{
+ d->parentLayout = parentLayout;
+}
+
+void DeclarativeBoxLayoutAttached::setStretch(int stretch)
+{
+ if (stretch == d->stretch)
+ return;
+
+ d->stretch = stretch;
+ emit stretchChanged(stretch);
+}
+
+int DeclarativeBoxLayoutAttached::stretch() const
+{
+ return d->stretch;
+}
+
+void DeclarativeBoxLayoutAttached::setAlignment(Qt::Alignment alignment)
+{
+ if (alignment == d->alignment)
+ return;
+
+ d->alignment = alignment;
+ emit alignmentChanged(alignment);
+
+ if (d->parentLayout) {
+ if (d->widget)
+ d->parentLayout->setAlignment(d->widget, d->alignment);
+
+ if (d->layout)
+ d->parentLayout->setAlignment(d->layout, d->alignment);
+ }
+}
+
+Qt::Alignment DeclarativeBoxLayoutAttached::alignment() const
+{
+ return d->alignment;
+}
+
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEBOXLAYOUT_P_H
+#define DECLARATIVEBOXLAYOUT_P_H
+
+#include <QBoxLayout>
+
+class DeclarativeBoxLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int stretch READ stretch WRITE setStretch NOTIFY stretchChanged)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
+
+ public:
+ DeclarativeBoxLayoutAttached(QWidget *widget, QObject *parent);
+ DeclarativeBoxLayoutAttached(QLayout *layout, QObject *parent);
+ ~DeclarativeBoxLayoutAttached();
+
+ void setParentLayout(QBoxLayout *parentLayout);
+
+ void setStretch(int stretch);
+ int stretch() const;
+
+ void setAlignment(Qt::Alignment alignment);
+ Qt::Alignment alignment() const;
+
+ Q_SIGNALS:
+ void stretchChanged(int stretch);
+ void alignmentChanged(Qt::Alignment alignment);
+
+ private:
+ class Private;
+ Private *const d;
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativebuttongroup_p.h"
+
+DeclarativeButtonGroup::DeclarativeButtonGroup(QObject *parent)
+ : DeclarativeObjectProxy<ButtonGroup>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeButtonGroup, ButtonGroup)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEBUTTONGROUP_P_H
+#define DECLARATIVEBUTTONGROUP_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeButtonGroup : public DeclarativeObjectProxy<ButtonGroup>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeButtonGroup(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativecalendarwidget_p.h"
+
+DeclarativeCalendarWidget::DeclarativeCalendarWidget(QObject *parent)
+ : DeclarativeWidgetProxy<QCalendarWidget>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeCalendarWidget, QCalendarWidget)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVECALENDARWIDGET_P_H
+#define DECLARATIVECALENDARWIDGET_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QCalendarWidget>
+
+class DeclarativeCalendarWidget : public DeclarativeWidgetProxy<QCalendarWidget>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeCalendarWidget(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativecheckbox_p.h"
+
+DeclarativeCheckBox::DeclarativeCheckBox(QObject *parent)
+ : DeclarativeWidgetProxy<QCheckBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeCheckBox, QCheckBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVECHECKBOX_P_H
+#define DECLARATIVECHECKBOX_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QCheckBox>
+
+class DeclarativeCheckBox : public DeclarativeWidgetProxy<QCheckBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeCheckBox(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativecolordialog_p.h"
+
+class DeclarativeColorDialogAttached::Private
+{
+ public:
+ Private() : options(0) {}
+
+ public:
+ QPointer<QObject> dialogParent;
+ QString title;
+ QColorDialog::ColorDialogOptions options;
+};
+
+DeclarativeColorDialogAttached::DeclarativeColorDialogAttached(QObject *parent)
+ : QObject(parent), d(new Private)
+{
+}
+
+DeclarativeColorDialogAttached::~DeclarativeColorDialogAttached()
+{
+ delete d;
+}
+
+void DeclarativeColorDialogAttached::setDialogParent(QObject *parent)
+{
+ if (parent == d->dialogParent)
+ return;
+
+ d->dialogParent = parent;
+ emit dialogParentChanged(parent);
+}
+
+QObject *DeclarativeColorDialogAttached::dialogParent() const
+{
+ return d->dialogParent;
+}
+
+void DeclarativeColorDialogAttached::setTitle(const QString &title)
+{
+ if (title == d->title)
+ return;
+
+ d->title = title;
+ emit titleChanged(title);
+}
+
+QString DeclarativeColorDialogAttached::title() const
+{
+ return d->title;
+}
+
+QColor DeclarativeColorDialogAttached::getColor(const QColor &initialColor)
+{
+ QWidget *parent = bestParentWindow(d->dialogParent);
+ if (!d->title.isEmpty() || d->options != 0)
+ return QColorDialog::getColor(initialColor, parent, d->title, d->options);
+ else
+ return QColorDialog::getColor(initialColor, parent);
+}
+
+QWidget *DeclarativeColorDialogAttached::bestParentWindow(QObject *parent) const
+{
+ if (!parent)
+ parent = this->parent();
+
+ // if parent is a Declarative Object, search the proxied hierarchy
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject)
+ parent = declarativeObject->object();
+
+ while (parent) {
+ QWidget *widget = qobject_cast<QWidget*>(parent);
+ if (widget)
+ return widget->topLevelWidget();
+
+ parent = parent->parent();
+ }
+
+ return 0;
+}
+
+DeclarativeColorDialog::DeclarativeColorDialog(QObject *parent) : DeclarativeWidgetProxy<QColorDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeColorDialogAttached *DeclarativeColorDialog::qmlAttachedProperties(QObject *parent)
+{
+ return new DeclarativeColorDialogAttached(parent);
+}
+
+CUSTOM_METAOBJECT(DeclarativeColorDialog, QColorDialog)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVECOLORDIALOG_P_H
+#define DECLARATIVECOLORDIALOG_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QColorDialog>
+
+class DeclarativeColorDialogAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
+ // TODO option
+
+ public:
+ DeclarativeColorDialogAttached(QObject *parent = 0);
+ ~DeclarativeColorDialogAttached();
+
+ void setDialogParent(QObject *parent);
+ QObject *dialogParent() const;
+
+ void setTitle(const QString &title);
+ QString title() const;
+
+ Q_INVOKABLE QColor getColor(const QColor &initialColor);
+
+ Q_SIGNALS:
+ void dialogParentChanged(QObject *parent);
+ void titleChanged(const QString &title);
+
+ private:
+ QWidget *bestParentWindow(QObject *parent) const;
+
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeColorDialog : public DeclarativeWidgetProxy<QColorDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeColorDialog(QObject *parent = 0);
+
+ static DeclarativeColorDialogAttached *qmlAttachedProperties(QObject *parent);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeColorDialog, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativecolumnview_p.h"
+
+DeclarativeColumnView::DeclarativeColumnView(QObject *parent)
+ : DeclarativeWidgetProxy<ColumnView>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeColumnView, ColumnView)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVECOLUMNVIEW_P_H
+#define DECLARATIVECOLUMNVIEW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeColumnView : public DeclarativeWidgetProxy<ColumnView>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeColumnView(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativecommandlinkbutton_p.h"
+
+DeclarativeCommandLinkButton::DeclarativeCommandLinkButton(QObject *parent)
+ : DeclarativeWidgetProxy<QCommandLinkButton>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeCommandLinkButton, QCommandLinkButton)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVECOMMANDLINKBUTTON_P_H
+#define DECLARATIVECOMMANDLINKBUTTON_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QCommandLinkButton>
+
+class DeclarativeCommandLinkButton : public DeclarativeWidgetProxy<QCommandLinkButton>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeCommandLinkButton(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedateedit_p.h"
+
+DeclarativeDateEdit::DeclarativeDateEdit(QObject *parent)
+ : DeclarativeWidgetProxy<QDateEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDateEdit, QDateEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDATEEDIT_P_H
+#define DECLARATIVEDATEEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDateEdit>
+
+class DeclarativeDateEdit : public DeclarativeWidgetProxy<QDateEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDateEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedatetimeedit_p.h"
+
+DeclarativeDateTimeEdit::DeclarativeDateTimeEdit(QObject *parent)
+ : DeclarativeWidgetProxy<QDateTimeEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDateTimeEdit, QDateTimeEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDATETIMEEDIT_P_H
+#define DECLARATIVEDATETIMEEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDateTimeEdit>
+
+class DeclarativeDateTimeEdit : public DeclarativeWidgetProxy<QDateTimeEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDateTimeEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedial_p.h"
+
+DeclarativeDial::DeclarativeDial(QObject *parent)
+ : DeclarativeWidgetProxy<QDial>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDial, QDial)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDIAL_P_H
+#define DECLARATIVEDIAL_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDial>
+
+class DeclarativeDial : public DeclarativeWidgetProxy<QDial>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDial(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedialog_p.h"
+
+DeclarativeDialog::DeclarativeDialog(QObject *parent)
+ : DeclarativeWidgetProxy<QDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDialog, QDialog)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDIALOG_P_H
+#define DECLARATIVEDIALOG_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDialog>
+
+class DeclarativeDialog : public DeclarativeWidgetProxy<QDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDialog(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedialogbuttonbox_p.h"
+
+DeclarativeDialogButtonBox::DeclarativeDialogButtonBox(QObject *parent)
+ : DeclarativeWidgetProxy<QDialogButtonBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDialogButtonBox, QDialogButtonBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDIALOGBUTTONBOX_P_H
+#define DECLARATIVEDIALOGBUTTONBOX_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDialogButtonBox>
+
+class DeclarativeDialogButtonBox : public DeclarativeWidgetProxy<QDialogButtonBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDialogButtonBox(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativedoublespinbox_p.h"
+
+DeclarativeDoubleSpinBox::DeclarativeDoubleSpinBox(QObject *parent)
+ : DeclarativeWidgetProxy<QDoubleSpinBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeDoubleSpinBox, QDoubleSpinBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEDOUBLESPINBOX_P_H
+#define DECLARATIVEDOUBLESPINBOX_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QDoubleSpinBox>
+
+class DeclarativeDoubleSpinBox : public DeclarativeWidgetProxy<QDoubleSpinBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeDoubleSpinBox(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativefiledialog_p.h"
+
+class DeclarativeFileDialogAttached::Private
+{
+ public:
+ QPointer<QObject> dialogParent;
+ QString caption;
+ QString dir;
+ QStringList nameFilters;
+ QString selectedFilter;
+};
+
+DeclarativeFileDialogAttached::DeclarativeFileDialogAttached(QObject *parent)
+ : QObject(parent), d(new Private)
+{
+}
+
+DeclarativeFileDialogAttached::~DeclarativeFileDialogAttached()
+{
+ delete d;
+}
+
+void DeclarativeFileDialogAttached::setDialogParent(QObject *parent)
+{
+ if (parent == d->dialogParent)
+ return;
+
+ d->dialogParent = parent;
+ emit dialogParentChanged(parent);
+}
+
+QObject *DeclarativeFileDialogAttached::dialogParent() const
+{
+ return d->dialogParent;
+}
+
+void DeclarativeFileDialogAttached::setCaption(const QString &caption)
+{
+ if (caption == d->caption)
+ return;
+
+ d->caption = caption;
+ emit captionChanged(caption);
+}
+
+QString DeclarativeFileDialogAttached::caption() const
+{
+ return d->caption;
+}
+
+void DeclarativeFileDialogAttached::setDir(const QString &dir)
+{
+ if (dir == d->dir)
+ return;
+
+ d->dir = dir;
+ emit dirChanged(dir);
+}
+
+QString DeclarativeFileDialogAttached::dir() const
+{
+ return d->dir;
+}
+
+void DeclarativeFileDialogAttached::setNameFilters(const QStringList &nameFilters)
+{
+ if (nameFilters == d->nameFilters)
+ return;
+
+ d->nameFilters = nameFilters;
+ emit nameFiltersChanged(nameFilters);
+}
+
+QStringList DeclarativeFileDialogAttached::nameFilters() const
+{
+ return d->nameFilters;
+}
+
+QString DeclarativeFileDialogAttached::selectedFilter() const
+{
+ return d->selectedFilter;
+}
+
+QString DeclarativeFileDialogAttached::getExistingDirectory()
+{
+ return QFileDialog::getExistingDirectory(bestParentWindow(d->dialogParent), d->caption, d->dir, QFileDialog::ShowDirsOnly);
+}
+
+QString DeclarativeFileDialogAttached::getOpenFileName()
+{
+ QString selectedFilter;
+ const QString retVal = QFileDialog::getOpenFileName(bestParentWindow(d->dialogParent), d->caption, d->dir,
+ d->nameFilters.join(";;"), &selectedFilter, 0);
+ setSelectedFilter(selectedFilter);
+ return retVal;
+}
+
+QStringList DeclarativeFileDialogAttached::getOpenFileNames()
+{
+ QString selectedFilter;
+ const QStringList retVal = QFileDialog::getOpenFileNames(bestParentWindow(d->dialogParent), d->caption, d->dir,
+ d->nameFilters.join(";;"), &selectedFilter, 0);
+ setSelectedFilter(selectedFilter);
+ return retVal;
+}
+
+QString DeclarativeFileDialogAttached::getSaveFileName()
+{
+ QString selectedFilter;
+ const QString retVal = QFileDialog::getSaveFileName(bestParentWindow(d->dialogParent), d->caption, d->dir,
+ d->nameFilters.join(";;"), &selectedFilter, 0);
+ setSelectedFilter(selectedFilter);
+ return retVal;
+}
+
+QWidget *DeclarativeFileDialogAttached::bestParentWindow(QObject *parent) const
+{
+ if (!parent)
+ parent = this->parent();
+
+ // if parent is a Declarative Object, search the proxied hierarchy
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject)
+ parent = declarativeObject->object();
+
+ while (parent) {
+ QWidget *widget = qobject_cast<QWidget*>(parent);
+ if (widget)
+ return widget->topLevelWidget();
+
+ parent = parent->parent();
+ }
+
+ return 0;
+}
+
+void DeclarativeFileDialogAttached::setSelectedFilter(const QString &filter)
+{
+ if (filter == d->selectedFilter)
+ return;
+
+ d->selectedFilter = filter;
+ emit selectedFilterChanged(filter);
+}
+
+
+DeclarativeFileDialog::DeclarativeFileDialog(QObject *parent)
+ : DeclarativeWidgetProxy<FileDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeFileDialogAttached *DeclarativeFileDialog::qmlAttachedProperties(QObject *parent)
+{
+ return new DeclarativeFileDialogAttached(parent);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFileDialog, FileDialog)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEFILEDIALOG_P_H
+#define DECLARATIVEFILEDIALOG_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeFileDialogAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
+ Q_PROPERTY(QString caption READ caption WRITE setCaption NOTIFY captionChanged)
+ Q_PROPERTY(QString dir READ dir WRITE setDir NOTIFY dirChanged)
+ Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters NOTIFY nameFiltersChanged)
+ // TODO dialog option
+ Q_PROPERTY(QString selectedFilter READ selectedFilter NOTIFY selectedFilterChanged)
+
+ public:
+ DeclarativeFileDialogAttached(QObject *parent = 0);
+ ~DeclarativeFileDialogAttached();
+
+ void setDialogParent(QObject *parent);
+ QObject *dialogParent() const;
+
+ void setCaption(const QString &caption);
+ QString caption() const;
+
+ void setDir(const QString &dir);
+ QString dir() const;
+
+ void setNameFilters(const QStringList &nameFilters);
+ QStringList nameFilters() const;
+
+ QString selectedFilter() const;
+
+ Q_INVOKABLE QString getExistingDirectory();
+
+ Q_INVOKABLE QString getOpenFileName();
+
+ Q_INVOKABLE QStringList getOpenFileNames();
+
+ Q_INVOKABLE QString getSaveFileName();
+
+ Q_SIGNALS:
+ void dialogParentChanged(QObject *parent);
+ void captionChanged(const QString &caption);
+ void dirChanged(const QString &dir);
+ void nameFiltersChanged(const QStringList &filters);
+ void selectedFilterChanged(const QString &filter);
+
+ private:
+ QWidget *bestParentWindow(QObject *parent) const;
+ void setSelectedFilter(const QString &filter);
+
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeFileDialog : public DeclarativeWidgetProxy<FileDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFileDialog(QObject *parent = 0);
+
+ static DeclarativeFileDialogAttached *qmlAttachedProperties(QObject *parent);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeFileDialog, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativefontdialog_p.h"
+
+DeclarativeFontDialog::DeclarativeFontDialog(QObject *parent)
+ : DeclarativeWidgetProxy<QFontDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFontDialog, QFontDialog)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEFONTDIALOG_P_H
+#define DECLARATIVEFONTDIALOG_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QFontDialog>
+
+class DeclarativeFontDialog : public DeclarativeWidgetProxy<QFontDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFontDialog(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeformlayout_p.h"
+
+class DeclarativeFormLayoutAttached::Private
+{
+ public:
+ QString label;
+};
+
+DeclarativeFormLayoutAttached::DeclarativeFormLayoutAttached(QObject *parent)
+ : QObject(parent), d(new Private)
+{
+}
+
+DeclarativeFormLayoutAttached::~DeclarativeFormLayoutAttached()
+{
+ delete d;
+}
+
+void DeclarativeFormLayoutAttached::setLabel(const QString &label)
+{
+ if (label == d->label)
+ return;
+
+ d->label = label;
+ emit labelChanged(label);
+}
+
+QString DeclarativeFormLayoutAttached::label() const
+{
+ return d->label;
+}
+
+// DeclarativeFormLayout
+DeclarativeFormLayout::DeclarativeFormLayout(QObject *parent) : DeclarativeLayoutProxy<QFormLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeFormLayoutAttached *DeclarativeFormLayout::qmlAttachedProperties(QObject *parent)
+{
+ return new DeclarativeFormLayoutAttached(parent);
+}
+
+void DeclarativeFormLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeFormLayout>(declarativeObject, false);
+ DeclarativeFormLayoutAttached *properties = qobject_cast<DeclarativeFormLayoutAttached*>(attachedProperties);
+ if (properties) {
+ if (!properties->label().isEmpty()) {
+ m_proxiedObject->addRow(properties->label(), widget);
+ m_children.append(declarativeObject);
+ return;
+ }
+ }
+
+ m_proxiedObject->addRow(widget);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeFormLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeFormLayout>(declarativeObject, false);
+ DeclarativeFormLayoutAttached *properties = qobject_cast<DeclarativeFormLayoutAttached*>(attachedProperties);
+ if (properties) {
+ if (!properties->label().isEmpty()) {
+ m_proxiedObject->addRow(properties->label(), layout);
+ m_children.append(declarativeObject);
+ return;
+ }
+ }
+ m_proxiedObject->addRow(layout);
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFormLayout, QFormLayout)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEFORMLAYOUT_P_H
+#define DECLARATIVEFORMLAYOUT_P_H
+
+#include "declarativelayoutproxy_p.h"
+
+#include <QFormLayout>
+
+class DeclarativeFormLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+
+ public:
+ DeclarativeFormLayoutAttached(QObject *parent);
+ ~DeclarativeFormLayoutAttached();
+
+ void setLabel(const QString &label);
+ QString label() const;
+
+ Q_SIGNALS:
+ void labelChanged(const QString &label);
+
+ private:
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeFormLayout : public DeclarativeLayoutProxy<QFormLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFormLayout(QObject *parent = 0);
+
+ static DeclarativeFormLayoutAttached *qmlAttachedProperties(QObject *parent);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeFormLayout, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeframe_p.h"
+
+DeclarativeFrame::DeclarativeFrame(QObject *parent)
+ : DeclarativeWidgetProxy<QFrame>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeFrame, QFrame)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEFRAME_P_H
+#define DECLARATIVEFRAME_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QFrame>
+
+class DeclarativeFrame : public DeclarativeWidgetProxy<QFrame>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeFrame(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativegridlayout_p.h"
+
+class DeclarativeGridLayoutAttached::Private
+{
+ public:
+ Private(QWidget *w, QLayout *l)
+ : row(0), column(0), rowSpan(1), columnSpan(1), alignment(0),
+ widget(w), layout(l)
+ {}
+
+ int row;
+ int column;
+ int rowSpan;
+ int columnSpan;
+ Qt::Alignment alignment;
+
+ QPointer<QWidget> widget;
+ QPointer<QLayout> layout;
+ QPointer<QGridLayout> parentLayout;
+};
+
+DeclarativeGridLayoutAttached::DeclarativeGridLayoutAttached(QWidget *widget, QObject *parent)
+ : QObject(parent), d(new Private(widget, 0))
+{
+}
+
+DeclarativeGridLayoutAttached::DeclarativeGridLayoutAttached(QLayout *layout, QObject *parent)
+ : QObject(parent), d(new Private(0, layout))
+{
+}
+
+DeclarativeGridLayoutAttached::~DeclarativeGridLayoutAttached()
+{
+ delete d;
+}
+
+void DeclarativeGridLayoutAttached::setParentLayout(QGridLayout *parentLayout)
+{
+ d->parentLayout = parentLayout;
+}
+
+void DeclarativeGridLayoutAttached::setRow(int row)
+{
+ if (row == d->row)
+ return;
+
+ d->row = row;
+ emit rowChanged(row);
+}
+
+int DeclarativeGridLayoutAttached::row() const
+{
+ return d->row;
+}
+
+void DeclarativeGridLayoutAttached::setColumn(int column)
+{
+ if (column == d->column)
+ return;
+
+ d->column = column;
+ emit columnChanged(column);
+}
+
+int DeclarativeGridLayoutAttached::column() const
+{
+ return d->column;
+}
+
+void DeclarativeGridLayoutAttached::setRowSpan(int rowSpan)
+{
+ if (rowSpan == d->rowSpan)
+ return;
+
+ d->rowSpan = rowSpan;
+ emit rowSpanChanged(rowSpan);
+}
+
+int DeclarativeGridLayoutAttached::rowSpan() const
+{
+ return d->rowSpan;
+}
+
+void DeclarativeGridLayoutAttached::setColumnSpan(int columnSpan)
+{
+ if (columnSpan == d->columnSpan)
+ return;
+
+ d->columnSpan = columnSpan;
+ emit columnSpanChanged(columnSpan);
+}
+
+int DeclarativeGridLayoutAttached::columnSpan() const
+{
+ return d->columnSpan;
+}
+
+void DeclarativeGridLayoutAttached::setAlignment(Qt::Alignment alignment)
+{
+ if (alignment == d->alignment)
+ return;
+
+ d->alignment = alignment;
+ emit alignmentChanged(alignment);
+
+ if (d->parentLayout) {
+ if (d->widget)
+ d->parentLayout->setAlignment(d->widget, d->alignment);
+
+ if (d->layout)
+ d->parentLayout->setAlignment(d->layout, d->alignment);
+ }
+}
+
+Qt::Alignment DeclarativeGridLayoutAttached::alignment() const
+{
+ return d->alignment;
+}
+
+// DeclarativeGridLayout
+DeclarativeGridLayout::DeclarativeGridLayout(QObject *parent) : DeclarativeLayoutProxy<QGridLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeGridLayoutAttached *DeclarativeGridLayout::qmlAttachedProperties(QObject *parent)
+{
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject) {
+ QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
+ if (widget)
+ return new DeclarativeGridLayoutAttached(widget, parent);
+
+ QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
+ if (layout)
+ return new DeclarativeGridLayoutAttached(layout, parent);
+ }
+
+ qmlInfo(parent) << "Can only attach GridLayout to widgets and layouts";
+ return 0;
+}
+
+void DeclarativeGridLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ int row = 0;
+ int column = 0;
+ int rowSpan = 1;
+ int columnSpan = 1;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeGridLayout>(declarativeObject, false);
+ DeclarativeGridLayoutAttached *properties = qobject_cast<DeclarativeGridLayoutAttached*>(attachedProperties);
+ if (properties) {
+ row = properties->row();
+ column = properties->column();
+ rowSpan = properties->rowSpan();
+ columnSpan = properties->columnSpan();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addWidget(widget, row, column, rowSpan, columnSpan, alignment);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeGridLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ int row = 0;
+ int column = 0;
+ int rowSpan = 1;
+ int columnSpan = 1;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeGridLayout>(declarativeObject, false);
+ DeclarativeGridLayoutAttached *properties = qobject_cast<DeclarativeGridLayoutAttached*>(attachedProperties);
+ if (properties) {
+ row = properties->row();
+ column = properties->column();
+ rowSpan = properties->rowSpan();
+ columnSpan = properties->columnSpan();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addLayout(layout, row, column, rowSpan, columnSpan, alignment);
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeGridLayout, QGridLayout)
+
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEGRIDLAYOUT_P_H
+#define DECLARATIVEGRIDLAYOUT_P_H
+
+#include "declarativelayoutproxy_p.h"
+
+#include <QGridLayout>
+
+class DeclarativeGridLayoutAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int row READ row WRITE setRow NOTIFY rowChanged)
+ Q_PROPERTY(int column READ column WRITE setColumn NOTIFY columnChanged)
+ Q_PROPERTY(int rowSpan READ rowSpan WRITE setRowSpan NOTIFY rowSpanChanged)
+ Q_PROPERTY(int columnSpan READ columnSpan WRITE setColumnSpan NOTIFY columnSpanChanged)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
+
+ public:
+ DeclarativeGridLayoutAttached(QWidget *widget, QObject *parent);
+ DeclarativeGridLayoutAttached(QLayout *layout, QObject *parent);
+ ~DeclarativeGridLayoutAttached();
+
+ void setParentLayout(QGridLayout *parentLayout);
+
+ void setRow(int row);
+ int row() const;
+
+ void setColumn(int column);
+ int column() const;
+
+ void setRowSpan(int rowSpan);
+ int rowSpan() const;
+
+ void setColumnSpan(int columnSpan);
+ int columnSpan() const;
+
+ void setAlignment(Qt::Alignment alignment);
+ Qt::Alignment alignment() const;
+
+ Q_SIGNALS:
+ void rowChanged(int row);
+ void columnChanged(int column);
+ void rowSpanChanged(int rowSpan);
+ void columnSpanChanged(int columnSpan);
+ void alignmentChanged(Qt::Alignment alignment);
+
+ private:
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeGridLayout : public DeclarativeLayoutProxy<QGridLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeGridLayout(QObject *parent = 0);
+
+ static DeclarativeGridLayoutAttached *qmlAttachedProperties(QObject *parent);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeGridLayout, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativegroupbox_p.h"
+
+DeclarativeGroupBox::DeclarativeGroupBox(QObject *parent)
+ : DeclarativeWidgetProxy<QGroupBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeGroupBox, QGroupBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEGROUPBOX_P_H
+#define DECLARATIVEGROUPBOX_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QGroupBox>
+
+class DeclarativeGroupBox : public DeclarativeWidgetProxy<QGroupBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeGroupBox(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativehboxlayout_p.h"
+
+DeclarativeHBoxLayout::DeclarativeHBoxLayout(QObject *parent)
+ : DeclarativeLayoutProxy<QHBoxLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeBoxLayoutAttached *DeclarativeHBoxLayout::qmlAttachedProperties(QObject *parent)
+{
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject) {
+ QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
+ if (widget)
+ return new DeclarativeBoxLayoutAttached(widget, parent);
+
+ QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
+ if (layout)
+ return new DeclarativeBoxLayoutAttached(layout, parent);
+ }
+
+ qmlInfo(parent) << "Can only attach HBoxLayout to widgets and layouts";
+ return 0;
+}
+
+void DeclarativeHBoxLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ int stretch = 0;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeHBoxLayout>(declarativeObject, false);
+ DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
+ if (properties) {
+ stretch = properties->stretch();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addWidget(widget, stretch, alignment);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeHBoxLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ int stretch = 0;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeHBoxLayout>(declarativeObject, false);
+ DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
+ if (properties) {
+ stretch = properties->stretch();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addLayout(layout, stretch);
+ m_proxiedObject->setAlignment(layout, alignment);
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeHBoxLayout, QHBoxLayout)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEHBOXLAYOUT_P_H
+#define DECLARATIVEHBOXLAYOUT_P_H
+
+#include "declarativeboxlayout_p.h"
+#include "declarativelayoutproxy_p.h"
+
+#include <QHBoxLayout>
+
+class DeclarativeHBoxLayout : public DeclarativeLayoutProxy<QHBoxLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeHBoxLayout(QObject *parent = 0);
+
+ static DeclarativeBoxLayoutAttached *qmlAttachedProperties(QObject *parent);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeHBoxLayout, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeinputdialog_p.h"
+
+class DeclarativeInputDialogAttached::Private
+{
+ public:
+ Private() : dialogAccepted(false),
+ value(0), min(-2147483647), max(2147483647), decimals(1), step(1),
+ currentItem(0), itemsEditable(true),
+ echoMode(QLineEdit::Normal)
+ {}
+
+ public:
+ QPointer<QObject> dialogParent;
+ QString title;
+ QString label;
+ bool dialogAccepted;
+
+ QVariant value;
+ QVariant min;
+ QVariant max;
+ int decimals;
+ int step;
+
+ int currentItem;
+ bool itemsEditable;
+
+ QLineEdit::EchoMode echoMode;
+ QString text;
+};
+
+DeclarativeInputDialogAttached::DeclarativeInputDialogAttached(QObject *parent)
+ : QObject(parent), d(new Private)
+{
+}
+
+DeclarativeInputDialogAttached::~DeclarativeInputDialogAttached()
+{
+ delete d;
+}
+
+void DeclarativeInputDialogAttached::setDialogParent(QObject *parent)
+{
+ if (parent == d->dialogParent)
+ return;
+
+ d->dialogParent = parent;
+ emit dialogParentChanged(parent);
+}
+
+QObject *DeclarativeInputDialogAttached::dialogParent() const
+{
+ return d->dialogParent;
+}
+
+void DeclarativeInputDialogAttached::setTitle(const QString &title)
+{
+ if (title == d->title)
+ return;
+
+ d->title = title;
+ emit titleChanged(title);
+}
+
+QString DeclarativeInputDialogAttached::title() const
+{
+ return d->title;
+}
+
+void DeclarativeInputDialogAttached::setLabel(const QString &label)
+{
+ if (label == d->label)
+ return;
+
+ d->label = label;
+ emit labelChanged(label);
+}
+
+QString DeclarativeInputDialogAttached::label() const
+{
+ return d->label;
+}
+
+bool DeclarativeInputDialogAttached::dialogAccepted() const
+{
+ return d->dialogAccepted;
+}
+
+void DeclarativeInputDialogAttached::setValue(const QVariant &value)
+{
+ if (value == d->value)
+ return;
+
+ d->value = value;
+ emit valueChanged(value);
+}
+
+QVariant DeclarativeInputDialogAttached::value() const
+{
+ return d->value;
+}
+
+void DeclarativeInputDialogAttached::setMin(const QVariant &min)
+{
+ if (min == d->min)
+ return;
+
+ d->min = min;
+ emit minChanged(min);
+}
+
+QVariant DeclarativeInputDialogAttached::min() const
+{
+ return d->min;
+}
+
+void DeclarativeInputDialogAttached::setMax(const QVariant &max)
+{
+ if (max == d->max)
+ return;
+
+ d->max = max;
+ emit maxChanged(max);
+}
+
+QVariant DeclarativeInputDialogAttached::max() const
+{
+ return d->max;
+}
+
+void DeclarativeInputDialogAttached::setDecimals(int decimals)
+{
+ if (decimals == d->decimals)
+ return;
+
+ d->decimals = decimals;
+ emit decimalsChanged(decimals);
+}
+
+int DeclarativeInputDialogAttached::decimals() const
+{
+ return d->decimals;
+}
+
+void DeclarativeInputDialogAttached::setStep(int step)
+{
+ if (step == d->step)
+ return;
+
+ d->step = step;
+ emit stepChanged(step);
+}
+
+int DeclarativeInputDialogAttached::step() const
+{
+ return d->step;
+}
+
+void DeclarativeInputDialogAttached::setCurrentItem(int current)
+{
+ if (current == d->currentItem)
+ return;
+
+ d->currentItem = current;
+ emit currentItemChanged(current);
+}
+
+int DeclarativeInputDialogAttached::currentItem() const
+{
+ return d->currentItem;
+}
+
+void DeclarativeInputDialogAttached::setItemsEditable(bool editable)
+{
+ if (editable == d->itemsEditable)
+ return;
+
+ d->itemsEditable = editable;
+ emit itemsEditableChanged(editable);
+}
+
+bool DeclarativeInputDialogAttached::itemsEditable() const
+{
+ return d->itemsEditable;
+}
+
+void DeclarativeInputDialogAttached::setEchoMode(QLineEdit::EchoMode echoMode)
+{
+ if (echoMode == d->echoMode)
+ return;
+
+ d->echoMode = echoMode;
+ emit echoModeChanged(echoMode);
+}
+
+QLineEdit::EchoMode DeclarativeInputDialogAttached::echoMode() const
+{
+ return d->echoMode;
+}
+
+void DeclarativeInputDialogAttached::setText(const QString &text)
+{
+ if (text == d->text)
+ return;
+
+ d->text = text;
+ emit textChanged(text);
+}
+
+QString DeclarativeInputDialogAttached::text() const
+{
+ return d->text;
+}
+
+double DeclarativeInputDialogAttached::getDouble()
+{
+ QWidget *parent = bestParentWindow(d->dialogParent);
+ bool ok = false;
+ const double value = d->value.canConvert<double>() ? d->value.value<double>() : 0.0;
+ const double min = d->min.canConvert<double>() ? d->min.value<double>() : -2147483647;
+ const double max = d->max.canConvert<double>() ? d->max.value<double>() : 2147483647;
+
+ const double retVal = QInputDialog::getDouble(parent, d->title, d->label, value, min, max, d->decimals, &ok);
+
+ setDialogAccepted(ok);
+ return retVal;
+}
+
+int DeclarativeInputDialogAttached::getInt()
+{
+ QWidget *parent = bestParentWindow(d->dialogParent);
+ bool ok = false;
+ const int value = d->value.canConvert<int>() ? d->value.value<int>() : 0;
+ const int min = d->min.canConvert<int>() ? d->min.value<int>() : -2147483647;
+ const int max = d->max.canConvert<int>() ? d->max.value<int>() : 2147483647;
+
+ const int retVal = QInputDialog::getInt(parent, d->title, d->label, value, min, max, d->step, &ok);
+
+ setDialogAccepted(ok);
+ return retVal;
+}
+
+QString DeclarativeInputDialogAttached::getItem(const QStringList &items)
+{
+ QWidget *parent = bestParentWindow(d->dialogParent);
+ bool ok = false;
+
+ const QString retVal = QInputDialog::getItem(parent, d->title, d->label, items, d->currentItem, d->itemsEditable, &ok);
+
+ setDialogAccepted(ok);
+ return retVal;
+}
+
+QString DeclarativeInputDialogAttached::getText()
+{
+ QWidget *parent = bestParentWindow(d->dialogParent);
+ bool ok = false;
+
+ const QString retVal = QInputDialog::getText(parent, d->title, d->label, d->echoMode, d->text, &ok);
+
+ setDialogAccepted(ok);
+ return retVal;
+}
+
+void DeclarativeInputDialogAttached::setDialogAccepted(bool accepted)
+{
+ if (accepted == d->dialogAccepted)
+ return;
+
+ d->dialogAccepted = accepted;
+ emit dialogAcceptedChanged(accepted);
+}
+
+QWidget *DeclarativeInputDialogAttached::bestParentWindow(QObject *parent) const
+{
+ if (!parent)
+ parent = this->parent();
+
+ // if parent is a Declarative Object, search the proxied hierarchy
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject)
+ parent = declarativeObject->object();
+
+ while (parent) {
+ QWidget *widget = qobject_cast<QWidget*>(parent);
+ if (widget)
+ return widget->topLevelWidget();
+
+ parent = parent->parent();
+ }
+
+ return 0;
+}
+
+DeclarativeInputDialog::DeclarativeInputDialog(QObject *parent) : DeclarativeWidgetProxy<InputDialog>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeInputDialogAttached *DeclarativeInputDialog::qmlAttachedProperties(QObject *parent)
+{
+ return new DeclarativeInputDialogAttached(parent);
+}
+
+CUSTOM_METAOBJECT(DeclarativeInputDialog, InputDialog)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEINPUTDIALOG_P_H
+#define DECLARATIVEINPUTDIALOG_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeInputDialogAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QObject* parent READ dialogParent WRITE setDialogParent NOTIFY dialogParentChanged)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+ Q_PROPERTY(bool ok READ dialogAccepted NOTIFY dialogAcceptedChanged)
+
+ Q_PROPERTY(QVariant value READ value WRITE setValue NOTIFY valueChanged)
+ Q_PROPERTY(QVariant min READ min WRITE setMin NOTIFY minChanged)
+ Q_PROPERTY(QVariant max READ max WRITE setMax NOTIFY maxChanged)
+ Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
+ Q_PROPERTY(int step READ step WRITE setStep NOTIFY stepChanged)
+
+ Q_PROPERTY(int current READ currentItem WRITE setCurrentItem NOTIFY currentItemChanged)
+ Q_PROPERTY(bool editable READ itemsEditable WRITE setItemsEditable NOTIFY itemsEditableChanged)
+
+ Q_PROPERTY(QLineEdit::EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
+
+ public:
+ DeclarativeInputDialogAttached(QObject *parent = 0);
+ ~DeclarativeInputDialogAttached();
+
+ void setDialogParent(QObject *parent);
+ QObject *dialogParent() const;
+
+ void setTitle(const QString &title);
+ QString title() const;
+
+ void setLabel(const QString &label);
+ QString label() const;
+
+ bool dialogAccepted() const;
+
+ void setValue(const QVariant &value);
+ QVariant value() const;
+
+ void setMin(const QVariant &min);
+ QVariant min() const;
+
+ void setMax(const QVariant &max);
+ QVariant max() const;
+
+ void setDecimals(int decimals);
+ int decimals() const;
+
+ void setStep(int step);
+ int step() const;
+
+ void setCurrentItem(int current);
+ int currentItem() const;
+
+ void setItemsEditable(bool editable);
+ bool itemsEditable() const;
+
+ void setEchoMode(QLineEdit::EchoMode echoMode);
+ QLineEdit::EchoMode echoMode() const;
+
+ void setText(const QString &text);
+ QString text() const;
+
+ Q_INVOKABLE double getDouble();
+
+ Q_INVOKABLE int getInt();
+
+ Q_INVOKABLE QString getItem(const QStringList &items);
+
+ Q_INVOKABLE QString getText();
+
+ Q_SIGNALS:
+ void dialogParentChanged(QObject *parent);
+ void titleChanged(const QString &title);
+ void labelChanged(const QString &label);
+ void dialogAcceptedChanged(bool accepted);
+
+ void valueChanged(const QVariant &value);
+ void minChanged(const QVariant &min);
+ void maxChanged(const QVariant &max);
+ void decimalsChanged(int decimals);
+ void stepChanged(int step);
+
+ void currentItemChanged(int current);
+ void itemsEditableChanged(bool editable);
+
+ void echoModeChanged(QLineEdit::EchoMode echoMode);
+ void textChanged(const QString &text);
+
+ private:
+ void setDialogAccepted(bool accepted);
+ QWidget *bestParentWindow(QObject *parent) const;
+
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeInputDialog : public DeclarativeWidgetProxy<InputDialog>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeInputDialog(QObject *parent = 0);
+
+ static DeclarativeInputDialogAttached *qmlAttachedProperties(QObject *parent);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeInputDialog, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativelabel_p.h"
+
+DeclarativeLabel::DeclarativeLabel(QObject *parent)
+ : DeclarativeWidgetProxy<QLabel>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeLabel, QLabel)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVELABEL_P_H
+#define DECLARATIVELABEL_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QLabel>
+
+class DeclarativeLabel : public DeclarativeWidgetProxy<QLabel>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeLabel(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVELAYOUTPROXY_P_H
+#define DECLARATIVELAYOUTPROXY_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include <QLayout>
+#include <QWidget>
+
+template <class T>
+class DeclarativeLayoutProxy : public DeclarativeObjectProxy<T>
+{
+ public:
+ DeclarativeLayoutProxy(QObject *parent = 0) : DeclarativeObjectProxy<T>(parent) {}
+
+ protected:
+ virtual void dataAppend(QObject *object)
+ {
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(object);
+ if (declarativeObject) {
+ QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
+ if (widget) {
+ addWidget(widget, declarativeObject);
+ return;
+ }
+
+ QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
+ if (layout) {
+ addLayout(layout, declarativeObject);
+ return;
+ }
+ }
+
+ DeclarativeObjectProxy<T>::dataAppend(object);
+ }
+
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+ {
+ DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
+ DeclarativeObjectProxy<T>::m_proxiedObject->addWidget(widget);
+ }
+
+ virtual void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject) = 0;
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativelcdnumber_p.h"
+
+DeclarativeLCDNumber::DeclarativeLCDNumber(QObject *parent)
+ : DeclarativeWidgetProxy<QLCDNumber>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeLCDNumber, QLCDNumber)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVELCDNUMBER_P_H
+#define DECLARATIVELCDNUMBER_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QLCDNumber>
+
+class DeclarativeLCDNumber : public DeclarativeWidgetProxy<QLCDNumber>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeLCDNumber(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativelineedit_p.h"
+
+DeclarativeLineEdit::DeclarativeLineEdit(QObject *parent)
+ : DeclarativeWidgetProxy<QLineEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeLineEdit, QLineEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVELINEEDIT_P_H
+#define DECLARATIVELINEEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QLineEdit>
+
+class DeclarativeLineEdit : public DeclarativeWidgetProxy<QLineEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeLineEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativelistview_p.h"
+
+DeclarativeListView::DeclarativeListView(QObject *parent)
+ : DeclarativeWidgetProxy<ListView>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeListView, ListView)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVELISTVIEW_P_H
+#define DECLARATIVELISTVIEW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeListView : public DeclarativeWidgetProxy<ListView>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeListView(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativemainwindow_p.h"
+
+#include <QMenuBar>
+#include <QStatusBar>
+#include <QToolBar>
+
+DeclarativeMainWindow::DeclarativeMainWindow(QObject *parent)
+ : DeclarativeWidgetProxy<QMainWindow>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeMainWindow::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ QMenuBar *menuBar = qobject_cast<QMenuBar*>(widget);
+ QToolBar *toolBar = qobject_cast<QToolBar*>(widget);
+ QStatusBar *statusBar = qobject_cast<QStatusBar*>(widget);
+ QDialog *dialog = qobject_cast<QDialog*>(widget);
+
+ if (menuBar) {
+ m_proxiedObject->setMenuBar(menuBar);
+ } else if (toolBar) {
+ m_proxiedObject->addToolBar(toolBar);
+ } else if (statusBar) {
+ m_proxiedObject->setStatusBar(statusBar);
+ } else if (dialog) {
+ // We allow to place dialogs on the mainwindow
+ dialog->setParent(m_proxiedObject, dialog->windowFlags());
+ } else if (widget) {
+ if (m_proxiedObject->centralWidget()) {
+ qmlInfo(declarativeObject) << "The QMainWindow contains a central widget already";
+ return;
+ }
+
+ m_proxiedObject->setCentralWidget(widget);
+ }
+
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeMainWindow::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not set a QLayout to a QMainWindow";
+}
+
+CUSTOM_METAOBJECT(DeclarativeMainWindow, QMainWindow)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEMAINWINDOW_P_H
+#define DECLARATIVEMAINWINDOW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QMainWindow>
+
+class DeclarativeMainWindow : public DeclarativeWidgetProxy<QMainWindow>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeMainWindow(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativemenu_p.h"
+
+#include "declarativeseparator_p.h"
+
+DeclarativeMenu::DeclarativeMenu(QObject *parent)
+ : DeclarativeWidgetProxy<QMenu>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeMenu::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ QMenu *menu = qobject_cast<QMenu*>(widget);
+ if (!menu) {
+ qmlInfo(declarativeObject) << "The QMenu can only contain QMenu, QAction or Separator";
+ return;
+ }
+
+ m_proxiedObject->addMenu(menu);
+
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeMenu::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not set a QLayout to a QMenu";
+}
+
+void DeclarativeMenu::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
+{
+ DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
+
+ if (separator) {
+ m_proxiedObject->addSeparator();
+ } else {
+ m_proxiedObject->addAction(action);
+ }
+
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeMenu, QMenu)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEMENU_P_H
+#define DECLARATIVEMENU_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QMenu>
+
+class DeclarativeMenu : public DeclarativeWidgetProxy<QMenu>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeMenu(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+ virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativemenubar_p.h"
+
+#include "declarativeseparator_p.h"
+
+DeclarativeMenuBar::DeclarativeMenuBar(QObject *parent)
+ : DeclarativeWidgetProxy<QMenuBar>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeMenuBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ QMenu *menu = qobject_cast<QMenu*>(widget);
+ if (!menu) {
+ qmlInfo(declarativeObject) << "The QMenuBar can only contain QMenus";
+ return;
+ }
+
+ m_proxiedObject->addMenu(menu);
+
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeMenuBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not set a QLayout to a QMenuBar";
+}
+
+void DeclarativeMenuBar::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(action)
+
+ DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
+
+ if (separator) {
+ m_proxiedObject->addSeparator();
+ }
+
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeMenuBar, QMenuBar)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEMENUBAR_P_H
+#define DECLARATIVEMENUBAR_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QMenuBar>
+
+class DeclarativeMenuBar : public DeclarativeWidgetProxy<QMenuBar>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeMenuBar(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+ virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativemessagebox_p.h"
+
+DeclarativeMessageBoxAttached::DeclarativeMessageBoxAttached(QObject *parent)
+ : QObject(parent)
+{
+}
+
+void DeclarativeMessageBoxAttached::about(QObject *parent, const QString &title, const QString &text)
+{
+ QMessageBox::about(bestParentWindow(parent), title, text);
+}
+
+void DeclarativeMessageBoxAttached::aboutQt(QObject *parent, const QString &title)
+{
+ QMessageBox::aboutQt(bestParentWindow(parent), title);
+}
+
+int DeclarativeMessageBoxAttached::critical(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
+{
+ return QMessageBox::critical(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
+}
+
+int DeclarativeMessageBoxAttached::information(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
+{
+ return QMessageBox::information(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
+}
+
+int DeclarativeMessageBoxAttached::question(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
+{
+ return QMessageBox::question(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
+}
+
+int DeclarativeMessageBoxAttached::warning(QObject *parent, const QString &title, const QString &text, int buttons, int defaultButton)
+{
+ return QMessageBox::warning(bestParentWindow(parent), title, text, static_cast<QMessageBox::StandardButtons>(buttons), static_cast<QMessageBox::StandardButton>(defaultButton));
+}
+
+QWidget *DeclarativeMessageBoxAttached::bestParentWindow(QObject *parent) const
+{
+ if (!parent)
+ parent = this->parent();
+
+ // if parent is a Declarative Object, search the proxied hierarchy
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject)
+ parent = declarativeObject->object();
+
+ while (parent) {
+ QWidget *widget = qobject_cast<QWidget*>(parent);
+ if (widget)
+ return widget->topLevelWidget();
+
+ parent = parent->parent();
+ }
+
+ return 0;
+}
+
+DeclarativeMessageBox::DeclarativeMessageBox(QObject *parent) : DeclarativeObjectProxy<QMessageBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeMessageBoxAttached *DeclarativeMessageBox::qmlAttachedProperties(QObject *parent)
+{
+ return new DeclarativeMessageBoxAttached(parent);
+}
+
+CUSTOM_METAOBJECT(DeclarativeMessageBox, QMessageBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEMESSAGEBOX_P_H
+#define DECLARATIVEMESSAGEBOX_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include <QMessageBox>
+
+class DeclarativeMessageBoxAttached : public QObject
+{
+ Q_OBJECT
+
+ public:
+ DeclarativeMessageBoxAttached(QObject *parent = 0);
+
+ Q_INVOKABLE void about(QObject *parent, const QString &title, const QString &text);
+ Q_INVOKABLE void aboutQt(QObject *parent, const QString &title);
+ Q_INVOKABLE int critical(QObject *parent, const QString &title, const QString &text,
+ int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
+ Q_INVOKABLE int information(QObject *parent, const QString &title, const QString &text,
+ int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
+ Q_INVOKABLE int question(QObject *parent, const QString &title, const QString &text,
+ int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
+ Q_INVOKABLE int warning(QObject *parent, const QString &title, const QString &text,
+ int buttons = QMessageBox::Ok, int defaultButton = QMessageBox::NoButton);
+
+ private:
+ QWidget *bestParentWindow(QObject *parent) const;
+};
+
+class DeclarativeMessageBox : public DeclarativeObjectProxy<QMessageBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeMessageBox(QObject *parent = 0);
+
+ static DeclarativeMessageBoxAttached *qmlAttachedProperties(QObject *parent);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeMessageBox, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEOBJECTPROXY_P_H
+#define DECLARATIVEOBJECTPROXY_P_H
+
+#include "abstractdeclarativeobject_p.h"
+
+#include <qdeclarative.h>
+#include <QDeclarativeInfo>
+#include <QPointer>
+#include <QVector>
+
+#define DECLARATIVE_OBJECT \
+ public: \
+ Q_OBJECT_CHECK \
+ static QMetaObject staticMetaObject; \
+ static bool metaObjectInitialized; \
+ static bool initializeMetaObject(); \
+ static const QMetaObject &getStaticMetaObject(); \
+ virtual const QMetaObject *metaObject() const; \
+ virtual void *qt_metacast(const char *); \
+ virtual int qt_metacall(QMetaObject::Call, int, void **); \
+ private: \
+
+
+template <class T, bool needsParentInitialization = false>
+class DeclarativeObjectProxy : public AbstractDeclarativeObject
+{
+};
+
+template <class T>
+class DeclarativeObjectProxy<T, false> : public AbstractDeclarativeObject
+{
+ public:
+ DeclarativeObjectProxy(QObject *parent = 0) : AbstractDeclarativeObject(parent), m_proxiedObject(new T) {}
+ ~DeclarativeObjectProxy() { delete m_proxiedObject; }
+
+ virtual QObject *object() const { return m_proxiedObject.data(); }
+
+ protected:
+ virtual void dataAppend(QObject *object)
+ {
+ m_children.append(object);
+ }
+
+ virtual int dataCount() const { return m_children.count(); }
+ virtual QObject *dataAt(int index) const { return m_children.at(index); }
+ virtual void dataClear()
+ {
+ qDeleteAll(m_children);
+ m_children.clear();
+ }
+
+ protected:
+ QPointer<T> m_proxiedObject;
+ QVector<QObject*> m_children;
+};
+
+template <class T>
+class DeclarativeObjectProxy<T, true> : public AbstractDeclarativeObject
+{
+ public:
+ DeclarativeObjectProxy(QObject *parent = 0) : AbstractDeclarativeObject(parent), m_proxiedObject(new T(0)) {}
+ ~DeclarativeObjectProxy() { delete m_proxiedObject; }
+
+ virtual QObject *object() const { return m_proxiedObject.data(); }
+
+ protected:
+ virtual void dataAppend(QObject *object)
+ {
+ m_children.append(object);
+ }
+
+ virtual int dataCount() const { return m_children.count(); }
+ virtual QObject *dataAt(int index) const { return m_children.at(index); }
+ virtual void dataClear()
+ {
+ qDeleteAll(m_children);
+ m_children.clear();
+ }
+
+ protected:
+ QPointer<T> m_proxiedObject;
+ QVector<QObject*> m_children;
+};
+
+//TODO: Find a solution to make the macro public but the usage of QMetaObjectBuilder private
+
+#include "qmetaobjectbuilder_p.h"
+
+#define CUSTOM_METAOBJECT(ClassName, ProxyObjectType) \
+QMetaObject ClassName::staticMetaObject;\
+bool ClassName::metaObjectInitialized = ClassName::initializeMetaObject(); \
+bool ClassName::initializeMetaObject() \
+{ \
+ QMetaObjectBuilder builder; \
+ const QMetaObject *mo = &ProxyObjectType::staticMetaObject; \
+ builder.addMetaObject(mo); \
+ builder.addMetaObject(&AbstractDeclarativeObject::staticMetaObject); \
+ builder.setSuperClass(ProxyObjectType::staticMetaObject.superClass()); \
+ builder.setClassName(""#ClassName); \
+ ClassName::staticMetaObject = *builder.toMetaObject(); \
+ return true; \
+} \
+const QMetaObject &ClassName::getStaticMetaObject() \
+{ \
+ return ClassName::staticMetaObject; \
+} \
+const QMetaObject* ClassName::metaObject() const \
+{ \
+ return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; \
+} \
+void* ClassName::qt_metacast(const char*) \
+{ \
+ return 0; \
+} \
+int ClassName::qt_metacall(QMetaObject::Call call, int id, void **argv) \
+{ \
+ if (call == QMetaObject::ReadProperty || call == QMetaObject::WriteProperty) { \
+ if (id >= ProxyObjectType::staticMetaObject.propertyCount()) { \
+ id = AbstractDeclarativeObject::qt_metacall(call, id - ProxyObjectType::staticMetaObject.propertyCount() + 1, argv); \
+ id += ProxyObjectType::staticMetaObject.propertyCount() - 1; \
+ } else { \
+ id = m_proxiedObject->qt_metacall(call, id, argv); \
+ } \
+ if (id < 0) \
+ return 0; \
+ } else if (call == QMetaObject::InvokeMetaMethod) {\
+ if (ClassName::staticMetaObject.method(id).methodType() == QMetaMethod::Signal) \
+ QMetaObject::activate(this, id, argv); \
+ else \
+ id = m_proxiedObject->qt_metacall(call, id, argv); \
+ id -= 1; \
+ } \
+ return id; \
+}
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeplaintextedit_p.h"
+
+DeclarativePlainTextEdit::DeclarativePlainTextEdit(QObject *parent)
+ : DeclarativeWidgetProxy<QPlainTextEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativePlainTextEdit, QPlainTextEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEPLAINTEXTEDIT_P_H
+#define DECLARATIVEPLAINTEXTEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QPlainTextEdit>
+
+class DeclarativePlainTextEdit : public DeclarativeWidgetProxy<QPlainTextEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativePlainTextEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeprogressbar_p.h"
+
+DeclarativeProgressBar::DeclarativeProgressBar(QObject *parent)
+ : DeclarativeWidgetProxy<QProgressBar>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeProgressBar, QProgressBar)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEPROGRESSBAR_P_H
+#define DECLARATIVEPROGRESSBAR_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QProgressBar>
+
+class DeclarativeProgressBar : public DeclarativeWidgetProxy<QProgressBar>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeProgressBar(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativepushbutton_p.h"
+
+DeclarativePushButton::DeclarativePushButton(QObject *parent)
+ : DeclarativeWidgetProxy<QPushButton>(parent)
+{
+ connectAllSignals(m_proxiedObject, this, QSet<QByteArray>() << "clicked()");
+}
+
+CUSTOM_METAOBJECT(DeclarativePushButton, QPushButton)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEPUSHBUTTON_P_H
+#define DECLARATIVEPUSHBUTTON_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QPushButton>
+
+class DeclarativePushButton : public DeclarativeWidgetProxy<QPushButton>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativePushButton(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeradiobutton_p.h"
+
+DeclarativeRadioButton::DeclarativeRadioButton(QObject *parent)
+ : DeclarativeWidgetProxy<QRadioButton>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeRadioButton, QRadioButton)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVERADIOBUTTON_P_H
+#define DECLARATIVERADIOBUTTON_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QRadioButton>
+
+class DeclarativeRadioButton : public DeclarativeWidgetProxy<QRadioButton>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeRadioButton(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativescrollarea_p.h"
+
+DeclarativeScrollArea::DeclarativeScrollArea(QObject *parent)
+ : DeclarativeWidgetProxy<QScrollArea>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeScrollArea::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ if (m_proxiedObject->widget()) {
+ qmlInfo(declarativeObject) << "Can not add multiple Widgets to ScrollArea";
+ } else {
+ m_proxiedObject->setWidget(widget);
+ }
+
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeScrollArea::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not add Layout to ScrollArea";
+}
+
+CUSTOM_METAOBJECT(DeclarativeScrollArea, QScrollArea)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESCROLLAREA_P_H
+#define DECLARATIVESCROLLAREA_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QScrollArea>
+
+class DeclarativeScrollArea : public DeclarativeWidgetProxy<QScrollArea>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeScrollArea(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativescrollbar_p.h"
+
+DeclarativeScrollBar::DeclarativeScrollBar(QObject *parent)
+ : DeclarativeWidgetProxy<QScrollBar>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeScrollBar, QScrollBar)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESCROLLBAR_P_H
+#define DECLARATIVESCROLLBAR_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QScrollBar>
+
+class DeclarativeScrollBar : public DeclarativeWidgetProxy<QScrollBar>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeScrollBar(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeseparator_p.h"
+
+DeclarativeSeparator::DeclarativeSeparator(QObject *parent)
+ : DeclarativeObjectProxy<QAction, true>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeSeparator, QAction)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESEPARATOR_P_H
+#define DECLARATIVESEPARATOR_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include <QAction>
+
+class DeclarativeSeparator : public DeclarativeObjectProxy<QAction, true>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeSeparator(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativeslider_p.h"
+
+DeclarativeSlider::DeclarativeSlider(QObject *parent)
+ : DeclarativeWidgetProxy<QSlider>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeSlider, QSlider)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESLIDER_P_H
+#define DECLARATIVESLIDER_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QSlider>
+
+class DeclarativeSlider : public DeclarativeWidgetProxy<QSlider>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeSlider(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativespinbox_p.h"
+
+DeclarativeSpinBox::DeclarativeSpinBox(QObject *parent)
+ : DeclarativeWidgetProxy<QSpinBox>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeSpinBox, QSpinBox)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESPINBOX_P_H
+#define DECLARATIVESPINBOX_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QSpinBox>
+
+class DeclarativeSpinBox : public DeclarativeWidgetProxy<QSpinBox>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeSpinBox(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativestackedlayout_p.h"
+
+DeclarativeStackedLayout::DeclarativeStackedLayout(QObject *parent)
+ : DeclarativeLayoutProxy<StackedLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeStackedLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ m_proxiedObject->addWidget(widget);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeStackedLayout::addLayout(QLayout*, AbstractDeclarativeObject *declarativeObject)
+{
+ qmlInfo(declarativeObject) << "StackedLayout does not support child layouts";
+}
+
+CUSTOM_METAOBJECT(DeclarativeStackedLayout, StackedLayout)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESTACKEDLAYOUT_P_H
+#define DECLARATIVESTACKEDLAYOUT_P_H
+
+#include "declarativelayoutproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeStackedLayout : public DeclarativeLayoutProxy<StackedLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeStackedLayout(QObject *parent = 0);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativestackedwidget_p.h"
+
+DeclarativeStackedWidget::DeclarativeStackedWidget(QObject *parent)
+ : DeclarativeWidgetProxy<QStackedWidget>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeStackedWidget::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ m_proxiedObject->addWidget(widget);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeStackedWidget::setLayout(QLayout*, AbstractDeclarativeObject *declarativeObject)
+{
+ qmlInfo(declarativeObject) << "StackedWidget does not support child layouts";
+}
+
+CUSTOM_METAOBJECT(DeclarativeStackedWidget, QStackedWidget)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESTACKEDWIDGET_P_H
+#define DECLARATIVESTACKEDWIDGET_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QStackedWidget>
+
+class DeclarativeStackedWidget : public DeclarativeWidgetProxy<QStackedWidget>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeStackedWidget(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativestatusbar_p.h"
+
+class DeclarativeStatusBarAttached::Private
+{
+ public:
+ int stretch;
+};
+
+DeclarativeStatusBarAttached::DeclarativeStatusBarAttached(QObject *parent)
+ : QObject(parent), d(new DeclarativeStatusBarAttached::Private)
+{
+ d->stretch = 0;
+}
+
+DeclarativeStatusBarAttached::~DeclarativeStatusBarAttached()
+{
+ delete d;
+}
+
+void DeclarativeStatusBarAttached::setStretch(int stretch)
+{
+ if (d->stretch == stretch)
+ return;
+
+ d->stretch = stretch;
+ emit stretchChanged();
+}
+
+int DeclarativeStatusBarAttached::stretch() const
+{
+ return d->stretch;
+}
+
+DeclarativeStatusBar::DeclarativeStatusBar(QObject *parent)
+ : DeclarativeWidgetProxy<QStatusBar>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeStatusBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ // TODO: error when layout is set
+
+ m_children.append(declarativeObject);
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeStatusBar>(declarativeObject, false);
+ DeclarativeStatusBarAttached *attached = qobject_cast<DeclarativeStatusBarAttached*>(attachedProperties);
+
+ int stretch = 0;
+ if (attached) {
+ stretch = attached->stretch();
+ }
+
+ m_proxiedObject->addPermanentWidget(widget, stretch);
+}
+
+void DeclarativeStatusBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not add QLayout to QStatusBar";
+}
+
+DeclarativeStatusBarAttached *DeclarativeStatusBar::qmlAttachedProperties(QObject *object)
+{
+ return new DeclarativeStatusBarAttached(object);
+}
+
+CUSTOM_METAOBJECT(DeclarativeStatusBar, QStatusBar)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVESTATUSBAR_P_H
+#define DECLARATIVESTATUSBAR_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QStatusBar>
+
+class DeclarativeStatusBarAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int stretch READ stretch WRITE setStretch NOTIFY stretchChanged)
+
+ public:
+ DeclarativeStatusBarAttached(QObject *parent = 0);
+ ~DeclarativeStatusBarAttached();
+
+ void setStretch(int stretch);
+ int stretch() const;
+
+ Q_SIGNALS:
+ void stretchChanged();
+
+ private:
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeStatusBar : public DeclarativeWidgetProxy<QStatusBar>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeStatusBar(QObject *parent = 0);
+
+ static DeclarativeStatusBarAttached *qmlAttachedProperties(QObject *object);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeStatusBar, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetableview_p.h"
+
+DeclarativeTableView::DeclarativeTableView(QObject *parent)
+ : DeclarativeWidgetProxy<TableView>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTableView, TableView)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETABLEVIEW_P_H
+#define DECLARATIVETABLEVIEW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeTableView : public DeclarativeWidgetProxy<TableView>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTableView(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetabwidget_p.h"
+
+class DeclarativeTabWidgetAttached::Private
+{
+ public:
+ QString label;
+ QIcon icon;
+ QPointer<QTabWidget> tabWidget;
+ int index;
+};
+
+DeclarativeTabWidgetAttached::DeclarativeTabWidgetAttached(QObject *parent)
+ : QObject(parent), d(new DeclarativeTabWidgetAttached::Private)
+{
+}
+
+DeclarativeTabWidgetAttached::~DeclarativeTabWidgetAttached()
+{
+ delete d;
+}
+
+void DeclarativeTabWidgetAttached::setLabel(const QString &label)
+{
+ if (label == d->label)
+ return;
+
+ d->label = label;
+
+ if (d->tabWidget)
+ d->tabWidget->setTabText(d->index, d->label);
+
+ emit labelChanged(label);
+}
+
+QString DeclarativeTabWidgetAttached::label() const
+{
+ return d->label;
+}
+
+void DeclarativeTabWidgetAttached::setIcon(const QIcon &icon)
+{
+ d->icon = icon;
+
+ if (d->tabWidget)
+ d->tabWidget->setTabIcon(d->index, d->icon);
+
+ emit iconChanged(icon);
+}
+
+QIcon DeclarativeTabWidgetAttached::icon() const
+{
+ return d->icon;
+}
+
+void DeclarativeTabWidgetAttached::setAssociation(QTabWidget *widget, int index)
+{
+ d->tabWidget = widget;
+ d->index = index;
+}
+
+DeclarativeTabWidget::DeclarativeTabWidget(QObject *parent)
+ : DeclarativeWidgetProxy<QTabWidget>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeTabWidget::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ // TODO: error when layout is set
+
+ m_children.append(declarativeObject);
+
+ QString label;
+ QIcon icon;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeTabWidget>(declarativeObject, false);
+ DeclarativeTabWidgetAttached *tabHeader = qobject_cast<DeclarativeTabWidgetAttached*>(attachedProperties);
+ if (tabHeader) {
+ label = tabHeader->label();
+ icon = tabHeader->icon();
+ }
+
+ const int index = m_proxiedObject->addTab(widget, icon, label);
+ if (tabHeader)
+ tabHeader->setAssociation(m_proxiedObject, index);
+}
+
+void DeclarativeTabWidget::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not add QLayout to QTabWidget";
+}
+
+DeclarativeTabWidgetAttached *DeclarativeTabWidget::qmlAttachedProperties(QObject *object)
+{
+ return new DeclarativeTabWidgetAttached(object);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTabWidget, QTabWidget)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETABWIDGET_P_H
+#define DECLARATIVETABWIDGET_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QTabWidget>
+
+class DeclarativeTabWidgetAttached : public QObject
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QString label READ label WRITE setLabel NOTIFY labelChanged)
+ Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY iconChanged)
+
+ public:
+ DeclarativeTabWidgetAttached(QObject *parent = 0);
+ ~DeclarativeTabWidgetAttached();
+
+ void setLabel(const QString &label);
+ QString label() const;
+
+ void setIcon(const QIcon &icon);
+ QIcon icon() const;
+
+ void setAssociation(QTabWidget *widget, int index);
+
+ Q_SIGNALS:
+ void labelChanged(const QString &label);
+ void iconChanged(const QIcon &icon);
+
+ private:
+ class Private;
+ Private *const d;
+};
+
+class DeclarativeTabWidget : public DeclarativeWidgetProxy<QTabWidget>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTabWidget(QObject *parent = 0);
+
+ static DeclarativeTabWidgetAttached *qmlAttachedProperties(QObject *object);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeTabWidget, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetextbrowser_p.h"
+
+DeclarativeTextBrowser::DeclarativeTextBrowser(QObject *parent)
+ : DeclarativeWidgetProxy<QTextBrowser>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTextBrowser, QTextBrowser)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETEXTBROWSER_P_H
+#define DECLARATIVETEXTBROWSER_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QTextBrowser>
+
+class DeclarativeTextBrowser : public DeclarativeWidgetProxy<QTextBrowser>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTextBrowser(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetextedit_p.h"
+
+DeclarativeTextEdit::DeclarativeTextEdit(QObject *parent)
+ : DeclarativeWidgetProxy<TextEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTextEdit, TextEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETEXTEDIT_P_H
+#define DECLARATIVETEXTEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeTextEdit : public DeclarativeWidgetProxy<TextEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTextEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetimeedit_p.h"
+
+DeclarativeTimeEdit::DeclarativeTimeEdit(QObject *parent)
+ : DeclarativeWidgetProxy<QTimeEdit>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTimeEdit, QTimeEdit)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETIMEEDIT_P_H
+#define DECLARATIVETIMEEDIT_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QTimeEdit>
+
+class DeclarativeTimeEdit : public DeclarativeWidgetProxy<QTimeEdit>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTimeEdit(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetoolbar_p.h"
+
+#include "declarativeseparator_p.h"
+
+DeclarativeToolBar::DeclarativeToolBar(QObject *parent)
+ : DeclarativeWidgetProxy<QToolBar>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeToolBar::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ m_proxiedObject->addWidget(widget);
+
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeToolBar::setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ Q_UNUSED(layout);
+ Q_UNUSED(declarativeObject);
+ qmlInfo(this) << "Can not set a QLayout to a QToolBar";
+}
+
+void DeclarativeToolBar::addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
+{
+ DeclarativeSeparator *separator = dynamic_cast<DeclarativeSeparator*>(declarativeObject);
+
+ if (separator) {
+ m_proxiedObject->addSeparator();
+ } else {
+ m_proxiedObject->addAction(action);
+ }
+
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeToolBar, QToolBar)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETOOLBAR_P_H
+#define DECLARATIVETOOLBAR_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QToolBar>
+
+class DeclarativeToolBar : public DeclarativeWidgetProxy<QToolBar>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeToolBar(QObject *parent = 0);
+
+ protected:
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+ virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetoolbutton_p.h"
+
+DeclarativeToolButton::DeclarativeToolButton(QObject *parent)
+ : DeclarativeWidgetProxy<QToolButton>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeToolButton, QToolButton)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETOOLBUTTON_P_H
+#define DECLARATIVETOOLBUTTON_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QToolButton>
+
+class DeclarativeToolButton : public DeclarativeWidgetProxy<QToolButton>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeToolButton(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativetreeview_p.h"
+
+DeclarativeTreeView::DeclarativeTreeView(QObject *parent)
+ : DeclarativeWidgetProxy<TreeView>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeTreeView, TreeView)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVETREEVIEW_P_H
+#define DECLARATIVETREEVIEW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include "objectadaptors_p.h"
+
+class DeclarativeTreeView : public DeclarativeWidgetProxy<TreeView>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeTreeView(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativevboxlayout_p.h"
+
+DeclarativeVBoxLayout::DeclarativeVBoxLayout(QObject *parent)
+ : DeclarativeLayoutProxy<QVBoxLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+DeclarativeBoxLayoutAttached *DeclarativeVBoxLayout::qmlAttachedProperties(QObject *parent)
+{
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(parent);
+ if (declarativeObject) {
+ QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
+ if (widget)
+ return new DeclarativeBoxLayoutAttached(widget, parent);
+
+ QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
+ if (layout)
+ return new DeclarativeBoxLayoutAttached(layout, parent);
+ }
+
+ qmlInfo(parent) << "Can only attach VBoxLayout to widgets and layouts";
+ return 0;
+}
+
+void DeclarativeVBoxLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ int stretch = 0;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeVBoxLayout>(declarativeObject, false);
+ DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
+ if (properties) {
+ stretch = properties->stretch();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addWidget(widget, stretch, alignment);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeVBoxLayout::addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+{
+ int stretch = 0;
+ Qt::Alignment alignment = 0;
+
+ QObject *attachedProperties = qmlAttachedPropertiesObject<DeclarativeVBoxLayout>(declarativeObject, false);
+ DeclarativeBoxLayoutAttached *properties = qobject_cast<DeclarativeBoxLayoutAttached*>(attachedProperties);
+ if (properties) {
+ stretch = properties->stretch();
+ alignment = properties->alignment();
+
+ properties->setParentLayout(m_proxiedObject);
+ }
+
+ m_proxiedObject->addLayout(layout, stretch);
+ m_proxiedObject->setAlignment(layout, alignment);
+ m_children.append(declarativeObject);
+}
+
+CUSTOM_METAOBJECT(DeclarativeVBoxLayout, QVBoxLayout)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEVBOXLAYOUT_P_H
+#define DECLARATIVEVBOXLAYOUT_P_H
+
+#include "declarativeboxlayout_p.h"
+#include "declarativelayoutproxy_p.h"
+
+#include <QVBoxLayout>
+
+class DeclarativeVBoxLayout : public DeclarativeLayoutProxy<QVBoxLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeVBoxLayout(QObject *parent = 0);
+
+ static DeclarativeBoxLayoutAttached *qmlAttachedProperties(QObject *parent);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
+QML_DECLARE_TYPEINFO(DeclarativeVBoxLayout, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativewebview_p.h"
+
+DeclarativeWebView::DeclarativeWebView(QObject *parent)
+ : DeclarativeWidgetProxy<QWebView>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeWebView, QWebView)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEWEBVIEW_P_H
+#define DECLARATIVEWEBVIEW_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QWebView>
+
+class DeclarativeWebView : public DeclarativeWidgetProxy<QWebView>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeWebView(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativewidget_p.h"
+
+DeclarativeWidget::DeclarativeWidget(QObject *parent)
+ : DeclarativeWidgetProxy<QWidget>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+CUSTOM_METAOBJECT(DeclarativeWidget, QWidget)
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEWIDGET_P_H
+#define DECLARATIVEWIDGET_P_H
+
+#include "declarativewidgetproxy_p.h"
+
+#include <QWidget>
+
+class DeclarativeWidget : public DeclarativeWidgetProxy<QWidget>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeWidget(QObject *parent = 0);
+};
+
+#endif
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEWIDGETPROXY_P_H
+#define DECLARATIVEWIDGETPROXY_P_H
+
+#include "declarativeobjectproxy_p.h"
+
+#include "declarativeactionitem_p.h"
+
+#include <QAction>
+#include <QLayout>
+
+template <class T>
+class DeclarativeWidgetProxy : public DeclarativeObjectProxy<T>
+{
+ public:
+ DeclarativeWidgetProxy(QObject *parent = 0) : DeclarativeObjectProxy<T>(parent) {}
+
+ protected:
+ virtual void dataAppend(QObject *object)
+ {
+ AbstractDeclarativeObject *declarativeObject = dynamic_cast<AbstractDeclarativeObject*>(object);
+ if (declarativeObject) {
+ QWidget *widget = qobject_cast<QWidget*>(declarativeObject->object());
+ if (widget) {
+ addWidget(widget, declarativeObject);
+ return;
+ }
+
+ QLayout *layout = qobject_cast<QLayout*>(declarativeObject->object());
+ if (layout) {
+ // TODO: error when widget is set
+
+ if (DeclarativeObjectProxy<T>::m_proxiedObject->layout()) {
+ qmlInfo(this) << "Can not add a second Layout";
+ return;
+ }
+
+ setLayout(layout, declarativeObject);
+ return;
+ }
+
+ DeclarativeActionItem *declarativeActionItem = dynamic_cast<DeclarativeActionItem*>(object);
+ if (declarativeActionItem) {
+ addAction(qobject_cast<ActionItem*>(declarativeActionItem->object())->action(), declarativeObject);
+ return;
+ }
+
+ QAction *action = qobject_cast<QAction*>(declarativeObject->object());
+ if (action) {
+ addAction(action, declarativeObject);
+ return;
+ }
+
+ addQObject(declarativeObject->object(), declarativeObject);
+ return;
+ }
+
+ DeclarativeObjectProxy<T>::dataAppend(object);
+ }
+
+ virtual void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+ {
+ Q_UNUSED(declarativeObject);
+ DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
+ widget->setParent(DeclarativeObjectProxy<T>::m_proxiedObject, widget->windowFlags());
+ }
+
+ virtual void setLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject)
+ {
+ DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
+ DeclarativeObjectProxy<T>::m_proxiedObject->setLayout(layout);
+ }
+
+ virtual void addAction(QAction *action, AbstractDeclarativeObject *declarativeObject)
+ {
+ DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
+ DeclarativeObjectProxy<T>::m_proxiedObject->addAction(action);
+ }
+
+ virtual void addQObject(QObject *object, AbstractDeclarativeObject *declarativeObject)
+ {
+ object->setParent(DeclarativeObjectProxy<T>::m_proxiedObject);
+ DeclarativeObjectProxy<T>::m_children.append(declarativeObject);
+ }
+};
+
+#endif
-#include "declarativewidgetdocument.h"
-
-#include "declarativeobjects_p.h"
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativewidgetsdocument.h"
+
+// The declarative widget wrappers
+#include "declarativeactionitem_p.h"
+#include "declarativeaction_p.h"
+#include "declarativebuttongroup_p.h"
+#include "declarativecalendarwidget_p.h"
+#include "declarativecheckbox_p.h"
+#include "declarativecolordialog_p.h"
+#include "declarativecolumnview_p.h"
+#include "declarativecommandlinkbutton_p.h"
+#include "declarativedateedit_p.h"
+#include "declarativedatetimeedit_p.h"
+#include "declarativedialogbuttonbox_p.h"
+#include "declarativedialog_p.h"
+#include "declarativedial_p.h"
+#include "declarativedoublespinbox_p.h"
+#include "declarativefiledialog_p.h"
+#include "declarativefontdialog_p.h"
+#include "declarativeformlayout_p.h"
+#include "declarativeframe_p.h"
+#include "declarativegridlayout_p.h"
+#include "declarativegroupbox_p.h"
+#include "declarativehboxlayout_p.h"
+#include "declarativeinputdialog_p.h"
+#include "declarativelabel_p.h"
+#include "declarativelcdnumber_p.h"
+#include "declarativelineedit_p.h"
+#include "declarativelistview_p.h"
+#include "declarativemainwindow_p.h"
+#include "declarativemenubar_p.h"
+#include "declarativemenu_p.h"
+#include "declarativemessagebox_p.h"
+#include "declarativeplaintextedit_p.h"
+#include "declarativeprogressbar_p.h"
+#include "declarativepushbutton_p.h"
+#include "declarativeradiobutton_p.h"
+#include "declarativescrollarea_p.h"
+#include "declarativescrollbar_p.h"
+#include "declarativeseparator_p.h"
+#include "declarativeslider_p.h"
+#include "declarativespinbox_p.h"
+#include "declarativestackedlayout_p.h"
+#include "declarativestackedwidget_p.h"
+#include "declarativestatusbar_p.h"
+#include "declarativetableview_p.h"
+#include "declarativetabwidget_p.h"
+#include "declarativetextbrowser_p.h"
+#include "declarativetextedit_p.h"
+#include "declarativetimeedit_p.h"
+#include "declarativetoolbar_p.h"
+#include "declarativetoolbutton_p.h"
+#include "declarativetreeview_p.h"
+#include "declarativevboxlayout_p.h"
+#include "declarativewebview_p.h"
+#include "declarativewidget_p.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
-class DeclarativeWidgetDocument::Private
+class DeclarativeWidgetsDocument::Private
{
public:
- Private(DeclarativeWidgetDocument *qq, const QUrl &url)
+ Private(DeclarativeWidgetsDocument *qq, const QUrl &url)
: q(qq)
, m_url(url)
, m_engine(new QDeclarativeEngine(q))
{
}
- DeclarativeWidgetDocument* q;
+ DeclarativeWidgetsDocument* q;
QUrl m_url;
QDeclarativeEngine* m_engine;
QDeclarativeComponent* m_component;
};
-DeclarativeWidgetDocument::DeclarativeWidgetDocument(const QUrl &url, QObject *parent)
+DeclarativeWidgetsDocument::DeclarativeWidgetsDocument(const QUrl &url, QObject *parent)
: QObject(parent)
, d(new Private(this, url))
{
}
}
-DeclarativeWidgetDocument::~DeclarativeWidgetDocument()
+DeclarativeWidgetsDocument::~DeclarativeWidgetsDocument()
{
delete d;
}
-void DeclarativeWidgetDocument::setContextProperty(const QString &name, const QVariant &value)
+void DeclarativeWidgetsDocument::setContextProperty(const QString &name, const QVariant &value)
{
d->m_engine->rootContext()->setContextProperty(name, value);
}
-void DeclarativeWidgetDocument::setContextProperty(const QString &name, QObject *object)
+void DeclarativeWidgetsDocument::setContextProperty(const QString &name, QObject *object)
{
d->m_engine->rootContext()->setContextProperty(name, object);
}
-QDeclarativeEngine* DeclarativeWidgetDocument::engine() const
+QDeclarativeEngine* DeclarativeWidgetsDocument::engine() const
{
return d->m_engine;
}
-QWidget* DeclarativeWidgetDocument::createWidget()
+QWidget* DeclarativeWidgetsDocument::createWidget()
{
QObject *object = d->m_component->create();
if (!object) {
--- /dev/null
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 DECLARATIVEWIDGETSDOCUMENT_H
+#define DECLARATIVEWIDGETSDOCUMENT_H
+
+#include <QtCore/QObject>
+#include <QtCore/QUrl>
+
+class QDeclarativeEngine;
+
+class DeclarativeWidgetsDocument : public QObject
+{
+ Q_OBJECT
+
+ public:
+ DeclarativeWidgetsDocument(const QUrl &url, QObject *parent = 0);
+ ~DeclarativeWidgetsDocument();
+
+ void setContextProperty(const QString &name, const QVariant &value);
+ void setContextProperty(const QString &name, QObject *object);
+
+ QDeclarativeEngine* engine() const;
+
+ template <typename T>
+ T* create()
+ {
+ QWidget *widget = createWidget();
+ if (!widget)
+ return 0;
+
+ return qobject_cast<T*>(widget);
+ }
+
+ private:
+ QWidget* createWidget();
+
+ class Private;
+ Private* const d;
+};
+
+#endif
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "objectadaptors_p.h"
-#include "declarativeobjects_p.h"
+#include "declarativeaction_p.h"
+#include <QAbstractButton>
#include <QDebug>
// ActionItem
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 OBJECTADAPTORS_P_H
#define OBJECTADAPTORS_P_H
-#include "declarativewidgetdocument.h"
+/*
+ Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
+ Author: Kevin Krammer, krake@kdab.com
+ Author: Tobias Koenig, tokoe@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 "declarativewidgetsdocument.h"
#include <QtCore/QDir>
#include <QtCore/QFileInfo>
QFileSystemModel model;
model.setRootPath("/");
- DeclarativeWidgetDocument document(documentUrl);
+ DeclarativeWidgetsDocument document(documentUrl);
QObject::connect(document.engine(), SIGNAL(quit()), &app, SLOT(quit()));
document.setContextProperty("_timer", &timer);