Skip to content

Commit

Permalink
Merge pull request #5 from scztt/issue/3828
Browse files Browse the repository at this point in the history
lang: Fix remaing users of QObjectProxy
  • Loading branch information
mossheim authored Jun 30, 2018
2 parents 8270e42 + d0159f1 commit 5514f90
Showing 1 changed file with 37 additions and 45 deletions.
82 changes: 37 additions & 45 deletions QtCollider/layouts/layouts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,20 @@ template <class BOXLAYOUT> class QcBoxLayout : public QcLayout<BOXLAYOUT>
}
}

void setStretch( QObjectProxy *p, int stretch ) {
QWidget *w = qobject_cast<QWidget*>( p->object() );
if( w ) {
BOXLAYOUT::setStretchFactor( w, stretch );
return;
}
void setStretch( QWidget *w, int stretch ) {
BOXLAYOUT::setStretchFactor( w, stretch );
}

QLayout *l = qobject_cast<QLayout*>( p->object() );
if(l) {
BOXLAYOUT::setStretchFactor( l, stretch );
return;
}
void setStretch( QLayout *l, int stretch ) {
BOXLAYOUT::setStretchFactor( l, stretch );
}

void setAlignment( QObjectProxy *p, Qt::Alignment alignment ) {
QWidget *w = qobject_cast<QWidget*>( p->object() );
if( w ) {
BOXLAYOUT::setAlignment( w, alignment );
return;
}
void setAlignment( QWidget *w, Qt::Alignment alignment ) {
BOXLAYOUT::setAlignment( w, alignment );
}

QLayout *l = qobject_cast<QLayout*>( p->object() );
if(l) {
BOXLAYOUT::setAlignment( l, alignment );
return;
}
void setAlignment( QLayout *l, Qt::Alignment alignment ) {
BOXLAYOUT::setAlignment( l, alignment );
}
};

Expand All @@ -163,15 +151,21 @@ class QcHBoxLayout : public QcBoxLayout<QHBoxLayout>
Q_INVOKABLE void setStretch( int index, int stretch ) {
QBoxLayout::setStretch( index, stretch );
}
Q_INVOKABLE void setStretch( QObjectProxy *p, int stretch ) {
QcBoxLayout<QHBoxLayout>::setStretch( p, stretch );
Q_INVOKABLE void setStretch( QWidget *w, int stretch ) {
QcBoxLayout<QHBoxLayout>::setStretch( w, stretch );
}
Q_INVOKABLE void setStretch( QLayout *l, int stretch ) {
QcBoxLayout<QHBoxLayout>::setStretch( l, stretch );
}
Q_INVOKABLE void setAlignment( int i, int a ) {
itemAt(i)->setAlignment( (Qt::Alignment) a );
update();
}
Q_INVOKABLE void setAlignment( QObjectProxy *p, int a ) {
QcBoxLayout<QHBoxLayout>::setAlignment( p, (Qt::Alignment) a );
Q_INVOKABLE void setAlignment( QWidget *w, int a ) {
QcBoxLayout<QHBoxLayout>::setAlignment( w, (Qt::Alignment) a );
}
Q_INVOKABLE void setAlignment( QLayout *l, int a ) {
QcBoxLayout<QHBoxLayout>::setAlignment( l, (Qt::Alignment) a );
}
};

Expand All @@ -187,15 +181,21 @@ class QcVBoxLayout : public QcBoxLayout<QVBoxLayout>
Q_INVOKABLE void setStretch( int index, int stretch ) {
QBoxLayout::setStretch( index, stretch );
}
Q_INVOKABLE void setStretch( QObjectProxy *p, int stretch ) {
QcBoxLayout<QVBoxLayout>::setStretch( p, stretch );
Q_INVOKABLE void setStretch( QWidget *w, int stretch ) {
QcBoxLayout<QVBoxLayout>::setStretch( w, stretch );
}
Q_INVOKABLE void setStretch( QLayout *l, int stretch ) {
QcBoxLayout<QVBoxLayout>::setStretch( l, stretch );
}
Q_INVOKABLE void setAlignment( int i, int a ) {
itemAt(i)->setAlignment( (Qt::Alignment) a );
update();
}
Q_INVOKABLE void setAlignment( QObjectProxy *p, int a ) {
QcBoxLayout<QVBoxLayout>::setAlignment( p, (Qt::Alignment) a );
Q_INVOKABLE void setAlignment( QWidget *w, int a ) {
QcBoxLayout<QVBoxLayout>::setAlignment( w, (Qt::Alignment) a );
}
Q_INVOKABLE void setAlignment( QLayout *l, int a ) {
QcBoxLayout<QVBoxLayout>::setAlignment( l, (Qt::Alignment) a );
}
};

Expand All @@ -220,18 +220,11 @@ class QcGridLayout : public QcLayout<QGridLayout>
update();
}
}
Q_INVOKABLE void setAlignment( QObjectProxy *p, int a ) {
QWidget *w = qobject_cast<QWidget*>( p->object() );
if( w ) {
QLayout::setAlignment( w, (Qt::Alignment) a );
return;
}

QLayout *l = qobject_cast<QLayout*>( p->object() );
if(l) {
QLayout::setAlignment( l, (Qt::Alignment) a );
return;
}
Q_INVOKABLE void setAlignment( QWidget *w, int a ) {
QLayout::setAlignment( w, (Qt::Alignment) a );
}
Q_INVOKABLE void setAlignment( QLayout *l, int a ) {
QLayout::setAlignment( l, (Qt::Alignment) a );
}
Q_INVOKABLE int minRowHeight( int row ) {
return ( row >= 0 && row < rowCount() ) ? rowMinimumHeight( row ) : 0;
Expand Down Expand Up @@ -263,9 +256,8 @@ class QcStackLayout : public QcLayout<QtCollider::StackLayout>
}
}

Q_INVOKABLE void insertWidget( int index, QObjectProxy *proxy )
Q_INVOKABLE void insertWidget( int index, QWidget *w )
{
if (QWidget *w = qobject_cast<QWidget*>( proxy->object() ))
QtCollider::StackLayout::insertWidget(index, w);
QtCollider::StackLayout::insertWidget(index, w);
}
};

0 comments on commit 5514f90

Please sign in to comment.