Qt 5.14.1 on Linux,Dialog Close Card
-
Dialog calls the close function when the button is pressed, and it will be stuck for 2 or 3 seconds, but the built-in close button in the upper right corner will not get stuck. The more controls on the form, the more stuck. What is the reason?
-
@jack-reemoon said in Qt 5.14.1 on Linux,Dialog Close Card:
What is the reason?
Impossible to say based on the information you provided!
- What are you doing in the destructor of your dialog?
- Are any other actions triggered when this button is pressed?
You can also show relevant code to help others to help you.
-
-
The destructor only has the delete UI, and the button only calls this.close
-
@jack-reemoon Please post code as text, not screen-shots!
Please try to debug and/or profile your app to find out where it spends so much time. From what you posted others can only guess.
What you also can do: create a small app which reproduces this issue and post the code. -
@jsulm
void MainWindow::on_pushButton_clicked()
{
TestDialog *test = new TestDialog ();
test->setAttribute(Qt::WA_DeleteOnClose);
test->show();
}#include "testdialog.h"
#include "ui_testdialog.h"TestDialog::TestDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::TestDialog)
{
ui->setupUi(this);
connect(ui->pushButton_2,&QPushButton::clicked,this,&TestDialog::pushButton_2_clicked);
}TestDialog::~TestDialog()
{
delete ui;
}void TestDialog::closeEvent(QCloseEvent *event)
{
event->accept();
}void TestDialog::pushButton_2_clicked()
{
this->close();
}
Does qt have requirements for computers? Computers with high configuration will not get stuck.
Post 1 of 6