[Qt-interest] QTabWidget::currentWidget() problem

Malyushytsky, Alex alex at wai.com
Tue Mar 31 22:18:22 CEST 2009


>> Before this used to be a warning and my program was working fine, but now it has become an error( 'm really surprised )

I guess you changed compiler.
Use a proper cast. I would recommend qobject_cast in this case:


QTextEdit *ptr1 = qobject_cast< QTextEdit *>(obj);

Regards,
  Alex

________________________________________
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Keshava Krishna
Sent: Tuesday, March 31, 2009 5:20 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] QTabWidget::currentWidget() problem

Hi,
'm using a tabwidget to which 'm adding many QTextEdit s...
now i want to get a pointer to the currently activated widget...
i used the following code

    QTextEdit *ptr1 = textTab->currentWidget();

but it is giving the following error

Win.cpp:846: error: invalid conversion from 'QWidget*' to 'QTextEdit*'

Before this used to be a warning and my program was working fine, but now it has become an error( 'm really surprised )

can anyone help me out to debug this ?

Regards ,
Keshava.


---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list