Results 1 to 20 of 30

Thread: Custom Property On Custom Widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    ya and i want to give the custom(compound ) property to my custom widget . I have read somewhere that this could be possible only from QdesignerPropertySheet extension but i am not able to do this .

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom Property On Custom Widget

    The QDesignerPropertySheetExtension class allows you to manipulate a widget's properties which is displayed in Qt Designer's property editor. You should be proving the properties information in your QDesignerCustomWidgetInterface

  3. #3
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    Hi
    Thanks For reply. I can manipulate widget property through QDesignerPropertySheetExtension But where i have to provide my property in QDesignerCustomWidgetInterface . Can u plz elaborate what u r saying

  4. #4
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom Property On Custom Widget

    Did you read this example ?

  5. #5
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    Hi
    I have just read the example .I think The only place where i can provide the compound Property is domxml function .But my Compound Property is not coming on the widget property editor so what i am missing .

    I am giving u some design what i am doing
    I have created a CustomProp Class Its Plugin CustomPropPlugin
    Exteansion Class Subclassed from QDesignerPropertySheetExtension and the factory class derived from QExtensionFactory Ok
    Now In the initialize function of plugin i am getting the extension class of Qt designer and throught that i register the manager class
    I have also implemented just the method of QDesginerPropertyExtension in my Extension Class
    So am i missing something or doing something wrong

  6. #6
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom Property On Custom Widget

    How does your domXml() look?

  7. #7
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    return "<widget class=\"CustomWidgetPropertyShow\" name=\"customWidgetPropertyShow\">\n"
    " <property name=\"geometry\">\n"
    " <rect>\n"
    " <x>0</x>\n"
    " <y>0</y>\n"
    " <width>100</width>\n"
    " <height>100</height>\n"
    " </rect>\n"
    " </property>\n"
    "</widget>\n";

    Also if add something it will come as dynamic property .I have just checked with adding something but it gives the flavour of dynamic Property which i don't want .I wnat the custom struct to appear as static Property

  8. #8
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom Property On Custom Widget

    May be I asked a wrong question, we should be looking at Extension class, did you properly implement these
    Qt Code:
    1. virtual QVariant property ( int index ) const = 0
    2. virtual QString propertyGroup ( int index ) const = 0
    3. virtual QString propertyName ( int index ) const = 0
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    Hi
    I have not found very clear explanation of implementation of these function in the documenatation .so can provide me some stuff on this

  10. #10
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 453 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Custom Property On Custom Widget

    Most of the functions should be clear enough, provided you understand how Qt Designer works. What did you implement in the virtual functions of Extension class?

    All these virtual functions should be implemented properly for the widget custom properties to be displayed in Qt Designer.

    for example if your widget has 2 QString properties "PRO1", "PRO2" then implementation would like this,

    Qt Code:
    1. int count() const { return 2; }
    2.  
    3. QVariant property(int index) const
    4. {
    5. if(index == 0) return pro1;
    6. else if(index == 1) return pro2;
    7. else return QVariant;
    8. }
    9.  
    10. QString propertyName(int index) const
    11. {
    12. if(index == 0) return QString("PRO1");
    13. else if(index == 1) return QString("PRO2");
    14. else return QString;
    15. }
    To copy to clipboard, switch view to plain text mode 

    note you need to implement all the functions properly..
    Last edited by Santosh Reddy; 27th June 2011 at 12:04.

  11. #11
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    Hi
    very very Thanks. I think that now i can implement the Custom (Compound Property ) On the Widget .

  12. #12
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Custom Property On Custom Widget

    Hi,
    If I implement my own property sheet extension so in this case i will miss the default property editor given by the widget or the qt designer . But i want to use the both property editor the one provided by the QT designer and other which is written by me So is there any way

Similar Threads

  1. Custom property in designer
    By avgust in forum Newbie
    Replies: 1
    Last Post: 9th September 2010, 10:14
  2. File dialog for custom widget property?
    By TheJim01 in forum Newbie
    Replies: 1
    Last Post: 6th May 2010, 10:14
  3. Animatin a custom property
    By Luc4 in forum Qt Programming
    Replies: 2
    Last Post: 13th April 2010, 08:37
  4. Replies: 4
    Last Post: 5th March 2010, 14:20
  5. Replies: 5
    Last Post: 16th May 2006, 20:38

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.