Results 1 to 7 of 7

Thread: How to be notified on dragEnterEvent?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2011
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to be notified on dragEnterEvent?

    hi,
    your post is so useful but i have given up to try

    Qt Code:
    1. onFocusIn:{ //something}
    To copy to clipboard, switch view to plain text mode 

    in QML side. It is the later problem.

    for the moment, i only want my focusInEvent and focusOutEvent in polygon.cpp to be called when i click the polygon shape on QML viewer.

    I succeed to make focusInEvent work by

    Qt Code:
    1. void Polygon::mousePressEvent(QGraphicsSceneMouseEvent *event)
    2. {
    3. forceActiveFocus();
    4. }
    To copy to clipboard, switch view to plain text mode 

    but now the problem have changed. focusOutEvent is not called when i click out of polygon.
    And i could not find a mouseOutEvent.

    If focusOutEvent do not work why it is there?

  2. #2
    Join Date
    Dec 2010
    Location
    Veszprém, Hungary
    Posts
    34
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to be notified on dragEnterEvent?

    Ok, but it's the another direction.

    Read FocusScope documentation in QML doc.
    You can try something like:
    Qt Code:
    1. FocusScope {
    2. id: scope
    3. Polygon {
    4. id: poly
    5. focus = true
    6. }
    7. }
    To copy to clipboard, switch view to plain text mode 

    But as far as I know, focus is for keyboard handling. So why do You mix it with mouse handling?

  3. The following user says thank you to laszlo.gosztola for this useful post:

    tuxit (14th August 2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    22
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to be notified on dragEnterEvent?

    i was able to do what i want when i was working with Qt (without QML) and focusInEvent was working as i expected but in QML does not work. Anyway i will try FocusScope, but now i have another problem. Thanks

Similar Threads

  1. Replies: 11
    Last Post: 25th July 2010, 13:01
  2. Not getting dragEnterEvent - sometimes
    By derekn in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2009, 06:41
  3. Replies: 1
    Last Post: 28th October 2008, 12:14
  4. How to be notified when a child changes?
    By mooreaa in forum Qt Programming
    Replies: 1
    Last Post: 3rd July 2008, 13:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.