Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete Dock Widget in Qt Designer?

I added (via drag and drop) a QDockWidget to my GUI that I was editing in Designer...
Now I want to remove it.

Firstly, I selected the visible object and pressed the Delete key.
The Object disappeared.

However, the QDockWidget can be seen to still be present in the Object Inspector,
and when I try to save my .ui, I get the message:

The container extension of the widget MainWindow (QMainWindow)
returned a widget not managed by Designer dockWidget (QDockWidget)
when queried for page #2. Container pages should only be added by
specifying them in XML returned by the domXml() method of the custom
widget.

Clicking on the Widget in the Object Inspector and hitting the Delete key does nothing,
and the right-click context menu does not have the usual 'Remove' option.
How do I get rid of it?! :|

Specs:

Windows 7 32 bit  
PyQt4
like image 277
Anti Earth Avatar asked Oct 08 '11 12:10

Anti Earth


People also ask

How do I remove a widget from Qt?

Removing widgets from layout We use convenient function removeWidget() from Qt for the purpose. First, we get the item at index 0 in the grid using itemAt(0) then after we can remove it from the layout using removeItem() .

What is dock widget in Qt?

A QDockWidget consists of a title bar and the content area. The title bar displays the dock widgets window title, a float button and a close button. Depending on the state of the QDockWidget, the float and close buttons may be either disabled or not shown at all.

What is the difference between QMainWindow and QWidget?

A QDialog is based on QWidget , but designed to be shown as a window. It will always appear in a window, and has functions to make it work well with common buttons on dialogs (accept, reject, etc.). QMainWindow is designed around common needs for a main window to have.


1 Answers

I also had this problem - dockable windows in the object inspector which I couldn't see in the main window. Because I couldn't see them, I couldn't find a way to delete them. However, when I saved the file, I ignored the warning messages (the same you had). When I reloaded the saved ui file, all the erroneous dock windows in the object inspector had disappeared.

like image 174
Doug Avatar answered Sep 21 '22 03:09

Doug