QGraphicsProxyWidget can't be moved



  • Hello, I'm wondering if you could help me out understand why a QGraphicsProxyWidget can't be selected/moved into my scene (see code below):

    @
    QGroupBox *groupBox = new QGroupBox("Contact Details");
    QLabel *numberLabel = new QLabel("Telephone number");
    QLineEdit *numberEdit = new QLineEdit;
    QFormLayout *layout = new QFormLayout;
    layout->addRow(numberLabel, numberEdit);
    groupBox->setLayout(layout);
    QGraphicsProxyWidget *proxy = scene->addWidget(groupBox);
    proxy->setFlag(QGraphicsItem::ItemIsMovable);
    proxy->setFlag(QGraphicsItem::ItemIsSelectable);
    @

    while I can successfully select and move around a paintable object:

    @
    QGraphicsPathItem *myItem = new QGraphicsPathItem(0, scene);
    QPainterPath p;
    p.addRoundedRect(-50, -15, 100, 30, 5, 5);
    myItem->setPath(p);
    myItem->setPen(QPen(Qt::darkGreen));
    myItem->setBrush(Qt::green);
    myItem->setFlag(QGraphicsItem::ItemIsMovable);
    myItem->setFlag(QGraphicsItem::ItemIsSelectable);
    @

    Thanks



  • Hi Papillon,

    I think this post is helpfull

    http://www.qtcentre.org/threads/28434-Move-QGraphicsProxyWidget



  • Thanks. So if I understand it correctly, I need to subclass QGraphicsProxyWidget and override mouse events.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.