14 #include <QtPrintSupport> 22 QPushButton* pcmdOpenFile =
new QPushButton(
"&OpenFile");
28 QPushButton* pcmdDirectory =
new QPushButton(
"&Directory");
29 connect(pcmdDirectory,
34 QPushButton* pcmdColor =
new QPushButton(
"&Color");
35 connect(pcmdColor, SIGNAL(clicked()), SLOT(
slotColor()));
37 QPushButton* pcmdPrinter =
new QPushButton(
"&Printer");
38 connect(pcmdPrinter, SIGNAL(clicked()), SLOT(
slotPrinter()));
40 QPushButton* pcmdFont =
new QPushButton(
"&Font");
41 connect(pcmdFont, SIGNAL(clicked()), SLOT(
slotFont()));
43 QPushButton* pcmdInput =
new QPushButton(
"&Input");
44 connect(pcmdInput, SIGNAL(clicked()), SLOT(
slotInput()));
46 QPushButton* pcmdProgress =
new QPushButton(
"P&rogress");
47 connect(pcmdProgress, SIGNAL(clicked()), SLOT(
slotProgress()));
49 QVBoxLayout* pvbxLayout =
new QVBoxLayout;
50 pvbxLayout->addWidget(pcmdOpenFile);
51 pvbxLayout->addWidget(pcmdDirectory);
52 pvbxLayout->addWidget(pcmdColor);
53 pvbxLayout->addWidget(pcmdPrinter);
54 pvbxLayout->addWidget(pcmdFont);
55 pvbxLayout->addWidget(pcmdInput);
56 pvbxLayout->addWidget(pcmdProgress);
58 setLayout(pvbxLayout);
66 QFileDialog::getOpenFileName(0,
"Open Dialog",
"",
"*.cpp *.h");
73 QFileDialog::getExistingDirectory(0,
"Directory Dialog",
"");
80 QPrintDialog* pPrintDialog =
new QPrintDialog(&printer);
81 if (pPrintDialog->exec() == QDialog::Accepted) {
90 QColor color = QColorDialog::getColor(Qt::blue);
98 QFont font = QFontDialog::getFont(&bOk);
108 QString str = QInputDialog::getText(0,
124 QProgressDialog* pprd =
125 new QProgressDialog(
"Processing the data...",
"&Cancel", 0, n);
127 pprd->setMinimumDuration(0);
128 pprd->setWindowTitle(
"Please Wait");
130 for (
int i = 0; i < n; ++i) {
132 qApp->processEvents();
133 if (pprd->wasCanceled()) {
void slotExistingDirectory()
StartDialog(QWidget *pwgt=0)