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. QWidget::size()
Forum Updated to NodeBB v4.3 + New Features

QWidget::size()

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

    Hello,
    I am rather new to Qt and the QWidget::size() function is confusing me.
    What exactly does it return? One would expect it to give you the actual size of the widget on your screen in pixels, but this seems to be false. For example, "this":http://pasteboard.co/1348433126209172.png has the "size()" 640x480.
    Can someone explain it to me?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Roman74
      wrote on last edited by
      #2

      I think it will help you:
      http://doc-snapshot.qt-project.org/4.8/application-windows.html

      1 Reply Last reply
      0
      • W Offline
        W Offline
        Wurstinator
        wrote on last edited by
        #3

        Uhm, I am sorry but it doesn't.
        Maybe I just fail to see the part of the article which answers my question or maybe you misunderstood me.

        1 Reply Last reply
        0
        • U Offline
          U Offline
          utcenter
          wrote on last edited by
          #4

          The method should return the size of the particular widget, be that a "main" widget that is the root of your application, sitting in an OS window frame, or some nested sub-component. In the first case, the size returned is without the window frame and title bar. If you aren't getting it correctly it is either a bug or more likely you are doing something wrong.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            when do you call the method size? This might have impact on the answer...

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • W Offline
              W Offline
              Wurstinator
              wrote on last edited by
              #6

              I kinda feel stupid now. It's as Gerolf intended, I called the function before the Widget had it's final size. I tried inside resizeEvent() again and it seems to work fine.

              Thanks for the help.

              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