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. How create dynamic arrays of QImage?
Forum Updated to NodeBB v4.3 + New Features

How create dynamic arrays of QImage?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 172 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.
  • L Offline
    L Offline
    loginmen
    wrote on last edited by loginmen
    #1

    I want try something this

    void load(QImage *imgs) {
        //read number of images (int num)
        imgs = new QImage[num]{};
        for (uint i = 0; i < num; i++) {
            //read data (QByteArray data) from QFile
            QImage img{QImage::fromData(data, "PNG")};
            int w{img.width()};
            int h{img.height()};
            imgs[i] = img.scaled(w * scale, h *scale);
        }
    }
    

    But imgs outside has deleted QImage, operator= use & and not copy object(((
    Can use only dynamic arrays

    artwawA 1 Reply Last reply
    0
    • L loginmen

      I want try something this

      void load(QImage *imgs) {
          //read number of images (int num)
          imgs = new QImage[num]{};
          for (uint i = 0; i < num; i++) {
              //read data (QByteArray data) from QFile
              QImage img{QImage::fromData(data, "PNG")};
              int w{img.width()};
              int h{img.height()};
              imgs[i] = img.scaled(w * scale, h *scale);
          }
      }
      

      But imgs outside has deleted QImage, operator= use & and not copy object(((
      Can use only dynamic arrays

      artwawA Offline
      artwawA Offline
      artwaw
      wrote on last edited by
      #2

      @loginmen why not QVector<QImage>?

      For more information please re-read.

      Kind Regards,
      Artur

      1 Reply Last reply
      4

      • Login

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