size of horizontal layout
hello every one this is my code
Code:
myplot * p = new myplot(gao.structpayloadgraph,gao1.structpayloadgraph, gao.structcol-2, "payload");
myplot * p1 = new myplot(gao.structsessiongraph,gao.structsessiongraph ,gao.structcol-2, "session");
ui->horizontalLayout_3->addWidget(p);
ui->horizontalLayout_3->addWidget(p1);
its working fine my graph are shown side by size but the problem is that it is good for small graphs having 5 ,6 points but when i try to show some bigger graph the window(in which graph is shown) become extremely large the it didn't fit on screen so is there a way by which i can take the size of horizontal layout and then resize my p , p1 to fit in to that area something like that
thankss
Re: size of horizontal layout
You should base your size calculations on the widget on which the horizontalLayout_3 is set.
Re: size of horizontal layout
Sorry sir i didnt get you can you please explain a lil bit more
Re: size of horizontal layout
Assuming that there is some piece of code written by you or qt designer:
Code:
w.setLayout(horizontalLayout_3);
You can calculate the available area by getting size of the widget "w". Remember thought, that there can be some other widgets, margins or spacing set in that layout also.
Re: size of horizontal layout
IMO calculating size on widgets, and adjusting the graphs my not be a good solution, as it will it is still restricted by the screen size, you should use QScrollArea.
I remember you had a problem using QScrollArea earlier, is it with same application? You need to add objects in this hierarchy
graph1 -> h_layout1 -> widget1 -> scroll area1 -> h_layout_main -> main widget
graph2 -> h_layout2 -> widget2 -> scroll area2 -> h_layout_main -> main widget
(add graph to layout, set layout on widget, set widget on a scroll area, add scroll area to layout, set layout on main widget)
or even this will work,
graph1 -> scroll area1 -> h_layout_main -> main widget
graph2 -> scroll area2 -> h_layout_main -> main widget
You can either use Qt Designer / code to achieve this.
Re: size of horizontal layout
Quote:
IMO calculating size on widgets, and adjusting the graphs my not be a good solution, as it will it is still restricted by the screen size, you should use QScrollArea.
Agree with that 100%, but The following quote explains exactly why I propsed that solution :)
Quote:
I remember you had a problem using QScrollArea earlier, is it with same application?