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. Qt6 QImage never loads image but Qt5 worked
Forum Updated to NodeBB v4.3 + New Features

Qt6 QImage never loads image but Qt5 worked

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 411 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.
  • W Offline
    W Offline
    whatabout
    wrote on last edited by
    #1

    I have this :

    QString full_path("/home/me/image.tif");
    QImage image(full_path);
    if (image.isNull()) {
    puts("uh oh");
    } else {
    QPixmap p(image);
    m_label.setPixmap(p);
    }

    This worked fine on qt5 but in qt6 it is broken.
    What happened?

    C 1 Reply Last reply
    0
    • W whatabout

      I'm using Linux.
      By not work I mean isNull() returns true.
      I'm not using an IDE.
      Does anyone know how I can add that to my .pro file?

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by ChrisW67
      #4

      @whatabout said in Qt6 QImage never loads image but Qt5 worked:

      Does anyone know how I can add that to my .pro file?

      Add what to your pro file?
      Just install/deploy the plugin

      Christian EhrlicherC W 2 Replies Last reply
      1
      • W whatabout

        I have this :

        QString full_path("/home/me/image.tif");
        QImage image(full_path);
        if (image.isNull()) {
        puts("uh oh");
        } else {
        QPixmap p(image);
        m_label.setPixmap(p);
        }

        This worked fine on qt5 but in qt6 it is broken.
        What happened?

        C Offline
        C Offline
        ChrisW67
        wrote on last edited by
        #2

        @whatabout My wild guess is that you do not have a Qt TIFF image format plugin installed in whatever environment this code is being run in.
        eaa754a3-8675-47a6-b221-7b84106b9559-image.png

        BTW: You forgot to include a lot of information in the question. For example:

        • What does not work mean? Does not compile, does not run, runs but does something unexpected?
        • In what environment? Windows, Linux, Mac, other
        • A deployed application or in the development environment?
        1 Reply Last reply
        2
        • W Offline
          W Offline
          whatabout
          wrote on last edited by whatabout
          #3

          I'm using Linux.
          By not work I mean isNull() returns true.
          I'm not using an IDE.
          Does anyone know how I can add that to my .pro file?

          C 1 Reply Last reply
          0
          • W whatabout

            I'm using Linux.
            By not work I mean isNull() returns true.
            I'm not using an IDE.
            Does anyone know how I can add that to my .pro file?

            C Offline
            C Offline
            ChrisW67
            wrote on last edited by ChrisW67
            #4

            @whatabout said in Qt6 QImage never loads image but Qt5 worked:

            Does anyone know how I can add that to my .pro file?

            Add what to your pro file?
            Just install/deploy the plugin

            Christian EhrlicherC W 2 Replies Last reply
            1
            • C ChrisW67

              @whatabout said in Qt6 QImage never loads image but Qt5 worked:

              Does anyone know how I can add that to my .pro file?

              Add what to your pro file?
              Just install/deploy the plugin

              Christian EhrlicherC Online
              Christian EhrlicherC Online
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #5

              And another question - how large is your image. I'm asking because of the allocationLimit.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              0
              • C ChrisW67

                @whatabout said in Qt6 QImage never loads image but Qt5 worked:

                Does anyone know how I can add that to my .pro file?

                Add what to your pro file?
                Just install/deploy the plugin

                W Offline
                W Offline
                whatabout
                wrote on last edited by whatabout
                #6

                @ChrisW67 said in Qt6 QImage never loads image but Qt5 worked:

                Just install/deploy the plugin

                OK I see what happened. My system didn't have all qt6 packages installed for some reason.

                But I'm not clear though on why plugins are being used. Was this the case with qt5?

                Christian EhrlicherC 1 Reply Last reply
                0
                • W whatabout

                  @ChrisW67 said in Qt6 QImage never loads image but Qt5 worked:

                  Just install/deploy the plugin

                  OK I see what happened. My system didn't have all qt6 packages installed for some reason.

                  But I'm not clear though on why plugins are being used. Was this the case with qt5?

                  Christian EhrlicherC Online
                  Christian EhrlicherC Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #7

                  @whatabout said in Qt6 QImage never loads image but Qt5 worked:

                  Was this the case with qt5?

                  Maybe, maybe not - it depends on how you installed your Qt. Qt5 was modularized already in the Qt installer but Qt6 gets even more splitted to reduce the installation footprint so yes it might be the case.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • W whatabout has marked this topic as solved on

                  • Login

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