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. Rendering in QWidget using QPainter
Forum Updated to NodeBB v4.3 + New Features

Rendering in QWidget using QPainter

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.7k Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    Hi,

    We have the widget , were we are painting the live streams(bitmap) on to the QWidget, and the bitmap is of high quality image 720p , do we need any special functions to render on to the QWIdget via QPainter?.

    Thanks,

    Pradeep Kumar
    Qt,QML Developer

    jsulmJ 1 Reply Last reply
    0
    • Pradeep KumarP Pradeep Kumar

      Hi,

      We have the widget , were we are painting the live streams(bitmap) on to the QWidget, and the bitmap is of high quality image 720p , do we need any special functions to render on to the QWIdget via QPainter?.

      Thanks,

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Pradeep-Kumar Not that I know. You just pass your widget to QPainter constructor and then use that painter to paint. What special functions do you mean?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        Hi,

        We have pixel data of bitmap and header , and we dont have file header for the bitmap .

        Sample code :

        m_data = bitmap;  // without file header
        
          image->loadFromData(m_data);
        
           QRect rect(m_widget->x(),m_widget->y(),m_widget->width(),m_widget->height());
        
        
        
           QPainter painter(this);
           painter.drawImage(rect,*image,image->rect());
        

        , we have a buffer without file header can we paint?.
        Any alternate api to load?.

        from docs

        bool QImage::loadFromData(const uchar * data, int len, const char * format = 0)
        
        Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.
        
        The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.
        

        Thanks,

        Pradeep Kumar
        Qt,QML Developer

        jsulmJ 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          What do you mean by bitmap ? RGB32 raw data ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Pradeep KumarP Pradeep Kumar

            Hi,

            We have pixel data of bitmap and header , and we dont have file header for the bitmap .

            Sample code :

            m_data = bitmap;  // without file header
            
              image->loadFromData(m_data);
            
               QRect rect(m_widget->x(),m_widget->y(),m_widget->width(),m_widget->height());
            
            
            
               QPainter painter(this);
               painter.drawImage(rect,*image,image->rect());
            

            , we have a buffer without file header can we paint?.
            Any alternate api to load?.

            from docs

            bool QImage::loadFromData(const uchar * data, int len, const char * format = 0)
            
            Loads an image from the first len bytes of the given binary data. Returns true if the image was successfully loaded; otherwise invalidates the image and returns false.
            
            The loader attempts to read the image using the specified format, e.g., PNG or JPG. If format is not specified (which is the default), the loader probes the file for a header to guess the file format.
            

            Thanks,

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Pradeep-Kumar As the documentation says you can specify the format. Do you? Does loadFromData() return true or false? Did you actually try before asking?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            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