Qt 5.10 Book Examples
StartDialog.h
Go to the documentation of this file.
1 // ======================================================================
2 // StartDialog.h
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #pragma once
12 
13 #include <QtWidgets>
14 #include "InputDialog.h"
15 
16 // ======================================================================
17 class StartDialog : public QPushButton {
18 Q_OBJECT
19 public:
20  StartDialog(QWidget* pwgt = 0) : QPushButton("Press Me", pwgt)
21  {
22  connect(this, SIGNAL(clicked()), SLOT(slotButtonClicked()));
23  }
24 
25 public slots:
27  {
28  InputDialog* pInputDialog = new InputDialog;
29  if (pInputDialog->exec() == QDialog::Accepted) {
30  QMessageBox::information(0,
31  "Information",
32  "First Name: "
33  + pInputDialog->firstName()
34  + "\nLast Name: "
35  + pInputDialog->lastName()
36  );
37  }
38  delete pInputDialog;
39  }
40 };
QString firstName() const
Definition: InputDialog.cpp:45
void slotButtonClicked()
Definition: StartDialog.h:26
QString lastName() const
Definition: InputDialog.cpp:51
StartDialog(QWidget *pwgt=0)
Definition: StartDialog.h:20