PDA

View Full Version : Qt Designer (creator) widget box like widget



AlekseyK
16th March 2016, 13:13
Tried to find good example or complete code for Qt Designer (creator) widget box like widget with QWidget or QFrame within. So it should work like QToolBox or QTabWidget but be expandable: possible to view few pages (widgets) at a time, not single one like QToolBox or QTabWidget or QStackedWidget provide. There is a class WidgetBoxTreeWidget in Qt sources for Qt Designer but it is VERY complex and contains much unnecessary things and explicit functionality for me.

http://i.stack.imgur.com/HgSGe.png

Find just basic implementation (http://www.fancyaddress.com/blog/qt-2/create-something-like-the-widget-box-as-in-the-qt-designer/) and forced to write myself using QTreeWidget. Created sample widget and plugin for Qt Designer, put it on GitHub if somebody else need this and want to improve: https://github.com/akontsevich/WidgetBox. It is ready for using however some points good to have improved:



Style category button (or panel) closer to Qt Creator (Designer) look or like to LibreOffice Writer Properties Tool Box (https://github.com/akontsevich/WidgetBox/blob/master/Screenshots/LibreOffice%20Writer%20Properties.png?raw=true) on the right side

Improve pages behaviour in Qt Designer similar to QToolBox: now Designer does not change currentPageIndex PROPERTY and focus on page or category click for some reason

Improve pages geometry resizing to content and their layout on design time and on run-time: QTreeWidget automatically increases itemWidget size height (in runtime, not design time - it remains terrible there) if contents is bigger than widget (page) height, however if page size (sizeHint) is bigger than contents - it does not decrease size to necessary minimum.


Hope for community help or suggestions on these improvements.

Sample screenshots of current state:

http://i.stack.imgur.com/WXXbS.png http://i.stack.imgur.com/7S6dp.png