c++ - Cannot modify height value from QRect -
the follow snippet results in compilation yielding "error: passing 'const qrect' 'this' argument of 'void qrect::setheight(int)' discards qualifiers [-fpermissive]".
how can fix , i've noticed if replace h -= 80; h--;, compiler not complain.
int h = this->geometry().height(); h -= 80; ui->datumtable->geometry().setheight(h);
geometry() returns const reference qrect object inside qtablewidget.
it's meant read-only getter. should take copy, modify , set setgeometry setter function:
qrect rect = this->geometry(); int h = rect.height(); rect.setheight(h - 80); ui->datumtable->setgeometry(rect);
Comments
Post a Comment