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. QStatusbar covers portion of QSplitter/CustomWidget
QtWS25 Last Chance

QStatusbar covers portion of QSplitter/CustomWidget

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

    In the application i'm developing. My top level widget is a vertical QSplitter.

    First question, I need the splitter to be the same size as the viewport of my window. Is there a policy I can set that will take care of this?

    My current "fix" for this is:
    @
    void FormMain::resizeEvent(QResizeEvent* event)
    {
    this->m_uiMainWindow.vSplitter->setFixedSize(event->size());
    }
    @

    I would much rather set some policy in QtDesigner for this if possible.

    Secondly, the bottom 20-30 pixels of my vSplitter is being covered by the status bar. So I updated my resize event to "fix" this too.

    @
    void FormMain::resizeEvent(QResizeEvent* event)
    {
    // AMS // 4/2/2014 //
    // programmatically resize the vertical splitter as I was unable to do so through QtDesigner
    // we also need to ensure the vertical splitter sits above the status bar
    const auto size = event->size();
    const auto statusBarSize = this->m_uiMainWindow.statusbar->size();
    const auto arbitraryMagicNumber = 24;

    this->m_window.vSplitter->setFixedWidth(size.width());
    this->m_window.vSplitter->setFixedHeight(
    size.height() - (statusBarSize.height() + arbitraryMagicNumber)
    );
    }
    @

    I pretty much guessed and checked until the vSplitter finally sat above the status bar and i could see the child widgets clearly.

    What might I be doing wrong here? Surely I do not have to run my own resize event for this.

    Any suggestions would be great!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ASxa86
      wrote on last edited by
      #2

      So the second part I was able to resolve I think. I was resizing based on QMainWindow's size which includes menubar etc. Not the centralWidget size which is essentially the "view port". That being said, I would still like to set up some policies/size hints that would take care of the resizing for me if possible.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ASxa86
        wrote on last edited by
        #3

        This does exactly what I need. The only other question I have is, is there a way to do this in QtDesigner?

        @
        void FormMain::resizeEvent(QResizeEvent* event)
        {
        // AMS // 4/2/2014 //
        // programmatically resize the vertical splitter as I was unable to do so through QtDesigner
        this->m_window.vSplitter->setFixedSize(this->m_window.centralwidget->size());
        }
        @

        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