[Qt-interest] Centering the mainwindow

Martin Langridge martinl at vetsystems.com
Thu Feb 19 15:48:39 CET 2009


In  Qt3 you can override the QMainWindow::showEvent and

initialise mMyFirstShowFlag to false in your constructor

void MyMainWindow::showEvent (QShowEvent *e)
{
    if (!e->spontaneos () && mMyFirstShowFlag)
       {
        // get desktop size with QApplication::desktop () and calculate 
x, y, w, h
       // move (x, y);
       // resize (w, h);
       mMyFirstShowFlag = false;
       }

    QMainWindow::showEvent (e);
}

NARCISO, Rui wrote:
> looking at the source didn't really answer my question ...
>
> some help please ...
>
> -----Message d'origine-----
> De : qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com]De la part de Stephen Jackson
> Envoyé : jeudi 19 février 2009 12:26
> À : qt-interest at trolltech.com
> Objet : Re: [Qt-interest] Centering the mainwindow
>
>
> On Thu, Feb 19, 2009 at 9:04 AM, NARCISO, Rui wrote:
>   
>> Hi
>> How do I make it so that my MainWindow appears centered in the screen like the QSplashScreen does?
>>
>> Rui
>>
>>     
>
> Surely, if you look at the source of QSplashScreen you will find your answer.
>
> Regards,
>
> Stephen Jackson
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> This mail has originated outside your organization, either from an external partner or the Global Internet.
> Keep this in mind if you answer this message.
>
>
>
> The information in this e-mail is confidential. The contents may not be disclosed or used by anyone other then the addressee. Access to this e-mail by anyone else is unauthorised.
> If you are not the intended recipient, please notify Airbus immediately and delete this e-mail.
> Airbus cannot accept any responsibility for the accuracy or completeness of this e-mail as it has been sent over public networks. If you have any concerns over the content of this message or its Accuracy or Integrity, please contact Airbus immediately.
> All outgoing e-mails from Airbus are checked using regularly updated virus scanning software but you should take whatever measures you deem to be appropriate to ensure that this message and any attachments are virus free.
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>   




More information about the Qt-interest-old mailing list