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. Widget focusOutEvent event is called before button press inside widget

Widget focusOutEvent event is called before button press inside widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 523 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.
  • S Offline
    S Offline
    Sijith
    wrote on last edited by
    #1

    I have a class(MyWidget) inherited from QWidget and inside it I created a button and other widget (say W1), Both kept inside QVBoxLayout

    On focusOutEvent widget(MyWidget) should hide and it works fine, but when I click the button inside the widget its getting hide but on clicking the widget (W1) inside the layout its not hiding

    m_layout = new QVBoxLayout(widget);
    m_clearButton = new QPushButton(widget);
    m_layout->addWidget(m_clearButton,0,Qt::AlignRight)

    // this widget on click main widget is not hiding
    m_layout->insertWidget(m_layout->count() -1,item);

    Why button click hides MyWidget

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Because when you click on the button the focus moves to the button so out of your other widget.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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