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. QMessageBox.setIconPixmap(QLabel.pixmap()) ?

QMessageBox.setIconPixmap(QLabel.pixmap()) ?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.6k 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.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    reference to type 'const QPixmap' could not bind to an lvalue of type 'const QPixmap *'

    QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !");
    const QPixmap *pixmap = ui->label_avatar1->pixmap();
    MB.setIconPixmap(pixmap);
    MB.exec();
    

    https://github.com/sonichy

    JKSHJ 1 Reply Last reply
    0
    • sonichyS sonichy

      reference to type 'const QPixmap' could not bind to an lvalue of type 'const QPixmap *'

      QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !");
      const QPixmap *pixmap = ui->label_avatar1->pixmap();
      MB.setIconPixmap(pixmap);
      MB.exec();
      
      JKSHJ Offline
      JKSHJ Offline
      JKSH
      Moderators
      wrote on last edited by
      #2

      QMessageBox::setIconPixmap() takes const QPixmap &, not const QPixmap *

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      sonichyS 1 Reply Last reply
      1
      • JKSHJ JKSH

        QMessageBox::setIconPixmap() takes const QPixmap &, not const QPixmap *

        sonichyS Offline
        sonichyS Offline
        sonichy
        wrote on last edited by
        #3

        @JKSH
        error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'

        const QPixmap &pixmap = ui->label_avatar1->pixmap();
        

        https://github.com/sonichy

        JKSHJ 1 Reply Last reply
        0
        • sonichyS sonichy

          @JKSH
          error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'

          const QPixmap &pixmap = ui->label_avatar1->pixmap();
          
          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by JKSH
          #4

          @sonichy said in QMessageBox.setIconPixmap(QLabel.pixmap()) ?:

          @JKSH
          error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'

          const QPixmap &pixmap = ui->label_avatar1->pixmap();
          

          QLabel::pixmap() returns const Pixmap *, not const Pixmap &

          Do you know how to use pointers and references?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          sonichyS 1 Reply Last reply
          0
          • JKSHJ JKSH

            @sonichy said in QMessageBox.setIconPixmap(QLabel.pixmap()) ?:

            @JKSH
            error: reference to type 'const QPixmap' could not bind to an rvalue of type 'const QPixmap *'

            const QPixmap &pixmap = ui->label_avatar1->pixmap();
            

            QLabel::pixmap() returns const Pixmap *, not const Pixmap &

            Do you know how to use pointers and references?

            sonichyS Offline
            sonichyS Offline
            sonichy
            wrote on last edited by
            #5

            @JKSH Solved !

            QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !");
            const QPixmap *pixmap = ui->label_avatar1->pixmap();
            MB.setIconPixmap(*pixmap);
            MB.exec();
            

            https://github.com/sonichy

            JKSHJ 1 Reply Last reply
            0
            • sonichyS sonichy

              @JKSH Solved !

              QMessageBox MB(QMessageBox::NoIcon, "Result", "Player1 win !");
              const QPixmap *pixmap = ui->label_avatar1->pixmap();
              MB.setIconPixmap(*pixmap);
              MB.exec();
              
              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              @sonichy said in QMessageBox.setIconPixmap(QLabel.pixmap()) ?:

              Solved !

              👍

              Please mark as solved (Click "Topic Tools" on the top-right or bottom-right of this page)

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              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