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. Automatic re-sizing of QWizardPage and QLable in it

Automatic re-sizing of QWizardPage and QLable in it

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.0k 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.
  • T Offline
    T Offline
    tesmai4
    wrote on last edited by
    #1

    I am loading an image on a QLabel in my QWizardPage. The images being loaded are of different sizes. I want to re-size the QLable and QWizardPage accordingly.

    Following code is not serving the purpose and I see a white are in my QLabel.

    @label1 = new QLabel(tr("imageHolder"));

    label1->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    QPixmap pm1("Y:/background.png");
    
    label1->setPixmap(pm1);
    label1->setSizePolicy(QSizePolicy::MinimumExpanding,
                      QSizePolicy::MinimumExpanding);
    

    label1->adjustSize();
    label1->setScaledContents(true);
    rubberBand = new QRubberBand(QRubberBand::Rectangle, this);

    QHBoxLayout *hlayout1 = new QHBoxLayout();
    hlayout1->addWidget(label1);
    setLayout(hlayout1);@
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you sure the file can be found and opened ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tesmai4
        wrote on last edited by
        #3

        Thanks for your reply.
        Yes, the image for QPixmap is correct and the specified image is loaded in the QLable. My problem is with re-sizing of the QLabel and QWizardPage according to the image size.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then why do you call setScaledContents ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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