How to set the resizeHint of any bottom logReport window of MainWindow
hi all
I m creating one application that contains mainWindow..this mainWindow contains resizable Bottom Dockable LogReport Window...But problem is that when execute the mainWindow by defualt height of this LogReport window is more than i want....i want to set some minimumSizeHint so that while starting window it will come with this sizeHint...
How i will do this ...if anybody know then some sample code so that i will understand....
thanks
santosh
Re: How to set the resizeHint of any bottom logReport window of MainWindow
You have QDockWidget::setMinimumHeight but you can also impose this restriction on the widget that is contained by the dock widget.
Regards
Re: How to set the resizeHint of any bottom logReport window of MainWindow
hi
Actually i m usin one treeWidet inside the dockWidet .... According to u i used QDockWidet::setMinimumHeiht for both dockWidget and treeWidget.... but starting size is not coming according to my size...
it is taking other size by default.....
Re: How to set the resizeHint of any bottom logReport window of MainWindow
Do you have a layout set for the dockwidget?
Re: How to set the resizeHint of any bottom logReport window of MainWindow
no i have not set the layout for any dockWidget or treeWidget.....but for centralWidget i used layout....central Widget contains display tree with scrollbar....bottom dokwidget is resizable an working accordingly but problem is that by default height of treeWidget including dockwidget is more than prefect size......
Re: How to set the resizeHint of any bottom logReport window of MainWindow
That is why the minimum height is not respected. You need a layout set in the dock widget.
Add a vertical layout (QVBoxLayout) to the dock widget and add that tree widget to it. It will work this way when setting a minimum height for the treewidget.
Regards
Re: How to set the resizeHint of any bottom logReport window of MainWindow
Quote:
Originally Posted by
marcel
That is why the minimum height is not respected. You need a layout set in the dock widget.
Add a vertical layout (QVBoxLayout) to the dock widget and add that tree widget to it. It will work this way when setting a minimum height for the treewidget.
Regards
I'dont think this works
Code:
m_dockLog->setLayout(dockLayout);
i get following debugmessage:
QWidget::setLayout: Attempting to add QLayout "" to QDockWidget "" which already has a layout
Re: How to set the resizeHint of any bottom logReport window of MainWindow
In that case remove the first layout( delete it actually).
Take a look at the comments for setLayout in the docs.
Regards
Re: How to set the resizeHint of any bottom logReport window of MainWindow
QTreeWidget * m_pLogViewTreeWidget = new QTreeWidget;
m_pLogViewTreeWidget->setMinimumHeight(100);
QDockWidget *m_pLogReportDockWidget = new QDockWidget(tr("Log Report"),this);
m_pLogReportDockWidget->setAllowedAreas(Qt::BottomDockWidgetArea);
m_pLogReportDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures) ;
QVBoxLayout *pLayout = new QVBoxLayout;
pLayout->addWidget(m_pLogViewTreeWidget);
m_pLogReportDockWidget->setLayout(pLayout);
m_pLogReportDockWidget->setMinimumHeight(100);
addDockWidget(Qt::BottomDockWidgetArea,m_pLogRepor tDockWidget);
this bottom dockWidget set the layout and it by default it is coming 100 width that is fine ...but again problem is that when i use
pLayout ->addWidget(m_pLogViewTreeWidget) this treeWidget is not shown and added into dockwidget area...only layout is set...while i have already used addWidget;