Non-modal Qt::Popup
-
Hello,
I want to have a QWidget with Qt::Popup window flag. But it needs to be non-modal. Even if I set modality to Qt::NonModal, after setting the windows flags, the popup always blocks interaction with the parent.
Is this a bug? A feature? What's a workaround for this?
I'm on Windows.
-
@cidadao ,
Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);
m_Button = new QPushButton(this);
sample = new QWidget;
sample->setAttribute( Qt::WA_QuitOnClose, false );
if(sample->isMinimized()) {
sample->showNormal();
}
connect(m_Button,SIGNAL(clicked()),this,SLOT(on_pushButton_Clicked()));
}
void Widget::on_pushButton_clicked()
{
sample->setFixedSize(50,50);
sample->setWindowFlags(Qt::FramelessWindowHint);
sample->setWindowModality(Qt::NonModal);
sample->show();
} -
@Vinod-Kuntoji it really has to be a Popup, not a FramelessWindow. A Popup doesn't take space in a layout, it is drawn on top other widgets instead.
If you try your code with Qt::Popup you might have the same problem as OP (can't set a Popup to be non-modal)
-
@cidadao it looks like you want a green ball that is red...
From Qt documentation about Qt::Popup window type enum:
"Indicates that the widget is a pop-up top-level window, i.e. that it is modal, but has a window system frame appropriate for pop-up menus."so modal it'll be...