Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Ignoring KDE shortcuts and and pointer related actions in own application.
Forum Updated to NodeBB v4.3 + New Features

Ignoring KDE shortcuts and and pointer related actions in own application.

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.4k 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.
  • V Offline
    V Offline
    vasiliyis
    wrote on last edited by
    #1

    Holding of the <Alt> key + dragging of the left mouse button causes moving of the window under cursor in KDE by default.
    I wish to do some action in own application when this event is occurred, but not window movement.
    Is there is a recipe for doing it without changing KDE settings?

    1 Reply Last reply
    0
    • I Offline
      I Offline
      ivan
      wrote on last edited by
      #2

      It is not only KDE, it is a default behaviour of X-based window managers (at least it was, don't know whether the current ones still do the same). I don't think you can change it from your application, but as far as KWin is concerned, you can create a special application rule that targets only your application and disables this behaviour.

      When I come to think of it, you might (possibly) make your application to create such a rule manually and push it to kwin.

      Ivan Čukić | ivan.cukic(at)kde.org | KDE e.V.
      Qt Ambassador (from the old Nokia days)

      1 Reply Last reply
      0
      • V Offline
        V Offline
        vasiliyis
        wrote on last edited by
        #3

        Only one widget in my application requires specific actions on dragging by the left mouse button depended on keyboard modifiers state to do some operations on graphics objects. I have decided to enable mouse tracking for this widget and to call the grabMouse() function in reimplemented focusInEvent() and enterEvent() functions. To restore the default processing of mouse events I call the releaseMouse() function in reimplemented focusOutEvent() and leaveEvent() functions.

        If there are situations when some dialogs can be appeared then the following event filter

        @
        bool GraphWidget::eventFilter(QObject *watched, QEvent *event)
        {
        if (watched != this && event->type() == QEvent::FocusIn)
        {
        QApplication::instance()->removeEventFilter(this);
        releaseMouse();
        }
        return false;
        }
        @

        can help to catch situations when the releaseMouse() function must be called.
        This event filter should be installed anywhere where the grabMouse() function is called:

        @
        ...
        grabMouse();
        QApplication::instance()->installEventFilter(this);
        ...
        @

        May be there more preferred methods to prevent executing actions reserved by KDE or by other window management system and to execute custom action for own application on occurring specified events.

        I will glad if anybody propose other methods to do it.

        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