Results 1 to 7 of 7

Thread: Zoom in UI

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Zoom in UI

    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

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zoom in UI

    use QRubberBand to zoom and best if your main widget is QGraphicsView ...
    "Behind every great fortune lies a crime" - Balzac

  3. The following user says thank you to wagmare for this useful post:

    dpatel (2nd April 2010)

  4. #3
    Join Date
    Dec 2008
    Location
    Istanbul, TURKEY
    Posts
    537
    Thanks
    14
    Thanked 13 Times in 13 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Zoom in UI

    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.

  5. The following user says thank you to zgulser for this useful post:

    dpatel (2nd April 2010)

  6. #4
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zoom in UI

    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.

  7. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zoom in UI

    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.

  8. #6
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Zoom in UI

    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,

  9. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Zoom in UI

    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...

  10. The following user says thank you to aamer4yu for this useful post:

    dpatel (2nd April 2010)

Similar Threads

  1. QWTPlot Zoom: cannot zoom negative value
    By jwieland in forum Qwt
    Replies: 0
    Last Post: 8th January 2010, 16:16
  2. Replies: 1
    Last Post: 16th November 2009, 05:25
  3. need some help on zoom.
    By rishiraj in forum Newbie
    Replies: 3
    Last Post: 7th January 2009, 04:34
  4. QGLWidget with text - zoom in / zoom out
    By h123 in forum Qt Programming
    Replies: 1
    Last Post: 16th November 2008, 09:56
  5. Qt Zoom
    By csvivek in forum Qt Programming
    Replies: 3
    Last Post: 6th August 2008, 12:25

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.