How to change or detach layout of Widget?(+ or using private function)
-
wrote on 14 May 2015, 06:18 last edited by Mue22
first, i set the widget's layout,
ui->widget1->setLayout(layout1);
ui->widget2->setLayout(layout2);but i want to change the layout of widget, according to condition.
ui->widget1->setLayout(layout2);
ui->widget2->setLayout(layout1);they send the errormessage "~~already set the layout".
how can i solve this problem?
++
I find QWidget::takeLayout()
but it was private, so i can use this function :(..... plz give me the solution.. -
first, i set the widget's layout,
ui->widget1->setLayout(layout1);
ui->widget2->setLayout(layout2);but i want to change the layout of widget, according to condition.
ui->widget1->setLayout(layout2);
ui->widget2->setLayout(layout1);they send the errormessage "~~already set the layout".
how can i solve this problem?
++
I find QWidget::takeLayout()
but it was private, so i can use this function :(..... plz give me the solution.. -
wrote on 14 May 2015, 07:13 last edited by Mue22
@p3c0
thanks to your replay :)!!!
i want to just change each layout....:(
i want to just detach the layout from widget, and reuse to another widget..
(if i use your solution, i can reuse layout1, 2... its correct?)
->(if i use your solution, i can't reuse layout1, 2... its correct?) -
@p3c0
thanks to your replay :)!!!
i want to just change each layout....:(
i want to just detach the layout from widget, and reuse to another widget..
(if i use your solution, i can reuse layout1, 2... its correct?)
->(if i use your solution, i can't reuse layout1, 2... its correct?)@Mue22 AFAIK to detach you will have to delete it and hence all the widgets inside it too. Then create new layout and then
setLayout
.i can reuse layout1, 2... its correct?
No, since it is deleted.
-
@Mue22 AFAIK to detach you will have to delete it and hence all the widgets inside it too. Then create new layout and then
setLayout
.i can reuse layout1, 2... its correct?
No, since it is deleted.
-
ah!! sorry sorry...i'm not freindly to english...:);;;;;
i want to say that:
if i use your solution, i can't reuse layout1, 2... its correct?...haha.
it's so difficult problem...:(
@Mue22 Yes you can't. Since detaching requires deleting, new layout must be created to use again.
-
@Mue22 Yes you can't. Since detaching requires deleting, new layout must be created to use again.
1/7