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. [Solved] Know the size of the central zone?
Forum Updated to NodeBB v4.3 + New Features

[Solved] Know the size of the central zone?

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

    The hyerarchy of my system is like this:

    QMainWindow has a Graphics View assigned as the central widget with an OPENGL viewport showing a scene.
    It also has a QWidget with a Vertical Layout under Central Widget (so it evades the toolbar).
    The reason to have a container widget for all things FLOATING over the openGL viewport on the background
    is because i need it to have a new layout.

    Then i add all the buttons inside.

    What happens?
    When i do this:
    @
    mainWindowContainer_ = new QWidget(mainWindow_->centralWidget());
    mainWindowContainer_->setMinimumSize(mainWindow_->centralWidget()->geometry().width(),mainWindow_->centralWidget()->geometry().height());

    mainWindowContainer_->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);

    mainWindowContainer_->setAutoFillBackground(false);
    @

    I get a black background all over the viewport... and the size is bigger, so i see my Windows Start bar over it.

    The main window is using "showMaximized"

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

      I found out how to do it.

      I added this widget under the Graphics Scene with addWidget. That way it creates a Proxy between so it´s like a graphics item. Now opengl under works.

      Then i reimplemented the graphicsView resize event, so it tells this widget to resize too.

      After using showMaximized to the window, it resized the graphics viewport, and then the widget container, so the UI now works superb.

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

        What happens is that Layouts don´t work good with OpenGL underneath. It appears black, doesn´t repaint openGL.
        If you remove the layout, it works, but then you have to position widgets around by hand.

        And if you have stylesheet assigned and round corners, the corners will be black too. A work around is to add this flag:

        @
        widget->setAttribute( Qt::WA_TranslucentBackground );
        @

        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