Here it is, another one:
#include <QApplication>
#include <QWidget>
#include <QDialog>
#include <QPushButton>
#include <QLabel>
int main(int argc, char** argv) {
l->setText("Hi, I'm a instance of QDialog class");
QObject::connect(b,
SIGNAL(clicked
()), dlg,
SLOT(show
()));
w->show();
int r = a.exec();
delete w;
return r;
}
#include <QApplication>
#include <QWidget>
#include <QDialog>
#include <QPushButton>
#include <QLabel>
int main(int argc, char** argv) {
QApplication a(argc, argv);
QWidget *w = new QWidget(0);
QPushButton *b = new QPushButton("Show Dialog", w);
QDialog *dlg = new QDialog(w);
QLabel *l = new QLabel(dlg);
l->setText("Hi, I'm a instance of QDialog class");
QObject::connect(b, SIGNAL(clicked()), dlg, SLOT(show()));
w->show();
int r = a.exec();
delete w;
return r;
}
To copy to clipboard, switch view to plain text mode
You can replace the QWidget and QDialog with classes you inherit from them (with or without ui)
Bookmarks