Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Unsolved How create dynamic arrays of QImage?

    General and Desktop
    2
    2
    77
    Loading More Posts
    • 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
      loginmen last edited by 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

      artwaw 1 Reply Last reply Reply Quote 0
      • artwaw
        artwaw @loginmen last edited by

        @loginmen why not QVector<QImage>?

        For more information please re-read.

        Kind Regards,
        Artur

        1 Reply Last reply Reply Quote 4
        • First post
          Last post