i have pushbutton in forms created in base class mainwidow .now i have created one widget on the same form by drag and drop and again i created a pushbutton on the class widget.now i want that on the click of my pushbutton which was on the widget,my mainwindow button got disappeared…
how can it be possible.?please help me out
i have promoted the widget to class mywidget and done some thing like this
.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow //class mainwindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
private slots:
};
class mywidget : public QWidget // class mywidget
{
Q_OBJECT
public:
mywidget(QWidget *parent = 0);
public slots:
private:
Ui::MainWindow *ui;
private slots:
void on_pushButton_2_clicked();
};
#endif // MAINWINDOW_H
.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
mywidget::mywidget(QWidget *parent)
: QWidget(parent)
{
}
void mywidget::on_pushButton_2_clicked()
{
}
tell me how to do it sir ..
please
↧