PDA

View Full Version : Dockwidget and Toolbutton



sandeepvl
9th May 2008, 12:48
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.

aamer4yu
12th May 2008, 13:17
Can u show code where u are using setWidget ???

jpn
12th May 2008, 13:19
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.

sandeepvl
13th May 2008, 07:23
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.