creating custom widget

Tomaz Canabrava tcanabrava at kde.org
Mon Jul 9 19:19:52 UTC 2012


On Mon, Jul 9, 2012 at 2:42 PM, Heena Mahur <hena18 at rocketmail.com> wrote:
> Hey,
>
>
> I want to know how to create custom widget to change the attribute of xml
> node in qt ?
> for eg-
>
> when you click on one node let's take
> <image>
> sorry <element>
> and let's say this is the line in the XML file
> <element><image src='ktuberling.svg' lang='any' /><pfound src='test.ogg'
> lang='any' /><word lang='any'>KTuberling</word></element>
> then I want on the widget area something like
> type image
> file ktuberling.svg (with the possibility to load from a file
> attribute lang any
> and so on
> and this changes depending on which element you click
> Please elaborate in detail I am a beginner.
> Thanks
>
> _______________________________________________
> kde-edu mailing list
> kde-edu at mail.kde.org
> https://mail.kde.org/mailman/listinfo/kde-edu
>
Heena,

I didn't quite understood what you whant, but it looks like an use of
the Model/View framework.:

you need to implement a new class, that extends from
QAbstractTableModel, and populate the xml stuff on it, on the data()
method.
But you say that you are a beginner, how beginner are you in Qt and
C++? because if you are just starting, the Qt Model/View framework is
not the best place to start.

If Model/View framework is too complicated, you can create an new
QWidget by aggregating QLabels/QLineEdits.

Tomaz


More information about the kde-edu mailing list