c++ - QT QIcon properties for custom widget in designer -


i have been working little while on creating qt custom designer widget gui menus. idea being drag designer, select number of frames you'd like, how many buttons per frame, etc. , generates , sizes you.

the way widget structured there properties configure each button frame in. example, use button0text field enter text under button0 while editing in frame 0, use again edit button0 in frame 1. both buttons retain individual changes each frame.

enter image description here

the problem

normally when switch frames of properties updated reflect status of frame. exception being qicon. correct icon retained in actual graphical representation , builds correctly, file path in property list of last edited property. think extremely confusing end user , have found no way fix it. example, if set text , icons in frame 0 switch frame 1 text in property list update reflect state of frame 1 icon path names still show last edit in frame 0 , not actual icon in frame 1.

i have tried things simple as:

setproperty("button0icon", getbutton0icon()); 

that code works on properties text, not icon. try executing after changing frames.

i have tried:

#ifndef q_ws_qws qdesignerformwindowinterface *form = qdesignerformwindowinterface::findformwindow(this); if(form){     qdesignerformeditorinterface *editor = form->core();     qextensionmanager *manager = editor->extensionmanager();     qdesignerpropertysheetextension *sheet;     sheet = qt_extension<qdesignerpropertysheetextension*>(manager, this);     int propertyindex = sheet->indexof("button0icon");     sheet->setchanged(propertyindex, true);     sheet->setproperty(propertyindex, getbutton0icon()); } #endif 

and:

int propertyindex = this->metaobject()->indexofproperty("button0icon"); qmetaproperty property = this->metaobject()->property(propertyindex); property.write(this, qicon()); 

nothing seems update property list in designer.

i have properties, including qicon properties declared in header file q_property , assigned getter , setter functions.

to clear, icon values indeed retained through each frame when compiled. functioning, unclear users.

if has experience or ideas please let me know. thanks.

i have discovered qicon not store file names/paths. file names used creation of qicon. think reason not feedback in property browser qicon properties.

instead have chosen hide property in designer , add 3 new ones. 3 qurl properties, each of used supply image file. use 3 because want construct qicon contains modes/states normal, disabled, , pressed operations.

i take each of these qurls , save them in qstringlists behind scenes values stored. construct qicon using file names provided qurls.

i prefer using native qicon in designer this, thoughts or feedback appreciated.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -