PDA

View Full Version : How to add horizontal and verticle scroll bar to the QDialog?



Gokulnathvc
10th October 2012, 10:29
How to add horizontal and verticle scroll bar to the QDialog? if the values in the qdialog goes downwards or rightwards. so that the scrollbar should appear automatically?

Lesiok
10th October 2012, 10:44
On QDialog put QScrollArea and all widgets put on this area.

Gokulnathvc
10th October 2012, 11:01
I have tried doing that.. But nothing happens.. here is the code


scroll = new QScrollArea();
scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded )
scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded)
scroll->setParent(this);
scroll-> setVisible(true);

wysota
10th October 2012, 11:30
Your scroll area has no content currently.

Gokulnathvc
10th October 2012, 11:31
Is there anything to do with the above code provided?

wysota
10th October 2012, 11:38
What did you put in the scroll area? Is there anything at all? Did you put the scroll area in your widget's layout?

Gokulnathvc
10th October 2012, 11:44
I couldnt get your point. Could you give me a change in the above code i want to make.. I am just creating QLabel at run time.. How to put the QLabel and the whole QDialog inside the QScrollArea()

wysota
10th October 2012, 11:47
Did you even read the example in QScrollArea docs? Do you see the differences between your code and the code of the example? Do you understand how QScrollArea works?

Gokulnathvc
10th October 2012, 12:00
I have used the same code, but i am getting some exceptions out there

wysota
10th October 2012, 12:17
So fix your errors.