#include <QtGui>
#include <QDebug>
Q_OBJECT
public:
dock1
->setWidget
(new QLabel("Dock 1 content",
this));
addDockWidget(Qt::RightDockWidgetArea, dock1);
dock2
->setWidget
(new QLabel("Dock 2 content",
this));
addDockWidget(Qt::RightDockWidgetArea, dock2);
tabifyDockWidget(dock1, dock2);
flop = true;
connect(&timer, SIGNAL(timeout()), SLOT(flip()));
timer.start(2000);
}
public slots:
void flip() {
if (flop)
dock1->raise();
else
dock2->raise();
flop = !flop;
}
private:
bool flop;
};
int main(int argc, char *argv[])
{
MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
#include <QDebug>
class MainWindow: public QMainWindow {
Q_OBJECT
public:
MainWindow(QWidget *p = 0): QMainWindow(p) {
setCentralWidget(new QTextEdit(this));
dock1 = new QDockWidget("Dock1", this);
dock1->setWidget(new QLabel("Dock 1 content", this));
addDockWidget(Qt::RightDockWidgetArea, dock1);
dock2 = new QDockWidget("Dock2", this);
dock2->setWidget(new QLabel("Dock 2 content", this));
addDockWidget(Qt::RightDockWidgetArea, dock2);
tabifyDockWidget(dock1, dock2);
flop = true;
connect(&timer, SIGNAL(timeout()), SLOT(flip()));
timer.start(2000);
}
public slots:
void flip() {
if (flop)
dock1->raise();
else
dock2->raise();
flop = !flop;
}
private:
QDockWidget *dock1;
QDockWidget *dock2;
QTimer timer;
bool flop;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow m;
m.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks