Results 1 to 2 of 2

Thread: File dialog for custom widget property?

  1. #1
    Join Date
    Feb 2010
    Location
    Pennsylvania, USA
    Posts
    36
    Thanks
    9
    Thanked 3 Times in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default File dialog for custom widget property?

    I have a standard custom widget/plug-in, fresh out of the "New Project wizard" in Creator. I added some properties from enumerated types, compiled, and moved the plug-in to Designer--works great.

    Now, I want to add an image, and want the user to be able to select the image with designer. Essentially, I want to know how to get a property field like that of the windowIcon property for a QMainWindow. Best-case, it should select either a file or a resource and draw it to the custom widget. But at the very least, I'd like to be able to select a path to the image, even if it doesn't get drawn in designer.

    I tried by configuring a QImage member to have its own Q_PROPERTY entry. That didn't work, and didn't even add the property to the list in Designer. I added "DESIGNABLE true" to force it into Designer, with the same result--the property still isn't in the list. I looked at how to expose the properties through the doXML() function, but from my interpretation, that function is used to set default properties, not define which are visible in which way (correct me if I'm wrong).

    Is the file dialog functionality only available to QIcon, or am I looking at it the wrong way?
    Last edited by TheJim01; 26th April 2010 at 15:44.

  2. #2
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: File dialog for custom widget property?

    Did you also tried QPixmap?
    It's nice to be important but it's more important to be nice.

Similar Threads

  1. Animatin a custom property
    By Luc4 in forum Qt Programming
    Replies: 2
    Last Post: 13th April 2010, 08:37
  2. Replies: 4
    Last Post: 5th March 2010, 14:20
  3. add .ui file with custom widget in application
    By stella1016 in forum Qt Programming
    Replies: 10
    Last Post: 19th November 2009, 09:25
  4. Replies: 5
    Last Post: 16th May 2006, 20:38
  5. custom plugin designer property with out a variable?
    By high_flyer in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2006, 19:11

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.