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. How to set the focus fixed for a particular Widget

How to set the focus fixed for a particular Widget

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

    I have a QWidget (Widget_X). In Widget_X am using few QLineEdits in it. Whenever i press on the QLineEdit a new QWidget (Widget_Y) pops up. In Widget Y , i have few QPushButtons in it. _ whenever the QLineEdit is pressed the Focus will be changed to the new widget (Widget_Y). But, i want the focus to be in Widget_X always (Always Widget_X has to be active ). Even when am pressing the QPushButtons from Widget_Y, still the focus has to be in Widget_X, but the click event of Widget_Y should also be accepted. Please help me on how to achieve this.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Macro
      wrote on last edited by
      #2

      Did you find any solution for this? If yes, please post your solution here. Because, currently i am also facing a similar problem .

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Macro
        wrote on last edited by
        #3

        Hi...
        I hope that the below given code will help you to fix your problem.

        @bool yourWidget::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;
        }@

        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