Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Event providing to QWidget(QWT) embedded into QML Qt4
Qt 6.11 is out! See what's new in the release blog

Event providing to QWidget(QWT) embedded into QML Qt4

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved