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

Qt-interest Archive, April 2008
equivalent of gtk Realize Event in QT ?


Message 1 in thread

I am looking for an equivalence of the Gtk  Realize Event on widget in QT

e.g. an Event  that occurs just once before the widget is shown
 but does not occur everytime I hide then re-show the widget
(one option is to reimplement the show event and set a flag realized to true
the first time so as to execute the desired code only once)

void MyQWidget::showEvent(QShowEvent *event)
{
   if (r_isRealized == false)
   {
       r_isRealized = true;       // will execute this code only once

       // more code here...
   }

   event->ignore()
}


but would anyone have a better option to suggest?

Message 2 in thread

Hi Yannick

perhaps QEvent::Polish could help you, although I'm not sure if it's 
guaranteed to be sent just once.

Ross.

----- Original Message ----- 
From: Yannick Barbeaux
To: qt-interest@xxxxxxxxxxxxx
Sent: Thursday, April 10, 2008 12:05 AM
Subject: equivalent of gtk Realize Event in QT ?


I am looking for an equivalence of the Gtk  Realize Event on widget in QT

e.g. an Event  that occurs just once before the widget is shown
 but does not occur everytime I hide then re-show the widget
(one option is to reimplement the show event and set a flag realized to true 
the first time so as to execute the desired code only once)

void MyQWidget::showEvent(QShowEvent *event)
{
   if (r_isRealized == false)
   {
       r_isRealized = true;       // will execute this code only once

       // more code here...
   }

   event->ignore()
}


but would anyone have a better option to suggest? 

--
 [ signature omitted ] 

Message 3 in thread

I reimplemented the event handler so as to catch the polish event
for a QFileDialog but the event doesn't seem to occur never?? Would the
QFileDialog be a special case?

bool MyQFileDialog::event(QEvent *event)
{
   if (event->type() == QEvent::Polish)
   {
        std::cout<<"Polish...\n";
        return true;
   }

   event->accept();  // propagate event

   return true;   // ?
}

On Wed, Apr 9, 2008 at 4:53 PM, Ross Bencina <rossb-lists@xxxxxxxxxxxxxx>
wrote:

> Hi Yannick
>
> perhaps QEvent::Polish could help you, although I'm not sure if it's
> guaranteed to be sent just once.
>
> Ross.
>
> ----- Original Message ----- From: Yannick Barbeaux
> To: qt-interest@xxxxxxxxxxxxx
> Sent: Thursday, April 10, 2008 12:05 AM
> Subject: equivalent of gtk Realize Event in QT ?
>
>
>
> I am looking for an equivalence of the Gtk  Realize Event on widget in QT
>
> e.g. an Event  that occurs just once before the widget is shown
> but does not occur everytime I hide then re-show the widget
> (one option is to reimplement the show event and set a flag realized to
> true the first time so as to execute the desired code only once)
>
> void MyQWidget::showEvent(QShowEvent *event)
> {
>  if (r_isRealized == false)
>  {
>      r_isRealized = true;       // will execute this code only once
>
>      // more code here...
>  }
>
>  event->ignore()
> }
>
>
> but would anyone have a better option to suggest?
>

Message 4 in thread

in qfiledialog detailed description we can read...

"The easiest way to create a QFileDialog is to use the static  
functions. On Windows, these static functions will call the native  
Windows file dialog"

maybe you call native window file dialog so this can be the reason of  
no event::Polish in event handler?
to be confirmed.



Quoting Yannick Barbeaux <ybarbeaux@xxxxxxxxx>:

> I reimplemented the event handler so as to catch the polish event
> for a QFileDialog but the event doesn't seem to occur never?? Would the
> QFileDialog be a special case?
>
> bool MyQFileDialog::event(QEvent *event)
> {
>    if (event->type() == QEvent::Polish)
>    {
>         std::cout<<"Polish...\n";
>         return true;
>    }
>
>    event->accept();  // propagate event
>
>    return true;   // ?
> }
>
> On Wed, Apr 9, 2008 at 4:53 PM, Ross Bencina <rossb-lists@xxxxxxxxxxxxxx>
> wrote:
>
>> Hi Yannick
>>
>> perhaps QEvent::Polish could help you, although I'm not sure if it's
>> guaranteed to be sent just once.
>>
>> Ross.
>>
>> ----- Original Message ----- From: Yannick Barbeaux
>> To: qt-interest@xxxxxxxxxxxxx
>> Sent: Thursday, April 10, 2008 12:05 AM
>> Subject: equivalent of gtk Realize Event in QT ?
>>
>>
>>
>> I am looking for an equivalence of the Gtk  Realize Event on widget in QT
>>
>> e.g. an Event  that occurs just once before the widget is shown
>> but does not occur everytime I hide then re-show the widget
>> (one option is to reimplement the show event and set a flag realized to
>> true the first time so as to execute the desired code only once)
>>
>> void MyQWidget::showEvent(QShowEvent *event)
>> {
>>  if (r_isRealized == false)
>>  {
>>      r_isRealized = true;       // will execute this code only once
>>
>>      // more code here...
>>  }
>>
>>  event->ignore()
>> }
>>
>>
>> but would anyone have a better option to suggest?
>>
>



----------------------------------------------------------------

Ce message electronique et tous les fichiers joints qu'il contient  
(ci-apres "le message") sont confidentiels et destines exclusivement a  
l'usage des destinataires indiques ou des personnes dument habilitees  
a les recevoir a leur place.

Si vous recevez ce message par erreur, merci de bien vouloir le  
detruire et d'en avertir l'emetteur.

Toute utilisation de ce message non conforme a sa destination, toute  
diffusion ou toute publication totale ou partielle est interdite sauf  
autorisation expresse de l'emetteur.

Les idees et opinions exprimees dans ce message sont celles de son  
auteur et ne representent pas necessairement celles de CS  
Communication & Systemes ou de ses filiales.

Malgre toutes les dispositions prises par CS Communication & Systemes  
et ses filiales pour minimiser les risques de virus, les fichiers  
joints a ce message peuvent contenir des virus qui pourraient  
endommager votre systeme informatique. Il vous appartient d'effectuer  
vos propres controles anti-virus avant d'ouvrir les fichiers joints.  
CS Communication & Systemes et ses filiales declinent toute  
responsabilite pour toute perte ou dommage resultant de l'utilisation  
de ce message et/ou des fichiers joints.

This e-mail and any file attached hereto (hereinafter 'the e-mail')  
are confidential and intended solely for the use of the adressees  
indicated below or the persons duly entitled to receive them in their  
place.

If you receive this e-mail in error, please delete it and notify the sender.

Any use of this e-mail not in accordance with its purpose, any  
dissemination or disclosure, either whole or partial, is prohibited,  
unless formally approved by the sender.

The ideas or opinions expressed in this e-mail are solely those of its  
author and do not necessarily represent those of CS Communication &  
Systeme or its affiliates.

Despite all the measures taken by CS Communication & Systeme and its  
affiliates in order to minimize the risks of virus, the files attached  
to this e-mail may contain virus which could damage your information  
system. You are responsible for processing your own anti-virus  
checking before opening any file attached hereto. Neither CS  
Communication & Systemes, nor its affiliates, shall be held liable for  
any loss or damage due to the use of this e-mail or any file attached  
hereto.



--
 [ signature omitted ]