Android - , .
, -, , QStackedWidget, .
:
class W1 : public QWidget {
Q_OBJECT
public:
W1(QWidget * p = 0) : QWidget(p) {
QVBoxLayout * l = new QVBoxLayout(this);
setLayout(l);
QPushButton * b = new QPushButton("do work", this);
l->addWidget(b);
l->addSpacerItem(new QSpacerItem(1, 600));
connect(b, SIGNAL(clicked(bool)), parent(), SLOT(showBusyDialog()));
}
};
class W2 : public QWidget {
Q_OBJECT
public:
W2(QWidget * p = 0) : QWidget(p) {
setAttribute(Qt::WA_OpaquePaintEvent, true);
setAttribute(Qt::WA_NoSystemBackground);
QVBoxLayout * l = new QVBoxLayout(this);
setLayout(l);
QLabel * lb = new QLabel("...working, please wait...", this);
l->addWidget(lb);
l->setAlignment(lb, Qt::AlignCenter);
}
void paintEvent(QPaintEvent * ) {
QPainter p(this);
p.fillRect(rect(), QColor(0, 0, 0, 128));
}
};
class MainW : public QStackedWidget {
Q_OBJECT
public:
MainW() {
resize(300, 600);
W1 * w1 = new W1(this);
addWidget(w1);
}
public slots:
void showBusyDialog() {
W2 * w2 = new W2(this);
setCurrentIndex(addWidget(w2));
QTimer::singleShot(2000, w2, SLOT(deleteLater()));
}
};
W1, " ", 2 , "" ". .
, , , - " " - . , , , , .