On quinta-feira, 20 de abril de 2017 09:35:15 PDT Igor Mironchik wrote:
> Hi,
>
> >> QObject has virtual destructor... dynamic_cast will work. But it doesn't
> >> matter, the problem was in another...
> >
> > If your class has virtual functions or derives from such base class, and
> > have
> Am 20.04.2017 um 08:05 schrieb nikita baryshnikov :
>
> Hi, Igor
>
> Your example is incorrect, cause you forget about Q_OBJECT macro in
> Channel class
That's what I just wanted to add as a general remark, because it is a common
pitfall (at least for me): /every/
20.04.2017 19:35, Igor Mironchik пишет:
Hi,
QObject has virtual destructor... dynamic_cast will work. But it
doesn't
matter, the problem was in another...
If your class has virtual functions or derives from such base class,
and have
inline (or default) virtual destructor,its v-table will
Hi,
QObject has virtual destructor... dynamic_cast will work. But it doesn't
matter, the problem was in another...
If your class has virtual functions or derives from such base class, and have
inline (or default) virtual destructor,its v-table will be emitted in each
translation unit. This
20.04.2017 19:16, Thiago Macieira пишет:
On quinta-feira, 20 de abril de 2017 08:47:46 PDT Igor Mironchik wrote:
Fix it by adding a non-inline virtual destructor to Channel.
Sure. It's just a pseudo code.
Then stop pasting pseudo-code. If you hide the problem, then you won't *see*
the
20.04.2017, 19:09, "Igor Mironchik" :
> 20.04.2017 18:22, Thiago Macieira пишет:
>> Em quarta-feira, 19 de abril de 2017, às 22:56:46 PDT, Igor Mironchik
>> escreveu:
>>> class Channel
>>>
>>> : public QObject
>>>
>>> {};
>>> void mySlot()
>>> {
>>>
On quinta-feira, 20 de abril de 2017 08:47:46 PDT Igor Mironchik wrote:
> > Fix it by adding a non-inline virtual destructor to Channel.
>
> Sure. It's just a pseudo code.
Then stop pasting pseudo-code. If you hide the problem, then you won't *see*
the problem.
> In real code was virtual
20.04.2017 18:22, Thiago Macieira пишет:
Em quarta-feira, 19 de abril de 2017, às 22:56:46 PDT, Igor Mironchik
escreveu:
class Channel
: public QObject
{};
void mySlot()
{
Channel * ch = qobject_cast< Channel* > ( sender() );
// You are 100% sure that sender() is Channel!!!
Em quarta-feira, 19 de abril de 2017, às 22:56:46 PDT, Igor Mironchik
escreveu:
> class Channel
>
>: public QObject
>
> {};
> void mySlot()
> {
>Channel * ch = qobject_cast< Channel* > ( sender() );
>// You are 100% sure that sender() is Channel!!!
>// And this cast will
Hi,
If sender() is a Channel*, then qobject_cast should not fail.
Try to add this to your slot, this will print the inheritance list
qDebug() << "Looking for" << ::staticMetaObject <<
Channel::staticMetaObject.className() << "on" << sender() <<
qobject_cast< Channel* > ( sender() )
On 20 April 2017 at 19:04, Igor Mironchik wrote:
> Hi,
>
> If sender() is a Channel*, then qobject_cast should not fail.
>
> Try to add this to your slot, this will print the inheritance list
>
> qDebug() << "Looking for" << ::staticMetaObject <<
>
Hi,
If sender() is a Channel*, then qobject_cast should not fail.
Try to add this to your slot, this will print the inheritance list
qDebug() << "Looking for" << ::staticMetaObject <<
Channel::staticMetaObject.className() << "on" << sender() <<
qobject_cast< Channel* > ( sender() )
On 20 April 2017 at 18:10, Igor Mironchik wrote:
>
>
> 20.04.2017 9:01, Ch'Gans пишет:
>
> On 20 April 2017 at 17:56, Igor Mironchik wrote:
>
> 20.04.2017 8:47, Ch'Gans пишет:
>
> On 20 April 2017 at 17:03, Igor Mironchik
20.04.2017 9:01, Ch'Gans пишет:
On 20 April 2017 at 17:56, Igor Mironchik wrote:
20.04.2017 8:47, Ch'Gans пишет:
On 20 April 2017 at 17:03, Igor Mironchik
wrote:
Hi,
20.04.2017 7:52, Ch'Gans пишет:
On 20 April 2017 at 16:38, Igor
Hi,
All is ok with Q_OBJECT in real code. This is just pseudo code...
20.04.2017 9:05, nikita baryshnikov пишет:
Hi, Igor
Your example is incorrect, cause you forget about Q_OBJECT macro in
Channel class
On Thu, Apr 20, 2017 at 8:56 AM, Igor Mironchik
wrote:
Hi, Igor
Your example is incorrect, cause you forget about Q_OBJECT macro in
Channel class
On Thu, Apr 20, 2017 at 8:56 AM, Igor Mironchik
wrote:
>
>
> 20.04.2017 8:47, Ch'Gans пишет:
>
>> On 20 April 2017 at 17:03, Igor Mironchik
>> wrote:
On 20 April 2017 at 17:56, Igor Mironchik wrote:
>
>
> 20.04.2017 8:47, Ch'Gans пишет:
>
>> On 20 April 2017 at 17:03, Igor Mironchik
>> wrote:
>>>
>>> Hi,
>>>
>>>
>>> 20.04.2017 7:52, Ch'Gans пишет:
On 20 April 2017 at 16:38, Igor
20.04.2017 8:47, Ch'Gans пишет:
On 20 April 2017 at 17:03, Igor Mironchik wrote:
Hi,
20.04.2017 7:52, Ch'Gans пишет:
On 20 April 2017 at 16:38, Igor Mironchik
wrote:
Hi,
What the benefits of qobject_cast<> on simple static_cast<>? Or
On quarta-feira, 19 de abril de 2017 21:38:46 PDT Igor Mironchik wrote:
> Hi,
>
> What the benefits of qobject_cast<> on simple static_cast<>? Or there is
> no one?
qobject_cast checks, static_cast doesn't.
--
Thiago Macieira - thiago.macieira (AT) intel.com
Software Architect - Intel Open
On 20 April 2017 at 17:03, Igor Mironchik wrote:
> Hi,
>
>
> 20.04.2017 7:52, Ch'Gans пишет:
>>
>> On 20 April 2017 at 16:38, Igor Mironchik
>> wrote:
>>>
>>> Hi,
>>>
>>> What the benefits of qobject_cast<> on simple static_cast<>? Or there is
Hi,
20.04.2017 7:52, Ch'Gans пишет:
On 20 April 2017 at 16:38, Igor Mironchik wrote:
Hi,
What the benefits of qobject_cast<> on simple static_cast<>? Or there is no
qobject_cast
- works only on QObject (obviously)
- returns nullptr if the object cannot be casted
On 20 April 2017 at 16:38, Igor Mironchik wrote:
> Hi,
>
> What the benefits of qobject_cast<> on simple static_cast<>? Or there is no
qobject_cast
- works only on QObject (obviously)
- returns nullptr if the object cannot be casted to the required type
- doesn't relies
Hi,
What the benefits of qobject_cast<> on simple static_cast<>? Or there is
no one?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
Thank you! That was the reason.
On 1/27/2017 11:32 PM, Konstantin Shegunov wrote:
Have you exported your class (and thus all its mata object
information) from said dll?
___
Interest mailing list
Interest@qt-project.org
Have you exported your class (and thus all its mata object information)
from said dll?
___
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
it seems the problem is that class instance is created in one DLL while
qobject_cast is called for this instance in another DLL...
can this be the reason?
what can be done then?
On 1/27/2017 11:24 PM, Alexander Dyagilev wrote:
Hello,
got one yet another qt bug(?)
Hello,
got one yet another qt bug(?)
qobject_cast returns 0
dynamic_cast works fine.
MyClass is derived from a base class derived from QObject.
Q_OBJECT macro is present...
___
Interest mailing list
Interest@qt-project.org
On sexta-feira, 9 de agosto de 2013 17:47:12, Jan Kundrát wrote:
Hi, it looks that I cannot use qobject_cast in the following scenario:
0) Everything is built with -fPIC
1) class Foo: public QObject is defined in a *static* library libCommon
Let me stop here. Before reading the rest, I can
28 matches
Mail list logo