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 to display a picture
Forum Updated to NodeBB v4.3 + New Features

How to display a picture

Scheduled Pinned Locked Moved Solved General and Desktop
43 Posts 8 Posters 87.3k Views 5 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.
  • P Payx

    I got one error : Expected one specifier before pixmap

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by mrjj
    #30

    @Payx
    the class is QPixmap
    so its "new QPixmap"

    setPixmap( new QPixmap(fileName ));

    Sorry, was just fast code.

    1 Reply Last reply
    1
    • P Offline
      P Offline
      Payx
      wrote on last edited by
      #31

      Yes i tried too before post but i had one error too, so i post the first error.

      The second is :
      No matching function for call to 'Qlabel::setPixmap(QPixmap*)"

      mrjjM 1 Reply Last reply
      2
      • P Payx

        Yes i tried too before post but i had one error too, so i post the first error.

        The second is :
        No matching function for call to 'Qlabel::setPixmap(QPixmap*)"

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #32

        @Payx
        Sorry not enough coffee :)

        QPixmap pix(fileName );
        setPixmap(pix);

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

          If u are using QImage

          m_imageLabel = new QLabel;
          QImage imagePixmap;
          imagePixmap.load(":/new/prefix1/Images/imageName.extension");
          m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
          

          Or

          Only QPixmap

          m_imageLabel = new QLabel;
          QPixmap imagePixmap;
          imagePixmap.load(":/new/prefix1/Images/imageName.extension");
          m_imageLabel->setPixmap(imagePixmap);
          

          imageName.extension can be image.png, image.jpeg.

          Pradeep Kumar
          Qt,QML Developer

          P 1 Reply Last reply
          2
          • Pradeep KumarP Pradeep Kumar

            If u are using QImage

            m_imageLabel = new QLabel;
            QImage imagePixmap;
            imagePixmap.load(":/new/prefix1/Images/imageName.extension");
            m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
            

            Or

            Only QPixmap

            m_imageLabel = new QLabel;
            QPixmap imagePixmap;
            imagePixmap.load(":/new/prefix1/Images/imageName.extension");
            m_imageLabel->setPixmap(imagePixmap);
            

            imageName.extension can be image.png, image.jpeg.

            P Offline
            P Offline
            Payx
            wrote on last edited by
            #34

            @Pradeep-Kumar said in How to display a picture:

            If u are using QImage

            m_imageLabel = new QLabel;
            QImage imagePixmap;
            imagePixmap.load(":/new/prefix1/Images/imageName.extension");
            m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
            

            Or

            Only QPixmap

            m_imageLabel = new QLabel;
            QPixmap imagePixmap;
            imagePixmap.load(":/new/prefix1/Images/imageName.extension");
            m_imageLabel->setPixmap(imagePixmap);
            

            imageName.extension can be image.png, image.jpeg.

            U didnt read the thread i think :-).
            But thx

            @mrjj Lol no problem :-)
            Thanks it works i will create an other thread for an other question after

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

              Thread says how to display a picture

              @Payx
              Is this the thing?.
              correct me if i was wrong.

              Pradeep Kumar
              Qt,QML Developer

              P 1 Reply Last reply
              1
              • Pradeep KumarP Pradeep Kumar

                Thread says how to display a picture

                @Payx
                Is this the thing?.
                correct me if i was wrong.

                P Offline
                P Offline
                Payx
                wrote on last edited by
                #36

                @Pradeep-Kumar said in How to display a picture:

                Thread says how to display a picture

                @Payx
                Is this the thing?.
                correct me if i was wrong.

                wow u just answer the question after 5 guys answer me.

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

                  Hmmmmmmmmmm was toooooooooooo late.:)))

                  Pradeep Kumar
                  Qt,QML Developer

                  1 Reply Last reply
                  1
                  • P Payx

                    @Pradeep-Kumar said in How to display a picture:

                    If u are using QImage

                    m_imageLabel = new QLabel;
                    QImage imagePixmap;
                    imagePixmap.load(":/new/prefix1/Images/imageName.extension");
                    m_imageLabel->setPixmap(QPixmap::fromImage(imagePixmap));
                    

                    Or

                    Only QPixmap

                    m_imageLabel = new QLabel;
                    QPixmap imagePixmap;
                    imagePixmap.load(":/new/prefix1/Images/imageName.extension");
                    m_imageLabel->setPixmap(imagePixmap);
                    

                    imageName.extension can be image.png, image.jpeg.

                    U didnt read the thread i think :-).
                    But thx

                    @mrjj Lol no problem :-)
                    Thanks it works i will create an other thread for an other question after

                    Pradeep KumarP Offline
                    Pradeep KumarP Offline
                    Pradeep Kumar
                    wrote on last edited by
                    #38

                    Thanks it works i will create an other thread for an other question after

                    If it is working can u mark thread has solved, so it will be useful in future.
                    Cheers.:)))))))

                    Thanks,

                    Pradeep Kumar
                    Qt,QML Developer

                    1 Reply Last reply
                    1
                    • P Offline
                      P Offline
                      Payx
                      wrote on last edited by
                      #39

                      How can i do that ?

                      1 Reply Last reply
                      0
                      • Pradeep KumarP Offline
                        Pradeep KumarP Offline
                        Pradeep Kumar
                        wrote on last edited by Pradeep Kumar
                        #40

                        u have already marked as solved for this thread.

                        Pradeep Kumar
                        Qt,QML Developer

                        1 Reply Last reply
                        0
                        • Pradeep KumarP Offline
                          Pradeep KumarP Offline
                          Pradeep Kumar
                          wrote on last edited by
                          #41

                          Anyways in the right bottom of the topic u will see topic button and u see mark as solved under the topic button, click on it.

                          :)

                          Thanks.

                          Pradeep Kumar
                          Qt,QML Developer

                          1 Reply Last reply
                          1
                          • S Offline
                            S Offline
                            spice
                            wrote on last edited by
                            #42

                            The link address has expired
                            Please pay attention to select the example corresponding to your current qt version in the upper right corner
                            https://code.qt.io/cgit/qt/qtbase.git/tree/examples/widgets/widgets/imageviewer?h=5.15

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              Milad 24
                              Banned
                              wrote on last edited by
                              #43
                              This post is deleted!
                              1 Reply Last reply
                              0
                              • MaybecuteM Maybecute referenced this topic on

                              • Login

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