Ok nevermind that's embaressing, the segmentation fault is because the if statements are falling through.
So both the if(event->mouseButtons() & LeftButton)
and if(event->mouseButtons() & RightButton)
are failling....
if(event->mouseButtons() & Qt::LeftButton)
{
std::cout<<"left button\n";
newTree = new TreeNode("||",this->getTree(),labelTree->getTree());
}
else
if(event ->mouseButtons() & Qt::RightButton)
{
std::cout<<"right button\n";
newTree = new TreeNode("&&",this->getTree(),labelTree->getTree());
}
else
{
std::cout<<"ignore\n";
event ->ignore();
return;
}
if(event->mouseButtons() & Qt::LeftButton)
{
std::cout<<"left button\n";
newTree = new TreeNode("||",this->getTree(),labelTree->getTree());
}
else
if(event ->mouseButtons() & Qt::RightButton)
{
std::cout<<"right button\n";
newTree = new TreeNode("&&",this->getTree(),labelTree->getTree());
}
else
{
std::cout<<"ignore\n";
event ->ignore();
return;
}
To copy to clipboard, switch view to plain text mode
I'd forgotten the return statement, to stop it trying to do anything with newTree. Hmmm anyhow the if statements aren't working.
Bookmarks