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. class2->ui->label->setPixmap(ui->label->pixmap())
Qt 6.11 is out! See what's new in the release blog

class2->ui->label->setPixmap(ui->label->pixmap())

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 1.2k 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

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

    void FormProfile::edit()
    {
    EditProfile *editprofile=new EditProfile;
    editprofile->ui->label->setPixmap(ui->label->pixmap());
    }

    https://github.com/sonichy

    jsulmJ 1 Reply Last reply
    0
    • sonichyS sonichy

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

      void FormProfile::edit()
      {
      EditProfile *editprofile=new EditProfile;
      editprofile->ui->label->setPixmap(ui->label->pixmap());
      }

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #2

      @sonichy Please read documentation!
      http://doc.qt.io/qt-5/qlabel.html#pixmap-prop
      setPixmap() expects to get a reference to a QPixmap not a pointer (http://doc.qt.io/qt-5/qlabel.html#pixmap-prop pixmap()returns a pointer).
      Try

      editprofile->ui->label->setPixmap(*ui->label->pixmap());
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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