[Qt-interest] multiple qmainwindow problem

hazreti coolcuzu coolcuzu at gmail.com
Tue Feb 15 08:57:22 CET 2011


I have two classes derived from QMainWindow. The first class is class1, and
the second class is class2.

I have an instance of class2 as a private member of class1.

When a button is clicked in class1's GUI, I want to instantiate the instance
of class2, and show it.

void class1::buttonClicked()
{
     class2object = new class2();
     class2object->show();
}

The problem is, if I instantiate class2object with NULL parent widget, it
becomes passive. I can't touch it with my mouse, move it or do anything.
When I close class1 object, class2object becomes active and I can work on
it.

If I instantiate class2object with parent widget set to class1object as:

void class1::buttonClicked()
{
     class2object = new class2(this);
     class2object->show();
}

class2object can get active, I can work on two main windows. But, when I
press ALT + TAB, I can't move between the windows, they don't behave like
two different applications.

What should I do to have two interchangable windows, where both of them can
be active, and look like two different processes?

thanks a lot.

erman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110215/ac9fff30/attachment.html 


More information about the Qt-interest-old mailing list