1 Attachment(s)
How can I re-size the QGraphicViewItem using mouse
How can I change the QGraphicView Item size using mouse.this code generate the 2 rectangles,how can I change the sizes of those rectangles using mouse.
This image shows my expected result.
Attachment 12639
Code:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->graphicsView->setScene(scene);
scene->setSceneRect(0,0,400,400);
// Create the first red rectangle on the graphic scene
rect1->setRect(10,50,100,50);
rect1
->setBrush
(QBrush(Qt
::red));
scene->addItem(rect1);
// And create a second blue rectangle on the graphic scene
rect2->setRect(150,100,115,75);
rect2
->setBrush
(QBrush(Qt
::blue));
scene->addItem(rect2);
}