QObject::connect: Cannot queue arguments of type 'QTextCharFormat'
-
Hello,
I am trying to do this:
@QString program = QString::fromUtf8("../helper-functions/Perl/DiscoverNodes");
QProcess *myprocess = new QProcess(this);qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); qRegisterMetaType<QTextCursor>("QTextCursor"); myprocess->startDetached(program.toStdString().c_str()); //myprocess->start(program); myprocess->waitForFinished();@
However, I get a segfault here:
@[qstring.h, line 417]:
// ASCII compatibility
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) : d(fromAscii_helper(ch))
{}@I have been struggling with it for days now. Also, I do not understand why standard datatypes (such as QTextCharFormat, QTextCursor ) need to be registered. Without registration, I am getting these errors:
@Starting /home/Morpheus/Documents/Temp/QTCustom/QDAL_Release/QDAL...
QObject::connect: Cannot queue arguments of type 'QTextCharFormat'
(Make sure 'QTextCharFormat' is registered using qRegisterMetaType().)
QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
The program has unexpectedly finished.
/home/Morpheus/Documents/Temp/QTCustom/QDAL_Release/QDAL exited with code 0@I would really appreciate any help. I have taken hints from here: "Nokia Dev":http://harmattan-dev.nokia.com/docs/library/html/qt4/qprocess.html
Thanks.
Devendra Rai.
-
Those types cannot be registered by default because they are not in QtCore. See the discussion in QVariant and QMetaType detailed descriptions.
Which line of your code actually triggered to "segfault"; line 7?
Have you done complete, clean rebuild of you project? -
[quote author="Devendra" date="1357153801"]
@
QString program = QString::fromUtf8("../helper-functions/Perl/DiscoverNodes");
...myprocess->startDetached(program.toStdString().c_str());
@
[/quote]
QProcess::startDetached() already takes a QString as parameter. Is there any particular reason you are converting it to a std::string and const char * (just to have it implicitly converted back to QString)? -
Hello ChrisW67 and Lukas
First, I changed to:
@
QString program = "../helper-functions/Perl/DiscoverNodes";
QProcess *myprocess = new QProcess(this);qRegisterMetaType<QTextCharFormat>("QTextCharFormat"); qRegisterMetaType<QTextCursor>("QTextCursor"); //myprocess->startDetached(program.toStdString().c_str()); myprocess->start(program);@
Next, about segfault:
I did a core dump, and here is the info:
#0 0x00007f4eb7f04525 in QTextLayout::createLine() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#1 0x00007f4eb7f3976a in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#2 0x00007f4eb7f413a0 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#3 0x00007f4eb7f3fef1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#4 0x00007f4eb7f4040f in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#5 0x00007f4eb7f42741 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#6 0x00007f4eb7f436c9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#7 0x00007f4eb7f23284 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#8 0x00007f4eb7ee443d in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#9 0x00007f4eb81080d2 in QTextEdit::append(QString const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x0000000000405640 in publish_to_Browser (TB=0x224c5e0, messagetype=3 '\003', message=...) at ../QDAL/PublishtoBrowser.cpp:35
#11 0x00000000004052d0 in Populate_Browser_WithData (file=..., thisObject=0x7fff0be41460, resourcetype=2 '\002') at ../QDAL/class_discovernodes.cpp:117
#12 0x00000000004050ca in class_discoverNodes::run (this=0x7fff0be41460) at ../QDAL/class_discovernodes.cpp:61
#13 0x00007f4eb767baec in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#14 0x00007f4eb68d7e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#15 0x00007f4eb6e1acbd in clone () from /lib/x86_64-linux-gnu/libc.so.6
#16 0x0000000000000000 in ?? ()I suspect something is wrong with QTextBrowser instance. I still cannot figure out what. If anyone is interested, I can make the project available.
Thanks!
Devendra