Event providing to QWidget(QWT) embedded into QML Qt4



  • Hi, I've used QwtPlot (Qwt 6.0.1) in QML project (Qt 4.8) . i'm wrap it via QDeclarativeItem

    @ GraphWidgetQML::GraphWidgetQML(QDeclarativeItem *parent):QDeclarativeItem(parent)
    {
    _GraphArea = new GraphWidget; //child of QwtPlot without event handlers overrides
    QGraphicsProxyWidget *_wiget = new QGraphicsProxyWidget(this);
    _wiget->setWidget(_GraphArea);
    _wiget->setFlag(QGraphicsItem::ItemIsFocusable,true);
    this->setClip(true);
    }@

    and insert into into QML via code

    @ qmlRegisterType<GraphWidgetQML> ("GraphWidget",1,0,"GraphWidget"); //registration type@

    and QML

    @ GraphWidget {
    id: drawer

            objectName: "drawer"
    
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            anchors.left: parent.left
            anchors.right: parent.right
            //
            anchors.topMargin: 5
            anchors.bottomMargin: 5
            anchors.leftMargin: 5
            anchors.rightMargin: 5
        }@
    

    But, Mouse evets won't work correctly. For example when i want to draw a zooming rectangle, when i released the mouse button it won't zoom untill press enter key. Right button doesn't work at all.

    How to make proper event providing?


Log in to reply
 

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