Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, April 2007
Child window help


Message 1 in thread

I have a QtGui.QMainWindow that I want to spawn a configuration dialog 
from. I have been trying many things and cannot seem to get it working. 
What I have right now is a MainWindow created in QT-Designer, and a 
Dialog created in QT-Designer. Both are separate UI files, and are both 
included in the main program. So I guess before I tell you the million 
ways I've tried it, How do I launch the child window with a Button? This 
is a SDI, not a MDI interface. I have tried the windowflags example and 
cannot even get that working.

Thanks,
Lawrence

--
 [ signature omitted ] 

Message 2 in thread

On 16.04.07 15:03:19, Lawrence Shafer wrote:
> I have a QtGui.QMainWindow that I want to spawn a configuration dialog from. I 
> have been trying many things and cannot seem to get it working. What I have 
> right now is a MainWindow created in QT-Designer, and a Dialog created in 
> QT-Designer. Both are separate UI files, and are both included in the main 
> program. So I guess before I tell you the million ways I've tried it, How do I 
> launch the child window with a Button? This is a SDI, not a MDI interface. I 
> have tried the windowflags example and cannot even get that working.

There are several ways of applying a form to a QDialog instance
(see designer manual for details). Then you connect a slot to the
clicked signal of your button and in that slot you create the dialog and
call its exec() function.

If you need more detailed instructions please provide some example code.

Andreas

-- 
 [ signature omitted ] 

Message 3 in thread

Lawrence Shafer escribió:
> I have a QtGui.QMainWindow that I want to spawn a configuration dialog 
> from. I have been trying many things and cannot seem to get it 
> working. What I have right now is a MainWindow created in QT-Designer, 
> and a Dialog created in QT-Designer. Both are separate UI files, and 
> are both included in the main program. So I guess before I tell you 
> the million ways I've tried it, How do I launch the child window with 
> a Button? This is a SDI, not a MDI interface. I have tried the 
> windowflags example and cannot even get that working.
>
> Thanks,
> Lawrence
 Take a look to the MDI example:

http://doc.trolltech.com/4.2/mainwindows-mdi.html

good luck!
David.

this is important:

//mainwindow.cpp

 class MainWindow : public QMainWindow
 {

 private:

     QWorkspace *workspace;

 };

//mainwindow.cpp

 MainWindow::MainWindow()
 {
     workspace = new QWorkspace;
     setCentralWidget(workspace);
}

 void MainWindow::newFile()
 {
     MdiChild *child = createMdiChild();
     child->newFile();
     child->show();
 }

MdiChild *MainWindow::createMdiChild()
 {
     MdiChild *child = new MdiChild;
     workspace->addWindow(child);

     return child;
 }








--
 [ signature omitted ]