gpt4 book ai didi

qt - 创建一个没有按钮的 QMessageBox

转载 作者:行者123 更新时间:2023-12-03 07:58:25 26 4
gpt4 key购买 nike

尽管设置了 setStandardButtons(0);它不会关闭 msgBox。

QMessageBox msgBox;
msgBox.setText("My List");
msgBox.setStyleSheet("QDialog { border: 1px solid black;}");
msgBox.setStandardButtons(0);
QTimer::singleShot(5000, &msgBox, SLOT(close()));
msgBox.exec();

最佳答案

使用接受而不是关闭。

msgBox.setStandardButtons(QMessageBox::NoButton);
QTimer::singleShot(5000, &msgBox, &QMessageBox::accept);

关于qt - 创建一个没有按钮的 QMessageBox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75305480/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com