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. QLabel image wrap around
Qt 6.11 is out! See what's new in the release blog

QLabel image wrap around

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 810 Views
  • 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.
  • A Offline
    A Offline
    agonzalez
    wrote on last edited by agonzalez
    #1

    Hello,

    I am setting a Pixmap to a QLabel and drawing on this label. I would like the image on my QLabel to wrap around. Meaning that when I pan my image, and I get to the end on the horizontal size, I would like the image to keep going.

    Could anyone help me?

    Thank you

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You have to do this by your own by reimplementing the paintEvent() and drawing the pixmap the way you want.

      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
      1
      • A Offline
        A Offline
        agonzalez
        wrote on last edited by
        #3

        Do you think you could provide an example of this?

        1 Reply Last reply
        0
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Maybe this should already work, but completely untested

          void foo:paintEvent(QPaintEvent *ev)
          {
            QPainter p(this);
            QBrush b(m_myPixmap);
            p.fillRect(rect(), b);
          }
          

          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

          • Login

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