Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, January 2008
Designer like Properties panel


Message 1 in thread

Hi everybody,

I would like to do something similar to the widget properties panel in Qt
Designer. I want a panel with two columns (property/value) and rows displaying
editable object properties. The nature and number of properties depend on the
object being highlighted in the main center widget. Some properties are strings
editable by the user, other are checkable, other are choosable via a combobox,
etc...

I began doing this with a QTableView and a subclass of QAbstractTableView, but
this is quite complicated to implement the various editor widgets for each
property each time an object is selected, as this requires to call
setItemDelegateForRow for each row of the QTableView, I feel this is not in the
model/view spirit. The view object should decide itself the editor to use, by
asking the row data type to the model, for instance in a third hidden column.
However, this needs to reimplement the view from scratch starting from
QAbstractItemView, which is a big work for something that should be quite
simple.

Maybe am I totally wrong, what is the clever approach to implement that kind of
properties pane?


Thanks,

Etienne




--
 [ signature omitted ] 

Message 2 in thread

On 19.01.08 19:20:00, etienne.sandre@xxxxxxxxxxxxxxxxx wrote:
> I began doing this with a QTableView and a subclass of QAbstractTableView, but
> this is quite complicated to implement the various editor widgets for each
> property each time an object is selected, as this requires to call
> setItemDelegateForRow for each row of the QTableView, I feel this is not in the
> model/view spirit. The view object should decide itself the editor to use, by
> asking the row data type to the model,

No, creating the editor is the job of the delegate and it doesn't need a
new hidden row for that, just a custom data role that you use in your
model class and item delegate subclass. See QItemDelegate api docs for
more information.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

On Saturday 19 January 2008 19:20:00 etienne.sandre@xxxxxxxxxxxxxxxxx wrote:
If you use a QWidgetTable you can use setWidget on a cell.
This can be a QLineEdit, QButton, QCheckbox, whatever you like.
Works for me.

Happy coding,
Eric
> Hi everybody,
>
> I would like to do something similar to the widget properties panel in Qt
> Designer. I want a panel with two columns (property/value) and rows
> displaying editable object properties. The nature and number of properties
> depend on the object being highlighted in the main center widget. Some
> properties are strings editable by the user, other are checkable, other are
> choosable via a combobox, etc...
>
> I began doing this with a QTableView and a subclass of QAbstractTableView,
> but this is quite complicated to implement the various editor widgets for
> each property each time an object is selected, as this requires to call
> setItemDelegateForRow for each row of the QTableView, I feel this is not in
> the model/view spirit. The view object should decide itself the editor to
> use, by asking the row data type to the model, for instance in a third
> hidden column. However, this needs to reimplement the view from scratch
> starting from QAbstractItemView, which is a big work for something that
> should be quite simple.
>
> Maybe am I totally wrong, what is the clever approach to implement that
> kind of properties pane?
>
>
> Thanks,
>
> Etienne
>
>
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/


--
 [ signature omitted ] 

Message 4 in thread

What you want is the Property Browser in Qt solutions:
http://trolltech.com/products/qt/addon/solutions/catalog/4/Widgets/qtpropertybrowser/
If you're using a commercial license, I believe that you should have access.
If you're using the open source license, you can ask Trolltech if they will
release it as open source. I've noticed that many features that start out as
Qt Solutions trickle down into Qt (including the GPL Qt) in a later release.
As a side note, I've used this solution, and it is very handy and
automatically handles many of the Qt types, including enumerated types.

Tom

On Jan 19, 2008 1:20 PM, <etienne.sandre@xxxxxxxxxxxxxxxxx> wrote:

> Hi everybody,
>
> I would like to do something similar to the widget properties panel in Qt
> Designer. I want a panel with two columns (property/value) and rows
> displaying
> editable object properties. The nature and number of properties depend on
> the
> object being highlighted in the main center widget. Some properties are
> strings
> editable by the user, other are checkable, other are choosable via a
> combobox,
> etc...
>
> I began doing this with a QTableView and a subclass of QAbstractTableView,
> but
> this is quite complicated to implement the various editor widgets for each
> property each time an object is selected, as this requires to call
> setItemDelegateForRow for each row of the QTableView, I feel this is not
> in the
> model/view spirit. The view object should decide itself the editor to use,
> by
> asking the row data type to the model, for instance in a third hidden
> column.
> However, this needs to reimplement the view from scratch starting from
> QAbstractItemView, which is a big work for something that should be quite
> simple.
>
> Maybe am I totally wrong, what is the clever approach to implement that
> kind of
> properties pane?
>
>
> Thanks,
>
> Etienne
>
>
>
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>