PDA

View Full Version : Error: No match for call to '(QPoint)()'



GT Development
10th October 2011, 13:38
Hi ,

I am trying with the example given in Wiki Moving Widget.. i am getting an error as

Error: No match for call to '(QPoint)()'

wysota
10th October 2011, 13:41
Show us the offending code (your code).

GT Development
11th October 2011, 05:43
Please find the code below


void testtab::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
//QMouseEvent *e=static_cast<QMouseEvent *>(event);
startPos = event->pos();
if(isWindow())
{
p = event->globalPos() - startPos();
msgBox.setText("is window");
msgBox.exec();
}
else
{
p = event->pos();
msgBox.setText("not window");
msgBox.exec();
}
}
}

ChrisW67
11th October 2011, 06:16
It is usually helpful to tell us which line is causing grief. We can guess but it is helpful not to have to.

Where is startPos declared? What type is it? Can you call it as a function like you do in this line.. ?


p = event->globalPos() - startPos();

GT Development
11th October 2011, 08:12
oh sorry...



void testtab::mousePressEvent(QMouseEvent *event)
{
if(event->button() == Qt::LeftButton)
{
//QMouseEvent *e=static_cast<QMouseEvent *>(event);
startPos = event->pos();
if(isWindow())
{
p = event->globalPos() - startPos(); //<-Error : No match for call to '(QPoint)()'
msgBox.setText("is window");
msgBox.exec();
}
else
{
p = event->pos(); //<- Error : No match for call to '(QPoint)()'
msgBox.setText("not window");
msgBox.exec();
}
}
}

wysota
11th October 2011, 08:24
Why don't you compare your code to the one from the Moving widgets article? Differences are kind of obvious.