PDA

View Full Version : How to create a custom dock widget like QtDesigner



ad5xj
24th May 2015, 19:18
I would like to create a custom dock widget for my QMainWindow that looks and works very similar to the properties dock widget in QDesigner.

I have custom widgets that have properties I wish to allow the user to interact with through this custom dock widget. This will happen outside the QtDesigner - in my application - so I don't think the QDesignerExtensionxxx stuff will apply.

I am able to insert a list widget into a QDesigner dock widget and manipulate the background colors and other properties to look like I want -- but it does not work the same (layout changes do not follow the window resize, etc.)

Is it possible to simulate the properties dock widget in any other way that I is not completely obvious to me now?

wysota
25th May 2015, 07:05
What you want is called a property browser and it should be available for download somewhere on Qt's git repo.

d_stranz
25th May 2015, 15:19
The QtPropertyBrowser tool is here. (http://qt.gitorious.org/qt-solutions/qt-solutions/trees/master/qtpropertybrowser) But I can tell you that it is incredibly hard to use if you want any kind of custom properties. It's hard to use even for editing simple things.

Get it now, because gitorious.org is going away and if no one claims responsibility for this code, it might disappear.

ad5xj
25th May 2015, 18:08
The code for the qtpropertybrowser and support modules is now in Qt5. I found this out in a thread on another forum.

It is laid out like a static lib. I tried to convert to a shared lib. It compiles and links without error -- however, when the lib is included in the application, I get 8 errors from the linker -- all relating to QtAbstractPropertyBrowserPrivate - invalid use of incomplete type class from the moc_qtpropertybrowser.cpp source.

A look at the code indicates this is a forward declaration in the form:

class QtAbstractPropertyBrowserPrivate;
and not intended to have a defined type in the forward declare.

That being the case, the error messages do not make a lot of sense. Any idea what this may be trying to indicate?

Env: Qt 5.4.1 on Linux Mint 17.1