0

I am writing a Qt MDI application, using this MDI example as a starting point.
The example works as it should, of course. My program instead has this issue:

When I resize a child window, this gets resized, but when its size is above a certain level, part of it is no longer visible. It is like if there was a limited area (rectangle) through which the child window is visible. Everything beyond that is hidden.

The rectangle through which the child window is visible has the size of the child window itself when it is created.

enter image description here

This is a working extract from the code:

// mdi_test.h

#ifndef MDI_TEST_H
#define MDI_TEST_H

#include <QtGui>

class ViewerWindow : public QMdiSubWindow
{
    Q_OBJECT
};

class TopLevelWindow : public QMainWindow
{
    Q_OBJECT

public:
    TopLevelWindow(QWidget*);

private slots:
    void newPlotView();
    ViewerWindow* createViewerWindow();

private:
    QMdiArea *mdiArea;
};

#endif // MDI_TEST_H


// mdi_test.cpp

#include "mdi_test.h"

TopLevelWindow::TopLevelWindow(QWidget *parent)
    : QMainWindow(parent)
{
    mdiArea = new QMdiArea;

    newPlotView();
    newPlotView();
    newPlotView();

    setCentralWidget(mdiArea);
}

void TopLevelWindow::newPlotView()
{
    ViewerWindow *newViewer = createViewerWindow();
    newViewer->show();
}

ViewerWindow* TopLevelWindow::createViewerWindow()
{
    ViewerWindow *viewer = new ViewerWindow;
    mdiArea->addSubWindow(viewer);

    return viewer;
}


// entrypoint.cpp

#include <QApplication>
#include "mdi_test.h"

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    TopLevelWindow *top = new TopLevelWindow(0);
    top->show();

    return app.exec();
}

Of course, if you compile and run this example, you will not find my issue. The problem is that this is the same skeleton of the code used in the real project, everything else does not seem to be related to this issue.

Could it be possible that the behaviour of this code would be different in other contexts?

Platform: Windows 7, Qt 4.8.5, MinGW

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • I think you should try to reinstall Qt, it looks like a bug. Try to run this program on another computer (or under virtual machine) – SpongeBobFan Aug 01 '13 at 15:18
  • I am pretty sure the bug is in my code. The examples from Qt documentation have no issues. – Pietro Aug 01 '13 at 15:22

0 Answers0