Nominate our 2022 Qt Champions!

[Solved] Size of QGraphicview

  • Hello,

    I try to get the size of my QGraphicview and I used

    @int sizeX,sizeY;

    sizeX = ui->gvResultGraph->size().width;
    sizeY = ui->gvResultGraph->size().height;@

    But I got an error message like that
    @error C3867: 'QSize::width': function call missing argument list; use '&QSize::width' to create a pointer to member
    error C2440: '=' : cannot convert from 'int (__thiscall QSize::* )(void) const' to 'int'@

    I don't really know what it means.. Would anyone have an idea about what is wrong with the synthax?

  • Change code like this:
    @int sizeX,sizeY;
    sizeX = ui->gvResultGraph->size().width();
    sizeY = ui->gvResultGraph->size().height();@

  • oh yeah I thought they were parameters of size(), not functions. Thank you very much!

  • Intellisense of IDE could be very informative and saves a lot of your time by helping to avoid this kind of mistakes.

Log in to reply