[SOLVED] Error with setRect in QRect
I have a QRect and when I try to setRect it return this error
/QT/Projetos/VisaoFinanceira/fluxocaixawidget.cpp:174: error: member function 'setRect' not viable: 'this' argument has type 'const QRect', but function is not marked const
Here is the code:
look at the definition of the at method:
const T & at(int i) const
QList returns a const reference to your QRect, hence you're not allowed to alter it.
You have to do something like this:
@ QList<QRect> fluxoRect;
fluxoRect.append(QRect(0,0,0,0)); QRect r = fluxoRect.takeAt(i); r.setRect(7, 7, 7, 7); fluxoRect.replace(i, r);@
at is a constant function so you can't modify it's returned value like that.
Either use the value method or the  operator.
You can also take the rect modify it and replace the original value with the new value.
Hope it helps
Thank you for the replies Saugglocke and SGaist