Fix Design property management for controls inserted inside UserContainer.

[GB.GTK]
* BUG: Fix Design property management for controls inserted inside UserContainer.

[GB.GTK3]
* BUG: Fix Design property management for controls inserted inside UserContainer.

[GB.QT4]
* BUG: Fix Design property management for controls inserted inside UserContainer.

[GB.QT5]
* BUG: Fix Design property management for controls inserted inside UserContainer.
This commit is contained in:
gambas 2021-02-07 23:28:13 +01:00
parent 47a9a6679b
commit 076fa9d027
5 changed files with 15 additions and 67 deletions

View File

@ -427,6 +427,10 @@ BEGIN_METHOD(UserControl_new, GB_OBJECT parent)
PANEL->setArrange(ARRANGE_FILL);
PANEL->setUser();
if (GB.Is(THIS, CLASS_UserContainer))
PANEL->setUserContainer();
THIS_USERCONTAINER->container = THIS;
if (!GB.GetFunction(&THIS_USERCONTROL->paint_func, THIS, "UserControl_Draw", NULL, NULL))
@ -677,8 +681,6 @@ GB_DESC UserContainerDesc[] =
GB_PROPERTY("Invert", "b", UserContainer_Invert),
GB_PROPERTY("Centered", "b", UserContainer_Centered),
//GB_PROPERTY("Focus", "b", UserContainer_Focus),
USERCONTAINER_DESCRIPTION,
GB_END_DECLARE

View File

@ -275,6 +275,7 @@ void gContainer::initialize()
_did_arrangement = false;
_cb_map = false;
_is_container = true;
_user_container = false;
arrangement.mode = 0;
arrangement.spacing = false;
@ -889,6 +890,9 @@ void gContainer::updateDesignChildren()
if (!isUser() && !isDesignIgnore())
return;
if (isUserContainer() && !_proxyContainer)
return;
cont = isDesignIgnore() ? this : proxyContainer();
for (i = 0; i < cont->childCount(); i++)

View File

@ -85,6 +85,9 @@ public:
void setInvert(bool vl);
void setCentered(bool vl);
void setUserContainer() { _user_container = true; }
bool isUserContainer() const { return _user_container; }
virtual int childCount() const;
virtual gControl *child(int index) const;
gControl *firstChild() const { return child(0); };
@ -160,6 +163,7 @@ private:
unsigned _did_arrangement : 1;
unsigned _cb_map : 1;
unsigned _no_arrangement : 6;
unsigned _user_container : 1;
};
#endif

View File

@ -523,6 +523,9 @@ void CCONTAINER_update_design(void *_object)
CWIDGET_set_design(child, true);
}
}
if (GB.Is(THIS, CLASS_UserContainer) && CONTAINER == WIDGET)
return;
list = CONTAINER->children();

View File

@ -2175,24 +2175,6 @@ CWIDGET *CWidget::getDesign(QObject *o)
real = true;
/*while (o)
{
ob = dict[o];
if (ob)
break;
if (((QWidget *)o)->isWindow())
return NULL;
o = o->parent();
real = false;
}
if (!o)
return NULL;
if (!ob->flag.design_ignore)
return ob;*/
while (o)
{
ob = dict[o];
@ -2208,53 +2190,6 @@ CWIDGET *CWidget::getDesign(QObject *o)
return NULL;
}
/*
static void debugObject(void *ob)
{
if (!ob)
return;
qDebug(" (%s %p) %s%s", ob ? GB.GetClassName(ob) : "", ob, CWIDGET_test_flag(ob, WF_DESIGN) ? "D" : "", CWIDGET_test_flag(ob, WF_DESIGN_LEADER) ? "L" : "");
}
*/
#if 0
static CWIDGET *getDesignDebug(QObject *o)
{
CWIDGET *ob;
if (!o->isWidgetType())
return NULL;
while (o)
{
ob = CWidget::getReal(o);
debugObject(ob);
if (ob)
break;
o = o->parent();
}
if (!o)
return NULL;
if (!CWIDGET_test_flag(ob, WF_DESIGN))
return ob;
while (o)
{
ob = CWidget::getReal(o);
debugObject(ob);
if (ob && CWIDGET_test_flag(ob, WF_DESIGN_LEADER))
return ob;
o = o->parent();
}
return NULL;
}
#endif
QWidget *CWidget::getContainerWidget(CCONTAINER *object)
{
if (GB.CheckObject(object))