Hi everybody,
I have a function which draws a picture on screen :
void MainWindow::darwAGate(int x,int y,int gate_code)
{
//load images:
label_tmp->setGeometry(x,y,gate_width_pixel,gate_height_pixel);
label_tmp->setPixmap(*pixmap_and);
h_layout->addWidget( label_tmp );
this->setLayout(h_layout);
}
void MainWindow::darwAGate(int x,int y,int gate_code)
{
//load images:
QPixmap *pixmap_and = new QPixmap("../pix/AND.png");
QHBoxLayout *h_layout = new QHBoxLayout();
QLabel *label_tmp = new QLabel(this);
label_tmp->setGeometry(x,y,gate_width_pixel,gate_height_pixel);
label_tmp->setPixmap(*pixmap_and);
h_layout->addWidget( label_tmp );
this->setLayout(h_layout);
}
To copy to clipboard, switch view to plain text mode
I have to draw some pix in start of the program, so I like this:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
//draw pics
darwAGate(100, 100, 3);
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//draw pics
darwAGate(100, 100, 3);
}
To copy to clipboard, switch view to plain text mode
The on screen i see the pixs. So i dont have any problem till here.
In the ui I have a bottum which I want to use that for inserting additional pix on screen:
void MainWindow::on_pushButton_clicked()
{
// a sample pic :
darwAGate(100, 100, 2);
}
void MainWindow::on_pushButton_clicked()
{
// a sample pic :
darwAGate(100, 100, 2);
}
To copy to clipboard, switch view to plain text mode
Unfortunately I don't see any additional pic on screen, when I click on push_bottun.
Whats wrong?
Thanks in advance!
Bookmarks