Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. correct qt approach
Qt 6.11 is out! See what's new in the release blog

correct qt approach

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 259 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hanno_p
    wrote on last edited by
    #1

    Hello!!

    Im new to qt, so i need to wrap my head about how code in qt way, i coded some gui based apps, so far so good, but now i wanted to code "graphics" and im a bit lost on how to do that as with gui ones is easy as you get a layout, place widgets, etc etc.

    This is what im currently doing.

    Im loading a small video file, extracting frames to pointer of a vector of QPixmap objects, later i pass that vector to a class where i have a Qtimeline object to play that qpixmap secuence.

    So i have N instances of a class that contains a vector of QPixmap and a timeline to play those, just like a image secuence.

    My problem is, how i can draw N instances of that class in a MxN shaped grid at window? From the framework i come from i will just pass some coords to pixmap draw and thats it.

    For example, should i need to use a QGraphicsScene as a canvas where i can place N QGraphicsPixmapItem? and later how to draw that canvas to main window?

    As you can see im a bit lost on how qt works so i will appreciate any help here :)

    Regards

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      QGraphicsScene might not be a bad choice if you need scrolling /panning etc.
      You use qgraphicsview to show anything you put into a scene. The scene is nonvisual.

      How big are these pixmaps ?

      as a note.
      You can draw in Qt by having a QWidget and overriding its paint event. Then use QPainter to draw
      what you want. QPainter has a rich api.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hanno_p
        wrote on last edited by
        #3

        Hi

        Pixmaps are small, 90x70 pxs, i don't need scroll or panning....seems i was choosing wrong..... Maybe is better to explain my goal so can propose me the best way.

        I want to draw the same video N times on the window and to have independent control on each one, imagine a 5x5 grid and in each cell i want to draw the video and each cell have independent playback from others....

        The video content is the same for all cells, even the video is small size i don't want to create 25 objects of mediaplayer and load same file on each one....

        So what i'm doing is to extract all the video frames to a vector of pixmaps and later share that vector among N classes where i use a qtimeline to control playback. That way i only load content to memory once and share that frames that i can control independent in each class.

        This point is clear.

        What im missing is what is the best approach to draw that content.

        Thank you

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved