MessageDialog *message = new MessageDialog(this);message->show();
MessageDialog *message = new MessageDialog(this);if (message->exec() == QDialog::Accepted) { // ....}
QPushButton *okButton = new QPushButton(tr("Продолжить"), this);QPushButton *cancelButton = new QPushButton(tr("Отмена"), this);connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
setLayout( new QHBoxLayout );QPushButton * buttonAccept = new QPushButton( "accept" );QPushButton * buttonReject = new QPushButton( "reject" );layout()->addWidget( buttonAccept );layout()->addWidget( buttonReject );connect( buttonAccept, SIGNAL( clicked() ), SLOT( accept() ) );connect( buttonReject, SIGNAL( clicked() ), SLOT( reject() ) );
setWindowFlags(Qt::FramelessWindowHint);
MyDialog::setWindowFlags(Qt::FramelessWindowHint); MyDialog::setGeometry(QRect(0, 0, 1024, 768)); QPalette bgPalette = MyDialog::palette(); QBrush bgBrush = QColor(255, 255, 255, 50); //120 bgPalette.setBrush(MyDialog::backgroundRole(), bgBrush); MyDialog::setAutoFillBackground(true); MyDialog::setPalette(bgPalette); QPixmap bgPixmap("dialog.png"); QLabel *bgLabel = new QLabel(this); bgLabel->setPixmap(bgPixmap); QPushButton *okButton = new QPushButton(tr("Продолжить"), this); QPushButton *cancelButton = new QPushButton(tr("Отмена"), this); okButton->setGeometry(QRect(600, 440, 200, 50)); cancelButton->setGeometry(QRect(360, 440, 200, 50)); connect(okButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
MyDialog::setGeometry(QRect(0, 0, 1024, 768));
MessageDialog *message = new MessageDialog( this, Qt::FramelessWindowHint );
MessageDialog::MessageDialog( QWidget * parent, Qt::WFlags flags ): QDialog( parent, flags | Qt::FramelessWindowHint ){...}