Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    QStatusbar covers portion of QSplitter/CustomWidget

    General and Desktop
    1
    3
    875
    Loading More Posts
    • 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
      ASxa86 last edited by

      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 Reply Quote 0
      • A
        ASxa86 last edited by

        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 Reply Quote 0
        • A
          ASxa86 last edited by

          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 Reply Quote 0
          • First post
            Last post