Zoom - what is the best way to do this?



  • My app will be used by people of differing eye sight levels so requires the kind of zoom you get on other applications (e.g. IE and drawing applications). Is there a more elegant way than just going through all the items on the window and resizing them? (Currently just had a listWidget and a couple of buttons, purpose-built very simple UI).



  • You could place your whole UI in a QGraphicsView and use "QGraphicsProxyWidget":http://qt-project.org/doc/qt-4.8/qgraphicsproxywidget.html#details to embed QWidgets there. Then zooming should be as easy as calling scale on the graphicsview/scene.



  • Fab, I will try that :-)



  • Or you can zoom by changing font size:
    @void Dialog::on_pushButton_clicked()
    {
    QFont ff = this->font();
    ff.setPointSize(22);
    this->setFont(ff);
    this->resize(sizeHint());
    }@



  • [quote author="qxoz" date="1338807631"]Or you can zoom by changing font size[/quote]

    Since this would only work on controls with text on them, I'm not sure it's a good idea for increasing accessibility for partially sight-disabled. You'd need to take care of all other controls with individual hacks (tool-buttons, controls with custom paint event, labels that show images, etc.).



  • [quote author="Dolphin" date="1338212821"] (Currently just had a listWidget and a couple of buttons, purpose-built very simple UI).[/quote]

    and I proposed this.



  • bq. Currently.

    This may change in the future. And apart from that, he was asking for elegant solutions. Elegant solutions partly are elegant because they catch corner cases implicitly.



  • Morning people, hope you had a good looooooooong weekend.

    Have not managed to get this working yet but been side tracked (and on holiday) - thanks for your thoughts. I will try them out.

    I'm a girl by the way ;-)



  • [quote author="Dolphin" date="1339057298"]
    I'm a girl by the way ;-)[/quote]
    I'm a boy, just in case :)



  • DerManu - sorry to be a pain but do you have a simple example? I have been through about 10 different examples and not got anything working (putting everything in the a QGraphicsView and scaling the view).



  • Never mind - I was being dim, my view was going out of scope.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.