QStatusbar covers portion of QSplitter/CustomWidget
-
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!
-
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.
-
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());
}
@