PDA

View Full Version : Make widgets float inside of qapplication main window



yapatel
21st March 2014, 04:30
Hi -

I am upgrading our qt-based application to qt4 from qt3. The application has a main window and then dynamically loadable modules (as widgets).

I want the module windows to be floating windows inside of the main application window, however I can't seem to get this to work that way.

I can only get them either take up the entire main window space (as shown in shot1.png) or be floating, individual windows that are separate from the main window (they can be dragged outside the main application window and don't get closed when then main window closes).

For both cases (shot1.png and shot2.png), my widget constructor has the following:


DataRecorder::Panel::Panel(QWidget *parent, size_t buffersize) :
QWidget(parent), RT::Thread(RT::Thread::MinimumPriority), fifo(buffersize), recording(false) {

setAttribute(Qt::WA_DeleteOnClose);

In shot1.png, I have the following in my main_window.cpp file:


MainWindow::MainWindow (void) : QMainWindow(NULL, Qt::Window) {

QWidget *centralWidget = new QWidget(this);
setCentralWidget(centralWidget);

setCentralWidget(new QWorkspace(this));
((QWorkspace *)centralWidget)->setScrollBarsEnabled(true);

and in shot2.png I have that commented out.

Any help is appreciated

1015510156

ChrisW67
21st March 2014, 04:57
Not sure it you want QMdiArea or QDockWidgets