2017-12-26 9 views
0

버튼을 클릭하고 사용중인 Pixmap 이미지를 팝업으로 만들려고하는데 버튼을 클릭하면 다시, 그것은 사라진다. 현재 앱을 실행하면 이미지가 이미 있으며 버튼을 클릭하면 사라집니다. 어떻게 고치는 지?? on_pushButton_clicked()을 보면 버튼을 클릭하면 QPixmap이 나타나고 같은 버튼을 클릭하면 QPIxmap이 사라집니다.

#include "yes.h" 
#include "ui_yes.h" 

yes::yes(QWidget *parent) : 
    QDialog(parent), 
    ui(new Ui::yes) 
{ 
    ui->setupUi(this); 
} 

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); 
} 

답변

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()); 
}