Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into PushButtonDefaultAlias
Browse files Browse the repository at this point in the history
  • Loading branch information
Znurre authored Mar 26, 2018
2 parents ae1d0ee + 3be4a64 commit 959ae1e
Show file tree
Hide file tree
Showing 32 changed files with 525 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/abstractdeclarativeobject_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AbstractDeclarativeObject : public QObject
{
Q_OBJECT

Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
2 changes: 1 addition & 1 deletion src/declarativebuttongroupextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DeclarativeButtonGroupExtension : public DeclarativeObjectExtension
Q_PROPERTY(QVariantList buttons READ buttons WRITE setButtons NOTIFY buttonsChanged)

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
4 changes: 2 additions & 2 deletions src/declarativecolordialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ QString DeclarativeColorDialogAttached::title() const
return d->title;
}

void DeclarativeColorDialogAttached::setOptions(int options)
void DeclarativeColorDialogAttached::setOptions(unsigned int options)
{
if (d->options == options)
return;
Expand All @@ -71,7 +71,7 @@ void DeclarativeColorDialogAttached::setOptions(int options)
emit optionsChanged(options);
}

int DeclarativeColorDialogAttached::options() const
unsigned int DeclarativeColorDialogAttached::options() const
{
return d->options;
}
Expand Down
6 changes: 3 additions & 3 deletions src/declarativecolordialog_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DeclarativeColorDialogAttached : public StaticDialogMethodAttached
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(int options READ options WRITE setOptions NOTIFY optionsChanged)
Q_PROPERTY(unsigned int options READ options WRITE setOptions NOTIFY optionsChanged)

public:
explicit DeclarativeColorDialogAttached(QObject *parent = 0);
Expand All @@ -48,8 +48,8 @@ class DeclarativeColorDialogAttached : public StaticDialogMethodAttached
void setTitle(const QString &title);
QString title() const;

void setOptions(int options);
int options() const;
void setOptions(unsigned int options);
unsigned int options() const;

Q_INVOKABLE QColor getColor();
Q_INVOKABLE QColor getColor(const QColor &initialColor);
Expand Down
2 changes: 1 addition & 1 deletion src/declarativecomboboxextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class DeclarativeComboBoxExtension : public DeclarativeWidgetExtension
Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel NOTIFY modelChanged)

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
2 changes: 1 addition & 1 deletion src/declarativefilesystemmodelextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DeclarativeFileSystemModelExtension : public DeclarativeObjectExtension
Q_OBJECT

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)
Q_PROPERTY(QString rootPath READ rootPath WRITE setRootPath NOTIFY rootPathChanged)

Q_CLASSINFO("DefaultProperty", "data")
Expand Down
4 changes: 2 additions & 2 deletions src/declarativefontdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ bool DeclarativeFontDialogAttached::dialogAccepted() const
return d->dialogAccepted;
}

void DeclarativeFontDialogAttached::setOptions(int options)
void DeclarativeFontDialogAttached::setOptions(unsigned int options)
{
if (options == d->options)
return;
Expand All @@ -79,7 +79,7 @@ void DeclarativeFontDialogAttached::setOptions(int options)
emit optionsChanged(options);
}

int DeclarativeFontDialogAttached::options() const
unsigned int DeclarativeFontDialogAttached::options() const
{
return d->options;
}
Expand Down
6 changes: 3 additions & 3 deletions src/declarativefontdialog_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DeclarativeFontDialogAttached : public StaticDialogMethodAttached
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
Q_PROPERTY(bool ok READ dialogAccepted NOTIFY dialogAcceptedChanged)
Q_PROPERTY(int options READ options WRITE setOptions NOTIFY optionsChanged)
Q_PROPERTY(unsigned int options READ options WRITE setOptions NOTIFY optionsChanged)

public:
explicit DeclarativeFontDialogAttached(QObject *parent = 0);
Expand All @@ -51,8 +51,8 @@ class DeclarativeFontDialogAttached : public StaticDialogMethodAttached

bool dialogAccepted() const;

void setOptions(int options);
int options() const;
void setOptions(unsigned int options);
unsigned int options() const;

Q_INVOKABLE QFont getFont();
Q_INVOKABLE QFont getFont(const QString &fontFamily);
Expand Down
2 changes: 1 addition & 1 deletion src/declarativeformlayout_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class DeclarativeFormLayoutExtension : public DeclarativeLayoutExtension
Q_OBJECT

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)
Q_PROPERTY(DeclarativeLayoutContentsMargins* contentsMargins READ contentsMargins CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")
Expand Down
2 changes: 1 addition & 1 deletion src/declarativegridlayout_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class DeclarativeGridLayoutExtension : public DeclarativeLayoutExtension
Q_OBJECT

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)
Q_PROPERTY(DeclarativeLayoutContentsMargins* contentsMargins READ contentsMargins CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")
Expand Down
2 changes: 1 addition & 1 deletion src/declarativehboxlayout_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DeclarativeHBoxLayoutExtension : public DeclarativeLayoutExtension
Q_OBJECT

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)
Q_PROPERTY(DeclarativeLayoutContentsMargins* contentsMargins READ contentsMargins CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")
Expand Down
2 changes: 1 addition & 1 deletion src/declarativeitemviewextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DeclarativeItemViewExtension : public DeclarativeWidgetExtension, protecte
Q_PROPERTY(QItemSelectionModel* selectionModel READ selectionModel WRITE setSelectionModel NOTIFY selectionModelChanged)

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
2 changes: 1 addition & 1 deletion src/declarativelabelextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DeclarativeLabelExtension : public DeclarativeWidgetExtension
Q_PROPERTY(QWidget* buddy READ buddy WRITE setBuddy NOTIFY buddyChanged)

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
2 changes: 1 addition & 1 deletion src/declarativelayoutextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DeclarativeLayoutExtension : public DeclarativeObjectExtension
Q_OBJECT

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)
Q_PROPERTY(DeclarativeLayoutContentsMargins* contentsMargins READ contentsMargins CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")
Expand Down
2 changes: 1 addition & 1 deletion src/declarativeobjectextension.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DeclarativeObjectExtension : public QObject
{
Q_OBJECT

Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
2 changes: 1 addition & 1 deletion src/declarativequickwidgetextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DeclarativeQuickWidgetExtension : public DeclarativeWidgetExtension
NOTIFY declarativeRootContextChanged)

// repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false)
Q_PROPERTY(QQmlListProperty<QObject> data READ data DESIGNABLE false CONSTANT)

Q_CLASSINFO("DefaultProperty", "data")

Expand Down
182 changes: 182 additions & 0 deletions src/declarativesizepolicy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#include "declarativesizepolicy_p.h"

#include <QWidget>

DeclarativeSizePolicy::DeclarativeSizePolicy(QWidget *extendedWidget, QObject *parent)
: QObject(parent)
, m_extendedWidget(extendedWidget)
{
Q_ASSERT(m_extendedWidget);
}

DeclarativeSizePolicy::ControlType DeclarativeSizePolicy::controlType() const
{
Q_ASSERT(m_extendedWidget);

return static_cast<DeclarativeSizePolicy::ControlType>(m_extendedWidget->sizePolicy().controlType());
}

DeclarativeSizePolicy::Policy DeclarativeSizePolicy::horizontalPolicy() const
{
Q_ASSERT(m_extendedWidget);

return static_cast<DeclarativeSizePolicy::Policy>(m_extendedWidget->sizePolicy().horizontalPolicy());
}

DeclarativeSizePolicy::Policy DeclarativeSizePolicy::verticalPolicy() const
{
Q_ASSERT(m_extendedWidget);

return static_cast<DeclarativeSizePolicy::Policy>(m_extendedWidget->sizePolicy().verticalPolicy());
}

Qt::Orientations DeclarativeSizePolicy::expandingDirections() const
{
Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().expandingDirections();
}

bool DeclarativeSizePolicy::hasHeightForWidth() const
{
Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().hasHeightForWidth();
}

bool DeclarativeSizePolicy::hasWidthForHeight() const
{
Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().hasWidthForHeight();
}

int DeclarativeSizePolicy::horizontalStretch() const
{
Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().horizontalStretch();
}

int DeclarativeSizePolicy::verticalStretch() const
{

Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().verticalStretch();
}

bool DeclarativeSizePolicy::retainSizeWhenHidden() const
{
Q_ASSERT(m_extendedWidget);

return m_extendedWidget->sizePolicy().retainSizeWhenHidden();
}

void DeclarativeSizePolicy::setControlType(DeclarativeSizePolicy::ControlType controlType)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.controlType() == static_cast<QSizePolicy::ControlType>(controlType))
return;
policy.setControlType(static_cast<QSizePolicy::ControlType>(controlType));
m_extendedWidget->setSizePolicy(policy);
emit controlTypeChanged(controlType);
}

void DeclarativeSizePolicy::setHorizontalPolicy(DeclarativeSizePolicy::Policy horizontalPolicy)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.horizontalPolicy() == static_cast<QSizePolicy::Policy>(horizontalPolicy))
return;

const Qt::Orientations oldExpandingDirections = policy.expandingDirections();
policy.setHorizontalPolicy(static_cast<QSizePolicy::Policy>(horizontalPolicy));
const Qt::Orientations newExpandingDirections = policy.expandingDirections();
m_extendedWidget->setSizePolicy(policy);

emit horizontalPolicyChanged(horizontalPolicy);
if (newExpandingDirections != oldExpandingDirections)
emit expandingDirectionsChanged(newExpandingDirections);
}

void DeclarativeSizePolicy::setVerticalPolicy(DeclarativeSizePolicy::Policy verticalPolicy)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.verticalPolicy() == static_cast<QSizePolicy::Policy>(verticalPolicy))
return;

const Qt::Orientations oldExpandingDirections = policy.expandingDirections();
policy.setVerticalPolicy(static_cast<QSizePolicy::Policy>(verticalPolicy));
const Qt::Orientations newExpandingDirections = policy.expandingDirections();
m_extendedWidget->setSizePolicy(policy);

emit verticalPolicyChanged(verticalPolicy);
if (newExpandingDirections != oldExpandingDirections)
emit expandingDirectionsChanged(newExpandingDirections);
}

void DeclarativeSizePolicy::setHeightForWidth(bool heightForWidth)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.hasHeightForWidth() == heightForWidth)
return;
policy.setHeightForWidth(heightForWidth);
m_extendedWidget->setSizePolicy(policy);
emit hasHeightForWidthChanged(heightForWidth);
}

void DeclarativeSizePolicy::setWidthForHeight(bool widthForHeight)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.hasWidthForHeight() == widthForHeight)
return;
policy.setWidthForHeight(widthForHeight);
m_extendedWidget->setSizePolicy(policy);
emit hasWidthForHeightChanged(widthForHeight);
}

void DeclarativeSizePolicy::setHorizontalStretch(int horizontalStretch)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.horizontalStretch() == horizontalStretch)
return;
policy.setHorizontalStretch(horizontalStretch);
m_extendedWidget->setSizePolicy(policy);
emit horizontalStretchChanged(horizontalStretch);
}

void DeclarativeSizePolicy::setVerticalStretch(int verticalStretch)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.verticalStretch() == verticalStretch)
return;
policy.setVerticalStretch(verticalStretch);
m_extendedWidget->setSizePolicy(policy);
emit verticalStretchChanged(verticalStretch);
}

void DeclarativeSizePolicy::setRetainSizeWhenHidden(bool retainSizeWhenHidden)
{
Q_ASSERT(m_extendedWidget);

QSizePolicy policy = m_extendedWidget->sizePolicy();
if (policy.retainSizeWhenHidden() == retainSizeWhenHidden)
return;
policy.setRetainSizeWhenHidden(retainSizeWhenHidden);
m_extendedWidget->setSizePolicy(policy);
emit retainSizeWhenHiddenChanged(retainSizeWhenHidden);
}
Loading

0 comments on commit 959ae1e

Please sign in to comment.