Get QObject from pointer address
Probably I coded some invalid styleSheets in my project but now it is so big that is impossible to finde where.
The console throws this:
"Warning: Could not parse stylesheet of object 0xdb8858010 ((null):0, (null))"
I tried to create a widget where I type the address 0xdb8858010 and my wish is to get its name so I did:
Code:
void mProj::getWidgetName()
{
bool readedok;
qlonglong mempos = lnGetWidget->text().toLongLong(&readedok, 16);
if (readedok)
{
text
="Pos: "+QString::number(mempos
)+" ";
QWidget* qw
= reinterpret_cast<QWidget
*>
(qo
);
if (qw)
text += " name " + qw->objectName();
else
text += " cannot found qobject";
}
else
{
text="Cannot be read";
}
lbGetWidget->setText(text);
}
But I get a crash.
Any thought about this?
Thanks in advance.
Re: Get QObject from pointer address
You could use GammaRay or put a break point into qWarning() and check the stack trace.
Cheers,
_
Re: Get QObject from pointer address
How is lnGetWidget initialized ?