blob: d5cbafbe837e0f05fddafea6d234a66fe01ba547 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include <QtGui>
#include "imagedialog.h"
//! [0]
ImageDialog::ImageDialog(QWidget *parent)
: QDialog(parent)
{
setupUi(this);
okButton->setAutoDefault(false);
cancelButton->setAutoDefault(false);
//! [0]
colorDepthCombo->addItem(tr("2 colors (1 bit per pixel)"));
colorDepthCombo->addItem(tr("4 colors (2 bits per pixel)"));
colorDepthCombo->addItem(tr("16 colors (4 bits per pixel)"));
colorDepthCombo->addItem(tr("256 colors (8 bits per pixel)"));
colorDepthCombo->addItem(tr("65536 colors (16 bits per pixel)"));
colorDepthCombo->addItem(tr("16 million colors (24 bits per pixel)"));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
//! [1]
connect(okButton, SIGNAL(clicked()), this, SLOT(checkValues()));
}
//! [1]
//! [2]
void ImageDialog::checkValues()
{
if (nameLineEdit->text().isEmpty())
(void) QMessageBox::information(this, tr("No Image Name"),
tr("Please supply a name for the image."), QMessageBox::Cancel);
else
accept();
}
//! [2]
|