Results 1 to 5 of 5

Thread: setLayout to QDockWidget

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2009
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default setLayout to QDockWidget

    hi all,

    i am new to QT programming, i want to create a Dockwidget and it contain some label and text box layout, for that i create a QDockwidget object and i create QGridLayout object and addWidget as label and text box.

    while setting the layout to dockwidget it not showing the layout.
    here my code:

    Qt Code:
    1. dwidget = new QDockWidget(tr("&Name"), this);
    2. dwidget->setAllowedAreas(Qt::AllDockWidgetAreas);
    3. dwidget->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::AllDockWidgetFeatures);
    4. dwidget->setObjectName("NEW Widget");
    5. dwidget->setWindowTitle("NewDock");
    6.  
    7. label1 = new QLabel("Name: ");
    8. txtEdit = new QLineEdit;
    9.  
    10. mainLayout = new QGridLayout();
    11. mainLayout->addWidget(label1, 0, 0);
    12. mainLayout->addWidget(txtEdit, 0, 1);
    13.  
    14. dwidget->setLayout(mainLayout);
    15.  
    16. addDockWidget(Qt::RightDockWidgetArea, dwidget);
    To copy to clipboard, switch view to plain text mode 
    it complies success but while running the program its not showing any layout on dockwidget.

    is there any solution for this?

    Regards.
    hemraj
    Last edited by jpn; 21st April 2009 at 10:59. Reason: missing [code] tags

Similar Threads

  1. QDockWidget magically disapear
    By 1111 in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2009, 11:44
  2. widget not resized within QDockWidget
    By pospiech in forum Qt Programming
    Replies: 2
    Last Post: 4th December 2008, 18:19
  3. QDockWidget closing detection
    By danielperaza in forum Qt Programming
    Replies: 1
    Last Post: 16th April 2008, 15:28
  4. contextmenu in QDockWidget title
    By klipko in forum Newbie
    Replies: 4
    Last Post: 7th March 2008, 22:32
  5. Replies: 8
    Last Post: 4th February 2007, 00:42

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
  •  
Qt is a trademark of The Qt Company.