[Qt-interest] ui form inheritance

phil prentice philp.cheer at talktalk.net
Tue Jan 27 20:23:59 CET 2009


Hi

  I am using QT4.2.1.  I generally use QT Designer to do all of the work in 
laying out my Gui.  I then use those objects to fill in the items and 
interact with the user.  It works well.  However I have a problem.  I have a 
QTreeWidget object in my ui form.  The user can drag and drop items using the 
default settings within the form.  Unfortunately I need to be more 
restrictive in what the user can do compared to the default options of 
QTreeWidget.  i.e. I need to modify the behavior of the functions like 
QTreeWidget:dropMimeData() etc.  This means that I need to create my own 
class that inherits QTreeWidget. 

  Is there any simple way that I can continue to use designer to create my 
QTreeWidget object and yet somehow tell my code to treat the object using my 
new parent class?  I could probably modify my ui .h file to refer to 
myQTreeWidget instead of QTreeWidget, but this is not nice because I would 
have to do this change everytime I modify the form.

I hope the above makes sense.

Any help would be welcome

Thanks



More information about the Qt-interest-old mailing list