#include <QApplication>
#include <QGraphicsRectItem>
#include <QGraphicsTextItem>
#include <QGraphicsScene>
#include <QGraphicsView>
int main(int argc, char *argv[])
{
rect->acceptHoverEvents();
text->setTextInteractionFlags( Qt::TextEditorInteraction );
view.setScene( &scene );
view.show();
return a.exec();
}
#include <QApplication>
#include <QGraphicsRectItem>
#include <QGraphicsTextItem>
#include <QGraphicsScene>
#include <QGraphicsView>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QGraphicsScene scene;
QGraphicsRectItem* rect = new QGraphicsRectItem(QRectF(25,25,120,80),0,&scene);
rect->setFlag(QGraphicsItem::ItemIsMovable, true);
rect->setFlag(QGraphicsItem::ItemIsSelectable, true);
rect->acceptHoverEvents();
QGraphicsTextItem* text = new QGraphicsTextItem("ABCDEFGHIJKLMNOP",rect,&scene);
text->setTextInteractionFlags( Qt::TextEditorInteraction );
QGraphicsView view;
view.setScene( &scene );
view.setDragMode( QGraphicsView::RubberBandDrag );
view.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks