Results 1 to 2 of 2

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

  1. #1
    Join Date
    May 2007
    Posts
    99
    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

    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
    __________________
    Marcel

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

    Do you have a layout set for the dockwidget?
    __________________
    Marcel

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


    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
    __________________
    Marcel

    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
    Qt Code:
    QVBoxLayout *dockLayout = new QVBoxLayout;
    QDockWidget *dock = new QDockWidget("", this);
    m_dockLog->setLayout(dockLayout);
    i get following debugmessage:
    QWidget::setLayout: Attempting to add QLayout "" to QDockWidget "" which already has a layout




    Join Date: Feb 2006
    Location: Romania
    Qt products used: Qt4
    Qt platforms used: Unix/X11, Windows
    Posts: 1,854
    Thanks: 6
    Thanked 337 Times in 334 Posts
    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
    __________________
    Marcel

    #9
    4th September 2007, 12:25
    santosh.kumar
    Novice

    Join Date: May 2007
    Qt products used: Qt4
    Qt platforms used: MacOS
    Posts: 22
    Thanks: 2
    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;




    if anybody know this plz help me

  2. #2
    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

    this was already discussed & solved in another post

    subclass a QFrame or QWidget, define the sizeHint() Method, arrange your Log inside this QWidget/QFrame and set a proper layout.

    now just use QDockWidgets addWidget() Method to put the subclassed QWidget/QFrame inside.

    now your size constrains should work properly.

Similar Threads

  1. Replies: 8
    Last Post: 4th September 2007, 13:25
  2. Replies: 3
    Last Post: 23rd July 2006, 18: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.