Skip to content
  • Hi all

    Unsolved Game Development
    10
    0 Votes
    10 Posts
    773 Views
    BondrusiekB

    @Joshika_Namani Which version of Qt do you use? I think that using Qt6 is a better option but here is a doc for Qt5 https://doc.qt.io/qt-5/qopenglwidget.html if you want to see.

  • 0 Votes
    12 Posts
    692 Views
    S

    Would i be viable to use qt widgets and just use qtquick for all the other widgets embedded into the qt widgets mainwindow or is this a bad idea?

  • 0 Votes
    3 Posts
    247 Views
    C

    Thanks for your reply.
    One thing to note is that if I hadn't turned on the virtual keyboard on MacOS, this Dialog destruction wouldn't have caused the program to crash.

  • 0 Votes
    2 Posts
    606 Views
    I

    I've found a solution, albeit with a small bit of help from ChatGPT as a last resort. I used an if/else statement (in the form of a ternary operator) for my main.qml and added an additional @Slot() decorator for the LED off function in my main,py.
    .
    .
    ↓ main.qml ↓

    import QtQuick import QtQuick.Controls ApplicationWindow { width: 1920 height: 1080 visible: true // Bool property to hold the button state property bool buttonState: false // Function to toggle the LEDs function toggleLEDs() { buttonState ? controlPanel.buttonOff() : controlPanel.buttonOn(); buttonState = !buttonState; } Image { id: allLights source: "images/power_" + (buttonState ? "on" : "off") + ".png" anchors.centerIn: parent MouseArea { anchors.fill: parent onClicked: { toggleLEDs(); } } } }

    .
    .
    ↓ main,py ↓

    import sys from pathlib import Path from led import grid, all_lights_on, all_lights_off from PySide6.QtCore import QObject, Slot from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine class ControlPanel(QObject): def __init__(self): super().__init__() @Slot() def buttonOn(self): all_lights_on(grid) @Slot() def buttonOff(self): all_lights_off(grid) if __name__ == '__main__': app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() controlPanel = ControlPanel() engine.rootContext().setContextProperty("controlPanel", controlPanel) qml_file = Path(__file__).parent / 'main.qml' engine.load(qml_file) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec())
  • 0 Votes
    8 Posts
    1k Views
    JoeCFDJ

    @Tiny-Leaf
    Try the following code. The length of three segments should be same.

    drawLine(ctx, 50, 50, 150, 50); drawLine(ctx, 150, 50, 50, 50); drawLine(ctx, 150, 100, 50, 100); function drawLine(ctx, x1, y1, x2, y2) { ctx.beginPath() ctx.moveTo(x1, y1) ctx.lineTo(x2, y2) ctx.stroke() }

    BTW: you may somehow avoid to draw a line twice if possible. It is not efficient.

  • 0 Votes
    3 Posts
    2k Views
    QjayQ

    @JoeCFD QML file code below. I haven't edited it at all.

    QT += quick CONFIG += c++11 # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Refer to the documentation for the # deprecated API to know how to port your code away from it. DEFINES += QT_DEPRECATED_WARNINGS # You can also make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
  • 0 Votes
    3 Posts
    616 Views
    P

    For anyone coming across this thread, the answer is...

    tl;dr: You need to add the runFullTrust capability.

    With Qt 5, there was support for UWP apps. This made it possible for Windows apps to be delivered through the Microsoft Store. (This is how my app was built and delivered.)

    Then Microsoft opened up the Microsoft Store for Win32 apps too; i.e. standard desktop apps. As a developer you have a choice of either packaging your own installer and delivering that through the Microsoft Store, or just your app, letting Microsoft Store handle installation. The latter option behaves more like the handling of a UWP app and Microsoft handles the code-signing certificate for you.

    As a consequence, Qt decided to drop support for UWP as of Qt 6. This was done with no public notification to the Qt community 🤬, with just a message on the Qt development mailing list. I eventually found this out via a convoluted bug report.

    What Qt themselves did not realise is that if you submit a Win32 app via the Microsoft Store, because it is a desktop app and does not sit nicely in a sandbox like a UWP app, you need to add the runFullTrust capability. If you don't do this, you get the weird behaviour of the application window opening in a separate window described above.

    However be aware that when you add runFullTrust Microsoft will require you to justify why your app needs access to the whole Windows system. I was able to pass certification with a message along the lines of "My app is built with the Qt framework that only generates Win32 apps. My app does not operate outside the sandbox and behaves nicely."

    One more gotcha if you're going this route. The path QStandardPaths::AppDataLocation was different for UWP apps than Win32 apps. The following only applies if you had a UWP app in Qt 5 and stored data there as the path will be wrong for your Win32 app in Qt 6. To fix this, I use the following: https://gist.github.com/paulmasri/75dcd3386a4e8eaf705058240ef547d1

  • 0 Votes
    1 Posts
    230 Views
    No one has replied
  • 2 Votes
    3 Posts
    562 Views
    A

    UPDATE: This is a known bug in Qt https://bugreports.qt.io/browse/QTBUG-113616

  • 0 Votes
    2 Posts
    515 Views
    H

    Also here is the stacktrace if it helps:

    0 ??? 0x10a1029a8 ??? 1 <translation info unavailable> 0x10c7d5e24 ??? 2 libsystem_pthread.dylib 0x115b91ee6 pthread_kill + 263 3 libsystem_c.dylib 0x114e06e58 abort + 130 4 test5 0x104c96839 qAbort() + 9 (qglobal.cpp:161) 5 test5 0x104c9b6b8 qt_message_fatal(QtMsgType, QMessageLogContext const&, QString const&) + 24 (qlogging.cpp:2048) 6 test5 0x10510d7b6 QMessageLogger::fatal(char const*, ...) const + 246 (qlogging.cpp:934) 7 test5 0x10510d08a qt_assert(char const*, char const*, int) + 74 (qassert.cpp:68) 8 test5 0x1041c7e45 QGles2TextureRenderTarget::create() + 981 (qrhigles2.cpp:5462) 9 test5 0x103580e82 QQuickWidget::createFramebufferObject() + 1890 (qquickwidget.cpp:1137) 10 test5 0x103585ad1 QQuickWidget::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 225 (moc_qquickwidget.cpp:295) 11 test5 0x104da0579 void doActivate<false>(QObject*, int, void**) + 2313 (qobject.cpp:4004) 12 test5 0x104d9f039 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 121 (qobject.cpp:4052) 13 test5 0x103607465 QQuickWindow::sceneGraphInitialized() + 37 (moc_qquickwindow.cpp:829) 14 test5 0x10360665d QQuickWindow::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) + 109 (moc_qquickwindow.cpp:570) 15 test5 0x104da0579 void doActivate<false>(QObject*, int, void**) + 2313 (qobject.cpp:4004) 16 test5 0x104d9f039 QMetaObject::activate(QObject*, QMetaObject const*, int, void**) + 121 (qobject.cpp:4052) 17 test5 0x1036b52d2 QSGRenderContext::initialized() + 34 (moc_qsgcontext_p.cpp:289) 18 test5 0x1036c7b67 QSGDefaultRenderContext::initialize(QSGRenderContext::InitParams const*) + 295 (qsgdefaultrendercontext.cpp:57) 19 test5 0x1035f1a1a QQuickRenderControl::initialize() + 378 (qquickrendercontrol.cpp:309) 20 test5 0x1035806d3 QQuickWidgetPrivate::initializeWithRhi() + 867 (qquickwidget.cpp:1058) 21 test5 0x1035837aa QQuickWidget::resizeEvent(QResizeEvent*) + 474 (qquickwidget.cpp:1404) 22 test5 0x1038782cb QWidget::event(QEvent*) + 2683 (qwidget.cpp:9076) 23 test5 0x103584fb9 QQuickWidget::event(QEvent*) + 1321 (qquickwidget.cpp:1719) 24 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 25 test5 0x1037ee456 QApplication::notify(QObject*, QEvent*) + 11974 (qapplication.cpp:3231) 26 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 27 test5 0x104d22df3 QCoreApplication::sendEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1533) 28 test5 0x10386f721 QWidgetPrivate::sendPendingMoveAndResizeEvents(bool, bool) + 353 (qwidget.cpp:7944) 29 test5 0x103875ff0 QWidgetPrivate::show_helper() + 64 (qwidget.cpp:7995) 30 test5 0x10387707f QWidgetPrivate::setVisible(bool) + 943 (qwidget.cpp:8344) 31 test5 0x103876cc0 QWidget::setVisible(bool) + 144 (qwidget.cpp:8276) 32 test5 0x10386871e QWidget::showMaximized() + 126 (qwidget.cpp:3057) 33 test5 0x103875e94 QWidget::show() + 100 (qwidget.cpp:7900) 34 test5 0x102e70702 MyOpenGLWidget::mousePressEvent(QMouseEvent*) + 82 (main.cpp:16) 35 test5 0x103877a73 QWidget::event(QEvent*) + 547 (qwidget.cpp:8902) 36 test5 0x1037ac198 QOpenGLWidget::event(QEvent*) + 712 (qopenglwidget.cpp:1698) 37 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 38 test5 0x1037ec11c QApplication::notify(QObject*, QEvent*) + 2956 (qapplication.cpp:2772) 39 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 40 test5 0x104d22e83 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1547) 41 test5 0x1037eabd0 QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) + 1216 (qapplication.cpp:2356) 42 test5 0x1038a44a5 QWidgetWindow::handleMouseEvent(QMouseEvent*) + 4485 (qwidgetwindow.cpp:623) 43 test5 0x1038a2849 QWidgetWindow::event(QEvent*) + 361 (qwidgetwindow.cpp:241) 44 test5 0x1037ea0ba QApplicationPrivate::notify_helper(QObject*, QEvent*) + 458 (qapplication.cpp:3284) 45 test5 0x1037ee474 QApplication::notify(QObject*, QEvent*) + 12004 (qapplication.cpp:3235) 46 test5 0x104d2212a QCoreApplication::notifyInternal2(QObject*, QEvent*) + 282 (qcoreapplication.cpp:1115) 47 test5 0x104d22e83 QCoreApplication::sendSpontaneousEvent(QObject*, QEvent*) + 131 (qcoreapplication.cpp:1547) 48 test5 0x103e0f2b0 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 2384 (qguiapplication.cpp:2277) 49 test5 0x103e0ec51 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) + 753 (qguiapplication.cpp:2187) 50 test5 0x103e110b4 QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::TouchEvent*) + 5412 (qguiapplication.cpp:3081) 51 test5 0x103e0e2de QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) + 110 (qguiapplication.cpp:2035) 52 test5 0x103e74a5e QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 190 (qwindowsysteminterface.cpp:1094) 53 test5 0x102e7af11 QIOSEventDispatcher::processPostedEvents() + 545 (qioseventdispatcher.mm:443) 54 test5 0x104f9bf3b RunLoopSource<QEventDispatcherCoreFoundation>::process(void*) + 107 (qeventdispatcher_cf_p.h:111) 55 CoreFoundation 0x113e56b8f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 56 CoreFoundation 0x113e56ad1 __CFRunLoopDoSource0 + 157 57 CoreFoundation 0x113e5632b __CFRunLoopDoSources0 + 311 58 CoreFoundation 0x113e509ba __CFRunLoopRun + 889 59 CoreFoundation 0x113e50264 CFRunLoopRunSpecific + 560 60 GraphicsServices 0x1225e324e GSEventRunModal + 139 61 UIKitCore 0x13abc47bf -[UIApplication _run] + 994 62 UIKitCore 0x13abc95de UIApplicationMain + 123 63 test5 0x102e79161 qt_main_wrapper + 705 (qioseventdispatcher.mm:206) 64 dyld_sim 0x112701384 start_sim + 10 65 dyld 0x20a3db41f start + 1903
  • 0 Votes
    2 Posts
    274 Views
    SGaistS

    Hi,

    Please don't post the exact same question in multiple sub-forum. One is enough. When needed, it can be moved.

    Closing this one as duplicate from this thread since it's in the correct sub-forum.

  • 0 Votes
    3 Posts
    447 Views
    2

    Thanks for the information. I did not realize that all dependencies are build into the application on static builds and therefore the deploy-script is not needed anymore. I got the script to run with my normal (dynamically linked) version of Qt and now I get my deployable this way. Thanks again for the help.

  • 0 Votes
    3 Posts
    471 Views
    E

    @JonB that answer is from 5 years ago, I had read it but had hopes something had changed.

    So the answer is still NO.

  • 1 Votes
    2 Posts
    554 Views
    O

    @sethsource same with HLS

  • 0 Votes
    3 Posts
    965 Views
    B

    It's the same with me...

  • 0 Votes
    1 Posts
    274 Views
    No one has replied
  • 1 Votes
    18 Posts
    2k Views
    Marko StankeM

    Tried it on Qt 5.15, and it works perfectly

  • 0 Votes
    3 Posts
    559 Views
    GrecKoG

    You don't.

    C++ shouldn't connect to QML signals.

    Expose a slot/invokable function in a Python object that is accessible from QML and call that slot in QML.

  • 0 Votes
    1 Posts
    373 Views
    No one has replied