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. Problem with the Focus of the Widget in Touch screen
Forum Updated to NodeBB v4.3 + New Features

Problem with the Focus of the Widget in Touch screen

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.5k 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.
  • M Offline
    M Offline
    Macro
    wrote on 20 Sept 2014, 11:33 last edited by
    #1

    Hi..

    I have a QWidget which contains some Line Edits. I have to pop up a new Numpad widget when the Line edit get the the focus. When i click on the Numpad widget, the focus has to be remained in the Line edit widget. So i tried using

    @bool NumPadWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
    {
    #ifdef Q_OS_WIN
    if(eventType == "windows_generic_MSG")
    {
    const MSG *msg = reinterpret_cast<MSG *>(message);
    if(msg->message == WM_MOUSEACTIVATE)
    {
    *result = MA_NOACTIVATE;
    return true;
    }
    }
    #endif
    return false;
    }@

    This is working fine for Mouse clicks of the numpad widget, but i am using a Touch screen. when i touch the Numpad widget, there is a flickering ( title bar flashing effect) on the LineEdit widget. So can anyone please tell me which Macro i have to use to block the focus of the widget on the touch screen.

    I tried using WM_Touch macro which results in no proper output. Please help...

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Macro
      wrote on 22 Sept 2014, 14:33 last edited by
      #2

      When I try this below code, it solves the issue, But now it is not working for the Mouse Clicks. But, I want the widget to handle both the Touch and the Mouse Clicks. So Can anyone please tell me the macro which is used to handle both the touch and the Mouse clicks.

      @bool NumPadWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
      {
      #ifdef Q_OS_WIN
      if(eventType == "windows_generic_MSG")
      {
      const MSG *msg = reinterpret_cast<MSG *>(message);
      if(msg->message == WM_MOUSEACTIVATE)
      {
      *result = MA_NOACTIVATEANDEAT;;
      return true;
      }
      }
      #endif
      return false;
      }@

      From the Documentation,

      MA_ACTIVATE Activates the window, and does not discard the mouse message.
      MA_ACTIVATEANDEAT Activates the window, and discards the mouse message.
      MA_NOACTIVATE Does not activate the window, and does not discard the mouse message.
      MA_NOACTIVATEANDEAT Does not activate the window, but discards the mouse message.

      When i tried using MA_NOACTIVATE, the focus problem (LineEdit Widget TitleBar shows that the widget is curently inactive) exists.

      1 Reply Last reply
      0

      1/2

      20 Sept 2014, 11:33

      • Login

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