[SOLVED] customize QtableWidget with Qdesigner



  • Hi every body

    i want to start creating my own widget , but i don't know where i start

    i customise QtableWidget and integrate it in Qt designer

    plz guide me



  • Aloha,

    Well there are basically two ways you can do it.

    1. Write a class which extends the QTableWidget with all your customizations. And then just add the QTableWidget in your designer and promote it to your custom class. You can do it by right clicking the widget and clicking Promote to and entering the name of your class.

    2. Is slightly more complicated, but if you had done quick Google search you would find "this example":http://qt-project.org/doc/qt-4.8/designer-creating-custom-widgets.html
      With the second approach you're actually making a plugin for the designer.

    I've written a plugin only once, most of the times, promoting widgets to my class is good enough.

    Happy Coding.



  • "Write a class which extends the QTableWidget with all your customizations. And then just add the QTableWidget in your designer"

    You mean that, i need to extends QtableWidget using Qtcreator

    then i will add the .cpp and .h in Qt designer ??



  • Ok i have figured out what you mean

    go to Qtcreator " Edit code area"

    1- create Extends class form desired widget

    2- make your custimisation on .cpp

    go to "Design aread -- Qt designer "

    right click on desired widget and hit promote then chose the header file of your custom widget



  • thank's xcoder

    good day :)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.