You are going to send me to the .... excuse me for not explaining better.
This is the psedo-code I have :
A_panel() // constructor type 1
{ call generic_constructor}
A_panel() // constructor type 2
{ call generic_constructor}
generic_constructor() {
set some variables;
i_am_ready=false;
launch a timer of 1 milisecond interval to check if the parent_widget is already visible.it calls timer_slot_function
}
the timer_slot_function () {
if (my_parent_visible) place_things() ;
}
place_things() {
I measure the size and other things of widget parent to set the size and position of this custom_widget
i_am_ready=true; // finally I set 'i_am_ready' to true.
}
resize_event() {
qDebug()<<"Resize_event";
if (i_am_ready) place_things }
}
A_panel() // constructor type 1
{ call generic_constructor}
A_panel() // constructor type 2
{ call generic_constructor}
generic_constructor() {
set some variables;
i_am_ready=false;
launch a timer of 1 milisecond interval to check if the parent_widget is already visible.it calls timer_slot_function
}
the timer_slot_function () {
if (my_parent_visible) place_things() ;
}
place_things() {
I measure the size and other things of widget parent to set the size and position of this custom_widget
i_am_ready=true; // finally I set 'i_am_ready' to true.
}
resize_event() {
qDebug()<<"Resize_event";
if (i_am_ready) place_things }
}
To copy to clipboard, switch view to plain text mode
Due to some reasons I dont want to execute 'place_things' on undesirable resize_events . I control this using 'i_am_ready' variable.
I have this code a_panel is the custom widget)
A_panel * a_panel = new A_panel(a_widget, parent, sizable );
a_panel->resize(parent->width()*float(tam_100_or_0)/100, parent->height()*float(tam_100_or_0)/100);
A_panel * a_panel = new A_panel(a_widget, parent, sizable );
a_panel->resize(parent->width()*float(tam_100_or_0)/100, parent->height()*float(tam_100_or_0)/100);
To copy to clipboard, switch view to plain text mode
And I discover I have a resize_event (showed by the qdebug) before all the last code is executed.
( that is: genericcontructor-timer-placethings).
Ok, this is due to the timer... i know.
I have just found that the problem is the timer i use...
Sorry again .
Bookmarks