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. QMainWindow top left position excluding frames and menu bar?
Forum Updated to NodeBB v4.3 + New Features

QMainWindow top left position excluding frames and menu bar?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 4.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.
  • D Offline
    D Offline
    darkgaze
    wrote on last edited by
    #1

    Hi people.

    I have a central widget with an opengl viewport. A graphics View.
    I have the window and the QMenuBar on it.

    I need to position floating buttons over the viewport.

    I want to position them relative to the viewport, top left position, 0,0 . But surprissingly 0,0 is over the MenuBar, as if the menu bar was part of the viewport.

    I tried:

    @
    button_->move( mainWindow_->centralWidget()->geometry().x(), mainWindow_->centralWidget()->geometry().y() + mainWindow_->menuBar()->height() );
    @

    But when i grab the window to demaximize it, the button doesn´t stay in the same position. Sometimes stays a little upper, others, on the left...

    I need the 0,0 position ! but it doesn´t work with mainWindow_ , neither with centralWidget()

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

      You should take a look at "that":http://qt-project.org/doc/qt-4.8/application-windows.html#window-geometry. Hope this helps!

      1 Reply Last reply
      0
      • D Offline
        D Offline
        darkgaze
        wrote on last edited by
        #3

        That doesn´t work. I knew you would probably tell me that :D

        Doesn´t work at all. It only talks about the TITLE BAR, no the menu bar.

        geometry 0,0 means top left of the MENU BAR.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          darkgaze
          wrote on last edited by
          #4

          I finally did it by hand, using by hand values, but this sollution is so bad... i don´t find another way!.

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tilsitt
            wrote on last edited by
            #5

            Hi,

            did you try "mapToGlobal":http://qt-project.org/doc/qt-4.8/qwidget.html#mapToGlobal

            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