[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-cxx-dev
Subject:    RE: CXX-DEV: Problem building kdenetwork-3.2.1 on HP-UX 11.ii
From:       "S G Ganesh" <sgganesh () india ! hp ! com>
Date:       2004-03-16 6:25:30
Message-ID: 006b01c40b1d$ce38c2c0$b0614c0f () ebnt176
[Download RAW message or body]

> It would help if you could tell us how 'viewport()' is defined?
>>QWidget* viewport() const;

I was looking for the body of the function to check the actual object that is
returned - with that, you can check if it is valid/safe to do a downcast.

~Ganesh
Ph: +91 80 22051832


-----Original Message-----
From: owner-cxx-dev@cxx.cup.hp.com
[mailto:owner-cxx-dev@cxx.cup.hp.com]On Behalf Of Albert Chin
Sent: Monday, March 15, 2004 9:42 PM
To: cxx-dev@cxx.cup.hp.com
Subject: Re: CXX-DEV: Problem building kdenetwork-3.2.1 on HP-UX 11.ii


On Mon, Mar 15, 2004 at 08:40:15PM +0530, S G Ganesh wrote:
> Did you introduce the local class just to do the cast? It would help if you
> could tell us how 'viewport()' is defined?

I didn't write the code but I do think the class was introduced just
to do the cast. I cannot think of any other reason.

QWidget* viewport() const;

> ~Ganesh
> Ph: +91 80 22051832
>
>
> -----Original Message-----
> From: owner-cxx-dev@cxx.cup.hp.com
> [mailto:owner-cxx-dev@cxx.cup.hp.com]On Behalf Of Albert Chin
> Sent: Monday, March 15, 2004 1:11 PM
> To: cxx-dev@cxx.cup.hp.com
> Subject: Re: CXX-DEV: Problem building kdenetwork-3.2.1 on HP-UX 11.ii
>
>
> On Mon, Mar 15, 2004 at 12:24:28PM +0530, S G Ganesh wrote:
> > Use 'using declaration' to provide access to 'QWidget::clearWFlags;' and
that
> > will solve your problem:
> >
> > KopeteContactListView::KopeteContactListView () {
> >   clearWFlags (WStaticContents | WNoAutoErase);
> >
> >   class MyWidget : public QWidget {
> >   public:
> >     using QWidget::clearWFlags;   /// --->  'using declartion' here instead
of
> > 'access declaration'
> >   };
> >   static_cast<MyWidget*>(viewport())->clearWFlags (WStaticContents |
> > 						   WNoAutoErase);
> > } // --> semicolon not necessary here
>
> Ok, thanks, that fixed it. BTW, is the following:
>   KopeteContactListView::KopeteContactListView () {
>     class MyWidget : public QWidget {
>     public:
>       using QWidget::clearWFlags;
>     };
>     static_cast<MyWidget*>(viewport())->clearWFlags (WStaticContents |
> 						     WNoAutoErase);
>   };
> equivalent to:
>   KopeteContactListView::KopeteContactListView () {
>     static_cast<KopeteContactListView*>(viewport())->clearWFlags
> 						     (WStaticContents |
> 						      WNoAutoErase);
>   };
>
> because the latter works as well.
>
> --
> albert chin (china@thewrittenword.com)
>  _________________________________________________________________
>  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
>     with the message UNSUBSCRIBE cxx-dev
>  _________________________________________________________________
>  _________________________________________________________________
>  To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
>     with the message UNSUBSCRIBE cxx-dev
>  _________________________________________________________________

--
albert chin (china@thewrittenword.com)
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 _________________________________________________________________
 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 _________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic