Results 1 to 9 of 9

Thread: How to set the resizeHint of any bottom logReport window of MainWindow

  1. #1
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default 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

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  3. #3
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default 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.....

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set the resizeHint of any bottom logReport window of MainWindow

    Do you have a layout set for the dockwidget?

  5. #5
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default 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......

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  7. #7
    Join Date
    Jan 2007
    Posts
    68
    Thanks
    9
    Thanked 8 Times in 8 Posts

    Default Re: How to set the resizeHint of any bottom logReport window of MainWindow

    Quote Originally Posted by marcel View Post
    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
    Qt Code:
    1. QVBoxLayout *dockLayout = new QVBoxLayout;
    2. QDockWidget *dock = new QDockWidget("", this);
    3. m_dockLog->setLayout(dockLayout);
    To copy to clipboard, switch view to plain text mode 
    i get following debugmessage:
    QWidget::setLayout: Attempting to add QLayout "" to QDockWidget "" which already has a layout

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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

  9. #9
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default 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;

Similar Threads

  1. Replies: 3
    Last Post: 23rd July 2006, 19:02

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.