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->setPixmap scalable
Forum Updated to NodeBB v4.3 + New Features

QLabel->setPixmap scalable

Scheduled Pinned Locked Moved General and Desktop
2 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.
  • B Offline
    B Offline
    beowulf
    wrote on last edited by
    #1

    @ MyLabel = new QLabel(ui->widget);
    MyLabel->setGeometry(QRect(0, 0, 336, 425));
    MyLabel->setPixmap(QPixmap(":/logo.jpg"));@

    How to make under that window is resized the QLabel image is also resized? Do not crop, resize proportionally.

    -- 0x00

    1 Reply Last reply
    0
    • M Offline
      M Offline
      master of disaster
      wrote on last edited by
      #2

      The function scaled() should help you:

      @
      MyLabel->setPixmap(QPixmap(":/logo.jpg").scaled(...));
      @

      The parameters of the function scaled() can be found here:
      http://qt-project.org/doc/qt-4.8/qpixmap.html#scaled

      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