1
0
Fork 0

Graph : Using mouse wheel will scroll by default and if ctrl is pressed while using mouse wheel, it'll zoom

Free the tree and graph related stuff
This commit is contained in:
Herzeh 2015-12-18 23:29:53 +01:00
parent 8bd7bdcf6a
commit b828ed9fa9
2 changed files with 16 additions and 5 deletions

View File

@ -219,11 +219,6 @@ void GraphView::addGraphToScene()
// mScene->setSceneRect(0, 0, mGA->boundingBox().width(), mGA->boundingBox().height());
QTextStream out(stdout);
out << "*-----------------------------------*"<< endl;
out << mScene->sceneRect().x() << endl;
out << mScene->sceneRect().y() << endl;
out << mScene->sceneRect().width() << endl;
out << mScene->sceneRect().height() << endl;
ui->graphicsView->ensureVisible(mScene->itemsBoundingRect());
ui->graphicsView->setSceneRect(mScene->sceneRect());
@ -338,6 +333,19 @@ void GraphView::addAllNodes(BASICBLOCKMAP::iterator it, Node<GraphNode *> *paren
GraphView::~GraphView()
{
mScene->clear();
if(mOHL)
delete mOHL;
if(mSL)
delete mSL;
if(mTree)
mTree->clear();
if(mG)
delete mG;
if(mGA)
delete mGA;
delete ui;
}

View File

@ -11,7 +11,10 @@ QGraphView::QGraphView(QWidget* parent)
void QGraphView::wheelEvent(QWheelEvent* event)
{
if(!(event->modifiers() & Qt::ControlModifier))
{
QGraphicsView::wheelEvent(event);
return;
}
int numDegrees = event->delta() / 8;
int numSteps = numDegrees / 15; // see QWheelEvent documentation