Child widget hides when mouse events are triggered?
-
Good day, hope you're doing well. I have a parent QWidget AppMain that accepts mouse events and inside it I load another QWidget AppChildWidget that I can show with a button click. All works well except the child qwidget hides everytime I do any mouse events in the parent qwidget. Something as simple as clicking inside the parent hides the child widget. As soon as I stop the mouse events it shows again. Can this be fixed anyway? I tried setting the Qt::WindowsFlags() to always stay on top but it's not working.
AppMain
AppMain::AppMain(QWidget* parent) : QWidget(parent) { } AppMain::showChildWidget(bool showChildWidget) { ui.appChildWidget->setWindowFlags(Qt::WindowStaysOnTopHint); ui.appChildWidget->show(); }AppChildWidget
AppChildWidget::AppChildWidget(QObject* parent) : QObject(parent) { }Appreciate any help and tips. Thank you.
-
Good day, hope you're doing well. I have a parent QWidget AppMain that accepts mouse events and inside it I load another QWidget AppChildWidget that I can show with a button click. All works well except the child qwidget hides everytime I do any mouse events in the parent qwidget. Something as simple as clicking inside the parent hides the child widget. As soon as I stop the mouse events it shows again. Can this be fixed anyway? I tried setting the Qt::WindowsFlags() to always stay on top but it's not working.
AppMain
AppMain::AppMain(QWidget* parent) : QWidget(parent) { } AppMain::showChildWidget(bool showChildWidget) { ui.appChildWidget->setWindowFlags(Qt::WindowStaysOnTopHint); ui.appChildWidget->show(); }AppChildWidget
AppChildWidget::AppChildWidget(QObject* parent) : QObject(parent) { }Appreciate any help and tips. Thank you.
@Calicoder
hide means is it behind or not visible ? How the ui is initialized ? What is the code inside the mousepressevent in Appmain. Workable code snippet will help help you. -
Good day, hope you're doing well. I have a parent QWidget AppMain that accepts mouse events and inside it I load another QWidget AppChildWidget that I can show with a button click. All works well except the child qwidget hides everytime I do any mouse events in the parent qwidget. Something as simple as clicking inside the parent hides the child widget. As soon as I stop the mouse events it shows again. Can this be fixed anyway? I tried setting the Qt::WindowsFlags() to always stay on top but it's not working.
AppMain
AppMain::AppMain(QWidget* parent) : QWidget(parent) { } AppMain::showChildWidget(bool showChildWidget) { ui.appChildWidget->setWindowFlags(Qt::WindowStaysOnTopHint); ui.appChildWidget->show(); }AppChildWidget
AppChildWidget::AppChildWidget(QObject* parent) : QObject(parent) { }Appreciate any help and tips. Thank you.
@Calicoder
When you create the AppChildWidget from AppMain do you indeed pass itthisfor itsparent? Otherwise please answer @dheerendra's questions.