How to replace QwtLegend::legendItems()
-
Hey,
i'm on updating from qwt5 to qwt6 and i have a line like:QList<QWidget *> items = plot->legend()->legendItems();which is giving me the error message "there is not legendItems() ind QwtAbstractLegend" so i found QwtLegend and changed the line to
QList<QWidget *> items = qobject_cast<QwtLegend*>(plot->legend())->legendWidgets();but legendWidgets wants a QVariant parameter, what should i do from here and am i right with the legendWidgets() method call ?
-
Hey,
i'm on updating from qwt5 to qwt6 and i have a line like:QList<QWidget *> items = plot->legend()->legendItems();which is giving me the error message "there is not legendItems() ind QwtAbstractLegend" so i found QwtLegend and changed the line to
QList<QWidget *> items = qobject_cast<QwtLegend*>(plot->legend())->legendWidgets();but legendWidgets wants a QVariant parameter, what should i do from here and am i right with the legendWidgets() method call ?
@rock37 the hole function looks like:
// XYZ inherits QwtPlot XYZ * plot = my_plots.constData().at(i); if ( plot->legend() ) { QList<QWidget *> items = qobject_cast<QwtLegend*>(plot->legend())->legendWidgets(?????); for ( int i = 0; i < items.count(); i++ ) { QwtLegendItem * legend = qobject_cast<QwtLegendItem *>(items [i]); QwtText text = legend->text(); QwtText newText(text); newText.setPaintAttribute(QwtText::PaintUsingTextFont, false); legend->setText(newText); } } plot_renderer.render( plot, &painter, QRect(plot->x(), plot->y(), plot->width(), plot->height()) ); -
@rock37 the hole function looks like:
// XYZ inherits QwtPlot XYZ * plot = my_plots.constData().at(i); if ( plot->legend() ) { QList<QWidget *> items = qobject_cast<QwtLegend*>(plot->legend())->legendWidgets(?????); for ( int i = 0; i < items.count(); i++ ) { QwtLegendItem * legend = qobject_cast<QwtLegendItem *>(items [i]); QwtText text = legend->text(); QwtText newText(text); newText.setPaintAttribute(QwtText::PaintUsingTextFont, false); legend->setText(newText); } } plot_renderer.render( plot, &painter, QRect(plot->x(), plot->y(), plot->width(), plot->height()) );@rock37
This post relates to Qwt, which is based on Qt, but it is not Qt. The Qwt mailing list is the right point of contact, I think. -
@rock37
This post relates to Qwt, which is based on Qt, but it is not Qt. The Qwt mailing list is the right point of contact, I think.@Axel-Spoerl i have subscriped to the mailing list but i can't find a way to create a new thread.
-
@Axel-Spoerl i have subscriped to the mailing list but i can't find a way to create a new thread.
-
A Axel Spoerl has marked this topic as solved on