Set some kind of a property to the item
Hi,
I'm trying to find a way to set some kind of a property for a plotted item where I could keep information about the item.
For example I plot 10 curves. 7 of them should be signed as "good", and the 3 rest should be "bad". So this would allow me to sort these 10 items after getting them from QwtPlot widget like:
Code:
QwtPlotItemList qwtItmList = QwtPlotWidget->itemList();
for(int i = 0; i < qwtItmList.size(); i++){
QString prop
= qwtItmList
[i
].
MyProperty();
if (prop == "good){
...
} else if (prop == "good) {
...
}
}
Re: Set some kind of a property to the item
I will add the Q_GADGET keyword to all plot items. Q_GADGET is available since some early Qt5 version ( need to find out which exactly ) - always wanted to do this.
Does this help ?
Uwe
Re: Set some kind of a property to the item
I didnt work with Q_GADGET yet but as I understood from description this would allow to use such function like setProperty(const char *name, const QVariant &value) and return the QVariant value with property(const char *name) const for plotted items.
I think that would be great