Image view question



  • I'm looking for the right classes to use for a specific task. I'd like to have a view in a window that displays an image of a form, say a real estate form, and be able to lay various type of fields on top of that representing data to be filled out according to the form's requirements. This part of the app should support scrolling and resizing of the form and the associated field location to be pegged to the location on the form.
    This is likely be a desktop app, so I've started looking at the imageviewer example and will play with that. If anyone has a suggestion on which direction I should take, or if QT will even support this. I'm assuming yes, since most things that C++ or C#.net can do QT can do also. I'm able to do this in C#.net.

    thanks for any help on this


  • Moderators

    @Nevering
    I hope i got you correctly:

    1. subclass QWidget/QFrame and reimplement the paintEvent() handler (see below)
    2. construct your widget placement by setting a layout on this widget
    void MyWidget::paintEvent( QPaintEvnet* event )
    {
            QPixmap pix(...);
    
           QRect rect = rect();
           QSize size = pix.size();
                size.scale( rect.size(), Qt::KeepAspectRatio );
           QRect targetRect( QPoint(0,0), size );
               targetRect.moveLeft( (rect.width() - size.width()) / 2 );
    
         QPainter p(this);
          p.drawPixmap( targetRect, pix );
    }
    


  • I'm new to QT, so obviously I'm struggling. The best example of what I'm looking for is a PDF document with fill-able fields on it.

    Can the image be put into the background with fields on top ? And image and field data are printable at normal page size with fields in correct locations ? I've been looking for an example of this, seems this would have been done before.

    thanks



  • Is LIKE a PDF fill-able document. Image with fields on it.



  • Hi Nevering,
    Not sure i well understand, but i think it is a job for QGraphicsView.
    The idea is to create a QGraphicsView, then add a QGraphicsItem in a scene. Each item is a kind of graphic (it could be video images, or texts, etc...) who are linked in a scene has you need. from there, you can modify each item in the scene or move them... dynamically.
    Look at example around qgraphicsview from qt examples, i think it is what you need to use (if i well understand).


Log in to reply
 

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