Trying to construct an instance of an invalid type, type id: 145
-
Hi,
I am getting these messages as warnings in my Desktop Application using Qt 5:
Trying to construct an instance of an invalid type, type id: 145
Trying to construct an instance of an invalid type, type id: 145
Trying to construct an instance of an invalid type, type id: 145
Trying to construct an instance of an invalid type, type id: 145The gui runs fine. Its just that I get these warnings. What could be wrong?
Thanks :)
-
Could you please provide the source code which generates this warning? I guess that you might be using QVariant in an appropriate way.
-
Thank you for your reply!
QVariant is being used in many places in the code actually. So What do you mean by using QVariant unappropriately? I can search for all existing QVariants, but how to see if its used correctly. Do you have any idea about the significance of "145" id, that its generating.
-
Hi,
Did you:
- declared your type with Q_DECLARE_METATYPE ?
- call qRegisterMetaTypeStreamOperators and implement both stream operators ?
-
Yes I have. Declared my new type with Q_DECLARE_METATYPE and used qRegisterMetaTypeStreamOperators
-
I tried to debug, seems its happening with a QTreeView. My code is below
@
QAction *show_user_action = QAction("User");
show_user_action->setCheckable(true);
show_user_action->setChecked(show_user); connect(show_user_action,SIGNAL(triggered(bool)),
m_directory_view,SLOT(show_column(bool)));
@On Calling:
show_user_action->trigger();
those warnings are displayed.the slot code is:
@
show_column(bool show) {QAction *action = qobject_cast< QAction *>(QObject::sender());
QString action_name = action->get_name();
m_filter_model->set_column_visible(action_name,show);
m_directory_view->header()->resizeSections(QHeaderView::ResizeToContents);
}
@The last line m_directory_view->header()->resizeSections(QHeaderView::ResizeToContents); generates the warning.
Any clue here?
[edit: added missing coding tags @ SGaist]
-
Well… It looks unrelated.
Do you have any QVariant stuff in your code ? QSettings ?
-
Well, I added a breakpoint at m_directory_view->header()->resizeSections(QHeaderView::ResizeToContents);
and once it is executed it generates that warning. Its strange though.
But I use both QVariant and QSettings. Actually line 3 at the above code:
show_user_action->setChecked(show_user); <- show_user is a QVariant stored in QSettings.What can I check for here?
-
Are you storing one of your custom class in QSettings ?