c++ - Weird control boundaries detection on QGraphicsProxyWidget -


hello in application i'm making qgraphicsview , set scene on it:

qgraphicsproxywidget *rotateitemicon;  hoverfilter *hv = new hoverfilter();  // hover filter class  connect(hv,signal(signalhover(qobject*)),this,slot(objecthover(qobject*))); connect(hv,signal(signalhoverleave(qobject*)),this,slot(objecthoverleave(qobject*))); ui->testicon->installeventfilter(hv); ... scene = new qgraphicsscene(this); scene->setscenerect(0, 0, 661, 255);  ui->testicon->setparent(null);   rotateitemicon = scene->addwidget(ui->testicon);  // here add control scene , receive qgraphicsproxywidget object rotateitemicon->settransformoriginpoint(ui->testicon->width()/2,                                              ui->testicon->height()/2);    ui->graphicsviewfive->setscene(scene);  //qgraphicsview on form  ui->graphicsviewfive->show(); 

my hoverfilter.cpp

#include "hoverfilter.h" #include "qdebug" hoverfilter::hoverfilter() { } bool hoverfilter::eventfilter( qobject *dist, qevent *event ) {   if( event->type() == qevent::enter )  {       emit signalhover(dist);       return true;  }   if( event->type() == qevent::leave )  {       emit signalhoverleave(dist);       return true;  }    return false; } 

rotateitemicon qgraphicsproxywidget , problem has weird boundaries, need implement animation on hover of control testicon, (i done using event filter) mouse enter , mouse leave fires when drag mouse on random places, not on testicon control. if not add control qgraphicsscene hover detection works fine, assume scene/proxywidget problem. there way can set size or boundaries qgraphicsproxywidget stop that?

i'm not sure if understand question, sounds you're have widget placed in scene via qgraphicsproxywidget , when try detect if mouse on widget want animate.

by 'weird boundaries' assume mean extents proxy widget accepting mouse being on widget. if so, suggest either calling setgeometry on qgraphicsproxywidget set position , dimensions, or inherit qgraphicsproxywidget , implement boundingrect function define area of proxy widget.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -