Results 1 to 4 of 4

Thread: Dockwidget and Toolbutton

  1. #1
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Dockwidget and Toolbutton

    Hi all,
    i am a newbie in Qt programming. i am doing an editor like tool for VHDL files. i have my own configuration file for storing the configurations regarding the project settings. i have a QTextEdit set as the centralWidget of main window....and a dock widget which is left or right dockable. Dockwidget will contain a set of tool buttons which when clicked will show the corresponding information in a textedit inside the dockwidget.

    My problem is that, when i add the toolButtons in the dockwidget using dockWidget->setWidget(), the last button comes on top of the previous one.... any ideas on how to solve this..??? (code for the dock widget is attached.)

    Also when i do the same thing thru Designer, there is no issue of overlapping buttons. But when i used the layout on the buttons in the dock widget, the size of the buttons are automatically adjusted. This will make the buttons non uniform. How may i solve this?

    Thanks in advance.... this is my first post in this forum... xpecting quick replies... Please help me if anyone has an idea...
    Regards
    Sandeep.
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dockwidget and Toolbutton

    Can u show code where u are using setWidget ???

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Dockwidget and Toolbutton

    QDockWidget contains ONE widget. Calling QDockWidget::setWidget() multiple times won't add multiple widgets in the dock widget. Create a layout, add buttons to it, install the layout on a container widget and set the container widget inside the dock widget.
    J-P Nurmi

  4. The following user says thank you to jpn for this useful post:

    sandeepvl (13th May 2008)

  5. #4
    Join Date
    Apr 2008
    Posts
    4
    Thanks
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dockwidget and Toolbutton

    thanks frnds... it worked for me.. as guru said, i added the tool buttons to another widget and added that widget in a layout and then added it to dock window.. i think it was the problem with the layout.

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.