Rakma74
19th August 2012, 17:21
Dear Sirs,
I'm using Qt for a software project I recently started, and the development is in a good way... this tool is fantatic, and the Qt creator IDE so friendly...
However, I would have a question concerning the windows:
I currently use around 8 dock windows, and I would like to display them in 2 'screen large' separate windows (4 docks in each), and to have the possibility to chose the current large window which would display the 4 docks (by the menu, or whatever).
I was thinking about using 2 large docks and trying to dock 4 windows inside both, impossible, because the addDockWidget function can't be used on docks...
I was also waondering if there would be a possibility to create 2 main windows...
If you would have any type, please, let me know !
Thanks in advance,
Best Regards,
Stéphane
Added after 1 4 minutes:
PS:
I just discovered that it could probably be possible using this:
#include <QtGui>
#include <QDebug>
// #include "main.moc"
class Window: public QMainWindow
{
Q_OBJECT
public:
Window(QWidget *p = 0): QMainWindow(p) {
count = 0;
central = new QLabel(this);
setCentralWidget(central);
}
public slots:
void receive() {
central->setText(QString::number(count++));
}
private:
QLabel *central;
int count;
};
class Controller: public QObject {
Q_OBJECT
public:
Controller(QObject *parent = 0): QObject(parent) {
m_winA = new Window();
m_winA->setWindowTitle("Window A");
connect(this, SIGNAL(signalA()), m_winA, SLOT(receive()));
m_winB = new Window();
m_winB->setWindowTitle("Window B");
connect(this, SIGNAL(signalB()), m_winB, SLOT(receive()));
m_winA->show();
m_winB->show();
// some fake incoming events
m_count = 0;
connect(&m_timer, SIGNAL(timeout()), this, SLOT(incoming()));
m_timer.start(100);
}
~Controller() {
delete m_winA;
delete m_winB;
}
public slots:
void incoming() {
if (m_count++ % 3 == 0)
emit signalA();
else
emit signalB();
}
signals:
void signalA();
void signalB();
private:
Window *m_winA;
Window *m_winB;
int m_count;
QTimer m_timer;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Controller c;
return app.exec();
}
//
However, it creates 2 separate windows...
I'm using Qt for a software project I recently started, and the development is in a good way... this tool is fantatic, and the Qt creator IDE so friendly...
However, I would have a question concerning the windows:
I currently use around 8 dock windows, and I would like to display them in 2 'screen large' separate windows (4 docks in each), and to have the possibility to chose the current large window which would display the 4 docks (by the menu, or whatever).
I was thinking about using 2 large docks and trying to dock 4 windows inside both, impossible, because the addDockWidget function can't be used on docks...
I was also waondering if there would be a possibility to create 2 main windows...
If you would have any type, please, let me know !
Thanks in advance,
Best Regards,
Stéphane
Added after 1 4 minutes:
PS:
I just discovered that it could probably be possible using this:
#include <QtGui>
#include <QDebug>
// #include "main.moc"
class Window: public QMainWindow
{
Q_OBJECT
public:
Window(QWidget *p = 0): QMainWindow(p) {
count = 0;
central = new QLabel(this);
setCentralWidget(central);
}
public slots:
void receive() {
central->setText(QString::number(count++));
}
private:
QLabel *central;
int count;
};
class Controller: public QObject {
Q_OBJECT
public:
Controller(QObject *parent = 0): QObject(parent) {
m_winA = new Window();
m_winA->setWindowTitle("Window A");
connect(this, SIGNAL(signalA()), m_winA, SLOT(receive()));
m_winB = new Window();
m_winB->setWindowTitle("Window B");
connect(this, SIGNAL(signalB()), m_winB, SLOT(receive()));
m_winA->show();
m_winB->show();
// some fake incoming events
m_count = 0;
connect(&m_timer, SIGNAL(timeout()), this, SLOT(incoming()));
m_timer.start(100);
}
~Controller() {
delete m_winA;
delete m_winB;
}
public slots:
void incoming() {
if (m_count++ % 3 == 0)
emit signalA();
else
emit signalB();
}
signals:
void signalA();
void signalB();
private:
Window *m_winA;
Window *m_winB;
int m_count;
QTimer m_timer;
};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Controller c;
return app.exec();
}
//
However, it creates 2 separate windows...