Skip to content
  • 0 Votes
    26 Posts
    519 Views
    A

    @jsulm it worked, thanks

  • 0 Votes
    4 Posts
    179 Views
    Christian EhrlicherC

    @Jammin44fm said in QMetaMethod::tag() problem:

    It lists 6.0.0 as an affected version, but nothing more recent

    Then its not yet fixed. If there is no minimal reproducer you can add one.

  • 0 Votes
    2 Posts
    79 Views
    J

    @Jammin44fm

    It seems the solution was to use;
    qRegisterMetaType<JSValue>("JSValue");

    Earlier in the code to register JSValue as a meta Type.
    I had already tried this, but was missing the string "JSValue" from the call.
    So it seems that both the type and the string are required.

    All good working now,
    Hopefully it will all work in 6.5 too, as it seems Qt has removed the string variant from the SDK.

  • 0 Votes
    3 Posts
    402 Views
    M

    @jsulm said in QJSEngine crashes when used in multithreading program:

    @mdma2 said in QJSEngine crashes when used in multithreading program:

    I've found a bugreport that is similar to my problem

    Did you read the comments there? Especially this one: "You have to create the engine in the same thread as the one where you are using it. And you cannot create your function in one thread and call it in a different one.".
    You can't make it thread safe without changing its implementation. Is there a reason why you wantr to use it from different threads?

    Yeah, there's need of evaluating JS code and accessing a QJSEngine object from different threads because of my program specificity. However there should be workaround to make it possible, like switching to the engine's thread before accessing to QJSEngine object. All I have found is using signal/slot system or QMetaObject:: invokeMethod (the last one is provided in the bugreport) to do that, but none of them work at the test code, I don't know why.

  • 0 Votes
    13 Posts
    1k Views
    C

    @JKSH Not applicable because I have other event sink classes.
    Also, I use the SLOT string because (for the sake of keeping this post clear, I didn't demonstrate that) I have file-open scenarios too: void OnSingleSelect(const QString &file) and void OnMultiSelect(const QStringList &files). They don't share signatures, so either I need to template-ize (which doesn't work well w/ signals&slots), or to repeat and tweak the helper function.
    Wait: will selectedFilter trigger setDefaultSuffix along with selectNameFilter? Didn't find evidence in the source tree.
    Also again: Linux Qt 5.6.1, selectedFilter doesn't setDefaultSuffix. Call chain according to https://code.qt.io/cgit/qt/qtbase.git/plain/src/widgets/dialogs/qfiledialog.cpp :
    QFileDialog::getSaveFileName -> QFileDialog::getSaveFileUrl -> QFileDialog::selectNameFilter -> QFileDialogPrivate::_q_useNameFilter, which doesn't seem to be doing the work (at least, in my case) after the user clicked OK.

  • 0 Votes
    3 Posts
    182 Views
    M

    @jsulm Sorry, it's my fault.
    I write wrong parameters at lamda function :(;;;

  • 0 Votes
    4 Posts
    693 Views
    S

    We have a little more information regarding our problem.

    When using Visual GDB to create a new QT project for Raspberry PI, if the toolchain folder ‘C:\SysGCC\raspberry\Qt\v5-CMake’ doesn’t exist or is empty, the QT build tools are automatically downloaded and installed. The problem we are seeing is that the build tools end up being a different version (Qt v5.15.2) than what is being used on our target Raspberry Pi platform (Qt v5.12.3). This results in the following error produced by the moc compiler indicating that its attempting to compile using the much newer header libraries.

    LinuxProject1_autogen/EWIEGA46WW/moc_MainWindow.cpp:80:18: error: 'QMetaObject::SuperData' has not been declared QMetaObject::SuperData::link<QMainWindow::staticMetaObject>(), ^~~~~~~~~

    LinuxProject1_autogen/EWIEGA46WW/moc_MainWindow.cpp:80:65: error: expected primary-expression before ')' token
    QMetaObject::SuperData::linkQMainWindow::staticMetaObject(),

    Is there anything we can set in Visual Studio or elsewhere that will insure the downloaded Qt build tools match the Qt version on the target board?

    This is our development environment

    Windows 10
    Visual Studio 2017
    Qt Visual Studio Tools Version 2.8.1.6
    Visual GDB 5.6R2
    Qt build tools vers 5.12.3

    And we are targetting Raspberry PI OS vresion Raspbian 10.

    We are working around this problem by manually copying the odler set of build tools into ‘C:\SysGCC\raspberry\Qt\v5-CMake’ before making a new project using VisualGDB. We were fortunate that we had an older set of Qt build tools on another development PC to copy these from. This is not a good long term solution for us.

  • 0 Votes
    1 Posts
    142 Views
    No one has replied
  • 0 Votes
    3 Posts
    729 Views
    R

    @JKSH Thanks for the reply. I was actually hoping to list the QMetaObject's properties on QML, in a dynamic way. Is it possible?

  • 0 Votes
    2 Posts
    123 Views
    R

    One more example:

    #include <QCoreApplication> #include <iostream> #include <QMetaObject> #include "example.h" #include <QDebug> #include <QMetaProperty> #include <QPointer> void gadgetExplorer(void *ptr, const char* s) { //Receives Player and access its meta-object int typeId = QMetaType::type(s); const QMetaObject *mo = QMetaType::metaObjectForType(typeId); qInfo() << "Q_GADGET: " << mo->className(); QMetaProperty mp; for(int i = 1; i < mo->propertyCount(); i++) { mp = mo->property(i); qInfo() << "Q_PROPERTY: " << mp.typeName() << "Value: " << mp.readOnGadget(ptr); if(int(mp.type()) == 1024) gadgetExplorer(ptr, mp.typeName()); } } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); qRegisterMetaType<Player>(); qRegisterMetaType<P2D>(); qRegisterMetaType<P2D*>(); Player p1; p1.setSpeed(30); p1.p2d = new P2D(); p1.p2d->setX(10.0); p1.p2d->setY(25.0); gadgetExplorer(&p1, "Player"); return a.exec(); }

    gadgetExplorer() works fine for the first Q_GADGET, but for the second one the read property doesn't work. Is it possible to access the second's Q_GADGET pointer?

  • 0 Votes
    3 Posts
    237 Views
    JKSHJ

    @raphasauer said in Is it possible to read a Q_PROPERTY with a QMetaObject pointer only?:

    I only have a QMetaObject of the gadget.

    To add to @kshegunov's post: All instances of your QGadget share the same QMetaObject. You can check this yourself:

    Player p1; Player p2; qDebug() << "Are they the same?" << (&p1.staticMetaObject == &p2.staticMetaObject)

    See also:

    https://doc.qt.io/qt-5/qobject.html#staticMetaObject-var (this is written for QObjects but it also applies to QGadgets) https://doc.qt.io/qt-5/qobject.html#Q_GADGET
  • 0 Votes
    8 Posts
    964 Views
    jsulmJ

    @Dariusz If you check the PySide documentation you will see that there is no overload taking a lambda or any function/method. There are only overloads accepting strings containing method name. So, it seems not possible with PySide.
    But instead of using QApplication instance you could create your own class with methods you want to call using invokeMethod.

  • 0 Votes
    3 Posts
    429 Views
    SGaistS

    Hi,

    AFAIR, you need to add QT += core-private to your .pro file.

  • 0 Votes
    14 Posts
    2k Views
    S

    @Christian-Ehrlicher Thank You!

  • 0 Votes
    8 Posts
    1k Views
    dheerendraD

    @Yash001 You can three classes & inheritance mechanism as you mentioned. I'm keeping aside the topic of why not to inherit from QThread.

  • 0 Votes
    2 Posts
    2k Views
    gde23G

    Found the error myself.
    In the include dir there still was the file vtkGUISupportQtModule.h from the vtk-build included which defines

    VTKGUISUPPORTQT_EXPORT __declspec(dllexport)

    now its working

  • 0 Votes
    8 Posts
    3k Views
    J

    @SGaist said in Crashing when using QJSValue call:

    Did you check whether your application has a leak ?

    Yes, i have tested it for leaks. Does not seem to be the case.

    Is QJSValue.call to be used externally?

  • 0 Votes
    2 Posts
    1k Views
    ?

    Hi, and welcome to the Qt forum!

    Looks like a bug to me. I think you should talk to the developers on the interest mailing list.

    Cheers!

  • 0 Votes
    2 Posts
    1k Views
    kshegunovK

    @Jakob
    Switch the order of the construction of objects. When the parent's destructor runs it'll try to free its children, but since you've created it after the child (hence its destructor will be called first), it will try to delete a stack object.

  • 0 Votes
    9 Posts
    5k Views
    W

    @Chris-Kawa Thanks for the information provided. Then I need to re-design my implementation accordingly to this limitation.