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

Samuel Gaist samuel.gaist at edeltech.ch
Thu Sep 22 16:04:52 CEST 2011


AFAIK There is no such thing as a close signal, but there is a closeEvent that you can use to emit a signal.

Take a look at:
http://doc.qt.nokia.com/4.7/qwidget.html#closeEvent

Hope this helps
Samuel

On 22 sept. 2011, at 16:01, Vincent Cai wrote:

> I met another low-level issue.
> Now I can open b window through menu of a window.
> But I don't know how to capture the close signal of b window.
> What signal will be issued when window based on QMainwindow closed?
> 
> 
> -----Original Message-----
> From: qt-interest-bounces+wcai=cypress.com at qt.nokia.com [mailto:qt-interest-bounces+wcai=cypress.com at qt.nokia.com] On Behalf Of Vincent Cai
> Sent: 2011年9月22日 18:10
> To: Samuel Gaist; Qt-interest
> Subject: Re: [Qt-interest] Can an Qt Application contain 2 mainwindow?
> 
> Thanks a lot.
> Great article, need more time to digest for me, a newbie. :)
> 
> The conclusion is: The Qt GUI must run in main thread, right?
> 
> -----Original Message-----
> From: qt-interest-bounces+wcai=cypress.com at qt.nokia.com [mailto:qt-interest-bounces+wcai=cypress.com at qt.nokia.com] On Behalf Of Samuel Gaist
> Sent: 2011年9月22日 17:53
> To: Qt-interest
> Subject: Re: [Qt-interest] Can an Qt Application contain 2 mainwindow?
> 
> 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
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
> 
> 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
> 
> 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.




More information about the Qt-interest-old mailing list