我试图能够点击一个按钮,并且我正在使用弹出的Pixmap图像,当我再次单击该按钮时,它会消失。现在,当我运行我的应用程序时,图像已经存在,当我单击按钮时,它会消失。如何解决??
example :: [Int] -> [Int] -> Maybe Int
example [] [] = Nothing
example (x:xs) (l:ls) = Just $ x * l + fromMaybe 0 (example xs ls)
查看on_pushButton_clicked()
答案 0 :(得分:0)
我明白了。只需使弹出窗口不可见,然后将可见性设置为按钮单击时的可见性。
#include "yes.h"
#include "ui_yes.h"
yes::yes(QWidget *parent) :
QDialog(parent),
ui(new Ui::yes)
{
ui->setupUi(this);
ui->label->setVisible(false);
}
yes::~yes()
{
delete ui;
}
void yes::on_pushButton_clicked()
{
hide();
}
void yes::on_pushButton_2_clicked()
{
QPixmap popup("qrc:/new/prefix1/Popover for seat help");
// ui->label->setPixmap(popup);
ui->label->setVisible(!ui->label->isVisible());
}