PDA

View Full Version : Zoom in UI



dpatel
1st April 2010, 14:06
Hi All,

I am creating a windows application which has lot of widgets(controls) and the user wants to be able to zoom in particular area of GUI so that he can see the controls clearly and operate in that view. Does Qt provide anything with which I can achieve this functionality.
This would be similar to what Mac provides when we (ctrl+mouse) scroll but I want this functionality on Windows xp.
I am using Qt 4.6.0

Thanks

wagmare
1st April 2010, 14:08
use QRubberBand to zoom and best if your main widget is QGraphicsView ...

zgulser
1st April 2010, 14:14
use QRubberBand to zoom and best if your main widget is QGraphicsView ...


Plus you need to handle zooming in mouseMoveEvent, mousePresssEvent, mouseReleaseEvent together with rubberband. there are many useful posts regarding QRubberband zoom so you can search and find it in the forum.

dpatel
2nd April 2010, 10:14
Can I use QRubberband if my main window is QMainWindow? Can you point me to an example which does similar thing. I want all the Buttons and editboxes bigger when i zoom in. I saw some examples of QGraphicsview as well but they deal with items that have been drawn and not widgets.

Thanks.

aamer4yu
2nd April 2010, 10:24
Well, you can add widgets to the scene, cant you ? QGraphicsScene::addWidget :)

Why do you want to zoom in QMainWindow ? You can have the view as central widget of the QMainWindow. Only your toolbar and status bar wont be zoomable in that case.

dpatel
2nd April 2010, 10:32
Well I am new to Qt and this kind of programming (zooming in UI) so trying to get information on how this can be done. How can I zoom in central widget? Do I have to have QGraphicsView as central widget? I am still trying to get a direction to proceed.

Thanks,

aamer4yu
2nd April 2010, 10:43
Well, normal QWidget are not zoomable, they can be resized though.
So one way of zooming in your application would be to implement some sort of mechanism which propogates resize events to all widgets in the application. But then this is a tiring job.

Second comes the graphics view framework which uses QGraphicsScene and QGraphicsView and has the zoomable job implemented. So its wise to use the graphicsview framework. You can set the view as central widget of QMainWindow as I said in last post, and add your widgets to the scene of the view.

Am sure you havent browsed the examples properly. There are so many examples...
for zooming effect you can refer 40000 chip demo,
for widgets in graphics view, you can refer Embedded Dialogs example...