A layout in Qt does not directly contain any widgets or, in this case, graphics items.
You need to put the widget or graphics item in a container, which is called a layout item.
The layout only uses layout items or other layouts to do the actual work.
This means that you can leave your custom item exactly as it is right now.
What you do need to create is a custom layout item. This layout item will contain your custom graphics item and report to the acual layout the size of your custom item, among other things.
+------------------------------------------------------------+
| Layout |
| |
| +-----------------------------------------------+ |
| | Layout Item | |
| | | |
| | +--------------------+ | |
| | | Graphics Item | | |
| | +--------------------+ | |
| +-----------------------------------------------+ |
| |
| +-----------------------------------------------+ |
| | Layout Item | |
| | | |
| | +--------------------+ | |
| | | Graphics Item | | |
| | +--------------------+ | |
| +-----------------------------------------------+ |
| |
+------------------------------------------------------------+
+------------------------------------------------------------+
| Layout |
| |
| +-----------------------------------------------+ |
| | Layout Item | |
| | | |
| | +--------------------+ | |
| | | Graphics Item | | |
| | +--------------------+ | |
| +-----------------------------------------------+ |
| |
| +-----------------------------------------------+ |
| | Layout Item | |
| | | |
| | +--------------------+ | |
| | | Graphics Item | | |
| | +--------------------+ | |
| +-----------------------------------------------+ |
| |
+------------------------------------------------------------+
To copy to clipboard, switch view to plain text mode
Bookmarks