[Qt-interest] Can an Qt Application contain 2 mainwindow?

Samuel Gaist samuel.gaist at edeltech.ch
Thu Sep 22 11:52:32 CEST 2011


Hi,

The answer lies here:
http://doc.qt.nokia.com/4.8/thread-basics.html#gui-thread-and-worker-thread

Hope it helps
Samuel

On 22 sept. 2011, at 11:46, Vincent Cai wrote:

> Thanks.
>  
> The error happens when I try to new b window in other thread.
>  
> #include "TSAUtility.h"
>  
> TSAUtility::TSAUtility(void) : QThread()
> {
>     DataUtt = NULL;
> }
>  
> TSAUtility::~TSAUtility()
> {
>     this->terminate();
>     this->wait();
>  
>     if(DataUtt)
>     {
>         delete DataUtt;
>         DataUtt = NULL;
>     }
>  
>     emit SignUttClose();
> }
>  
> void TSAUtility::run()
> {
>     DataUtt = new DataUtility();//failed here
>  
>     DataUtt->show();
>     while(true)
>     {
>  
>     }
> }
>  
> Do you know why?
>  
> -----Original Message-----
> From: Konstantin Tokarev [mailto:annulen at yandex.ru] 
> Sent: 2011年9月22日 17:30
> To: Vincent Cai
> Cc: qt-interest at qt.nokia.com
> Subject: Re: [Qt-interest] Can an Qt Application contain 2 mainwindow?
>  
> 22.09.2011, 13:28, "Vincent Cai" <wcai at cypress.com>:
> > Dear all,
> > 
> >          I have and GUI application with is based on QMainwindow(a.ui).
> > 
> >          And I create the other *.ui which is also based on QMainwindow(b.ui).
> > 
> > When I try to open b window through menu of a window, it fail at initialization:
> > 
> >         DataUtility::DataUtility(QWidget*parent):
> > 
> >         QMainWindow(parent),
> > 
> >         ui(newUi::DataUtility)//fail
> > 
> >         {
> > 
> >                 ui->setupUi(this);
> > 
> > }
> > 
> >          Could anybody help?
>  
> Qt Application certainly can have > 1 QMainWindow. Search for bug in your code.
>  
>  
> --
> Regards,
> Konstantin
> 
> This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list