How To Make A QGraphics Item Double clickable? (total newbie)
-
#include "dialog.h"
#include "ui_dialog.h"
#include <QGraphicsRectItem>Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);scene = new QGraphicsScene;
ui->graphicsView->setScene(scene);
QBrush blueBrush(Qt::blue);
QPen blackPen(Qt::black);
blackPen.setWidth(6);
rectangle = scene->addRect(-100, -100, 50, 50, blackPen, blueBrush );
rectangle->setFlag(QGraphicsRectItem::ItemIsMovable);
// I'd like to connect a double click on my rectangle to a function, but don't have a CLUE how!
//// some connect function here: doubleclick on rectangle calls open_modal
}
void Dialog::open_modal()
{//do stuff
}