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. Doubt getting window size
Forum Updated to NodeBB v4.3 + New Features

Doubt getting window size

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

    Hi all:
    I'm creating an application using QMainWindow.
    I'm using a label with a pixmap as a background, but I cannot get the complete window filled with the background image, probably due to the pixmap size. How I could achieve that?
    At the same time I would like that if the window is resized background is still filling all the available window
    Thanks in advance!!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maxmotor
      wrote on last edited by
      #2

      I'm using a frame instead of a label.
      @
      ui.frame->setGeometry(this->geometry());
      @
      Guess you could just scale the pixmap to the frame/label?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        fluca1978
        wrote on last edited by
        #3

        This works for me:

        @ QLabel* defaultCentralWidget = new QLabel( this );
        defaultCentralWidget->setPixmap( QPixmap( ":/logo/img/logo/logo.png") );
        defaultCentralWidget->setAlignment( Qt::AlignCenter );
        defaultCentralWidget->setScaledContents( true );
        setCentralWidget( defaultCentralWidget );@

        1 Reply Last reply
        0
        • T Offline
          T Offline
          task_struct
          wrote on last edited by
          #4

          Hi,

          take a look at "this thread":http://developer.qt.nokia.com/forums/viewthread/12191 and "this one":http://developer.qt.nokia.com/forums/viewthread/4871

          "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program."

          • Linu...
          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