Qt World Summit: Register Today!

Scroll the zoomed image

  • hi .m new to qt .and i have done zooming .actually i just drawn a rectangle and zoomed it using paint.scale() function.now i want i want to add 4 arrow buttons and on click of each arrow i want to see the zoomed rectangle in such a way that on every click it scrolls to that position.
    please help me out with the code
    any help will be appreciated.

  • Can you show the painting and zomm code.

  • zooming is just a small part of my project.
    its a very big project.
    i just declared zoomx=1;
    than on my button i done

    finally in paintevent


  • One simple and quick way will be to set this custom widget onto a QScrollArea.

    Otherwise QWidget does not have any special way to pan the paint area, it always tries to show all the area or chops the excess. I don't there is any other way other than QScrollArea.

  • thanx santosh for your reply.
    i am new to qt .so please can you guide me in some detail by posting a simple code .for eg to pan a zoomed rectangle

  • Try QGraphicsXXXX(QGraphicsPixmapItem, QGraphicsScene, QGraphicsView)

    The other option is QtQuick control(need Qt5.1 Beta), most of the improvement of UI are focus
    on QML.Besides, If you want to deploy your apps on mobile, QtQuick should be a better choice, QWidget
    works pretty well on desktops, but looks like alien on mobile

    I don't know in the future the c++ api would provide us those modern api or not, atlease for now, If you want to design modern, fluid user interfaces, QML is a better tool than QWidget.

Log in to reply