Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • Cannot edit QML files in Qt Creator

    Solved
    3
    0 Votes
    3 Posts
    256 Views
    A
    Thanks @sierdzio, if only! The solution for now is to open the QML file in Qt Design studio, available only from the Qt online installer on their website. I had missed the “open file” as opposed to “open project” button. Still weird, because as far as I can tell, Arch (I use arch, btw :) ) doesn’t have a repo for Design Studio, including in the AUR. And for sure, I had been editing QML files within Qt Creator before. Further, I have to open Design Studio from the command line, directly from the binary. But whatever, Design Studio totally suits my purpose here, so I’m happy (and ready to return to my backend lifestyle!). Will update if I figure out what I’m “really” doing wrong.
  • VTK not being recognized in QML

    Unsolved
    4
    0 Votes
    4 Posts
    668 Views
    M
    I have the same problem. My environment variables: VTK_DIR=C:/dev/github/VTK/build QML_IMPORT_PATH=C:/dev/github/VTK/build/lib/qml/Debug QT_DEBUG_PLUGINS=1 QML_IMPORT_TRACE=1 PATH=C:/dev/github/VTK/build/bin/Debug CMakeLists.txt cmake_minimum_required(VERSION 3.16) project(SphereView VERSION 0.1 LANGUAGES CXX) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(QML_IMPORT_PATH C:/dev/github/VTK/build/lib/qml/${CMAKE_BUILD_TYPE} CACHE STRING "" FORCE) find_package(VTK REQUIRED COMPONENTS GUISupportQtQuick ) find_package(Qt6 6.5 REQUIRED COMPONENTS Quick) qt_standard_project_setup(REQUIRES 6.5) qt_add_executable(appSphereView main.cpp ) qt_add_qml_module(appSphereView URI SphereView VERSION 1.0 QML_FILES Main.qml SOURCES vtkitem.h vtkitem.cpp ) # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # If you are developing for iOS or macOS you should consider setting an # explicit, fixed bundle identifier manually though. set_target_properties(appSphereView PROPERTIES # MACOSX_BUNDLE_GUI_IDENTIFIER com.example.appSphereView MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE TRUE WIN32_EXECUTABLE TRUE ) target_link_libraries(appSphereView PRIVATE Qt6::Quick ${VTK_LIBRARIES} ) include(GNUInstallDirs) install(TARGETS appSphereView BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) Main.qml import QtQuick 2.15 import QtQuick.Controls 2.15 import QtQuick.Window 2.15 import VTK 9.4 import com.example.sphereview 1.0 ApplicationWindow { visible: true width: 800 height: 600 title: qsTr("VTK Sphere App") color: palette.window SystemPalette { id: palette colorGroup: SystemPalette.Active } VTKRenderWindow { id: vtkwindow width: 800 height: 600 } VtkItem { objectName: "SphereView" anchors.fill: parent renderWindow: vtkwindow } } vtkitem.h // vtkitem.h #ifndef VTKITEM_H #define VTKITEM_H #include <QQuickVTKRenderItem.h> #include <vtkActor.h> #include <vtkPolyDataMapper.h> #include <vtkSphereSource.h> #include <vtkNew.h> class VtkItem : public QQuickVTKRenderItem { Q_OBJECT public: VtkItem(QQuickItem* parent = nullptr); private: vtkNew<vtkActor> actor; vtkNew<vtkPolyDataMapper> mapper; vtkNew<vtkSphereSource> sphere; }; #endif // VTKITEM_H vtkitem.cpp // vtkitem.cpp #include "vtkitem.h" VtkItem::VtkItem(QQuickItem* parent) : QQuickVTKRenderItem(parent) { sphere->SetRadius(5.0); mapper->SetInputConnection(sphere->GetOutputPort()); actor->SetMapper(mapper); renderer()->AddActor(actor); renderer()->ResetCamera(); renderer()->SetBackground(0.5, 0.5, 0.7); renderer()->SetBackground2(0.7, 0.7, 0.7); renderer()->SetGradientBackground(true); } main.cpp #include <QGuiApplication> #include <QQmlApplicationEngine> #include <vtkitem.h> int main(int argc, char *argv[]) { QQuickVTKRenderWindow::setupGraphicsBackend(); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; // Register the custom VTK item with QML qmlRegisterType<VtkItem>("com.example.sphereview", 1.0, 0, "VtkItem"); QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { QCoreApplication::exit(-1); }, Qt::QueuedConnection); engine.loadFromModule("SphereView", "Main"); return app.exec(); } [image: 7c21defc-8f39-44d9-bdcf-933b9d7282e0.png] [image: d150f0a1-6258-4c08-86af-0d3fb53f7b08.png]
  • QML Qt.6.8.0beta2

    Unsolved
    4
    3 Votes
    4 Posts
    471 Views
    J
    I resolved this problem by clean install new built qt 6.8
  • Application don` t exit (maybe it cause qfuture?)

    Unsolved
    6
    0 Votes
    6 Posts
    324 Views
    Q
    @jsulm you can’t cancel qfuture that was launched via qtconcurrent::run, I ended up doing without using a thread at all, I just did connectToHost in restoreConnection without waiting, connected onConnect for the socket and processed all the logic there
  • module "QtMultimedia" is not installed

    Solved
    22
    0 Votes
    22 Posts
    9k Views
    JoeCFDJ
    If you look at the code here, https://doc.qt.io/qt-6/qml-qtmultimedia-videooutput.html The video output is used for media player. Where is your player? How do you code your player? property "source" does not exist in VideoOutput from https://doc.qt.io/qt-6/qml-qtmultimedia-videooutput-members.html
  • Qt new CMake API + qmllint + qt_add_qml_module - how to setup

    Unsolved
    1
    0 Votes
    1 Posts
    355 Views
    No one has replied
  • Ambiguous type detected. PdfStyle 6.0 is defined multiple times. [import]

    Unsolved
    7
    0 Votes
    7 Posts
    512 Views
    A
    @jsulm Oh, okay, thank you for your help. We can close this thread and mark it as solved.
  • Mnemonics in translated text

    Unsolved
    1
    0 Votes
    1 Posts
    94 Views
    No one has replied
  • textEdited signal for TextArea/TextEdit

    Unsolved
    5
    0 Votes
    5 Posts
    700 Views
    dheerendraD
    Bug is here https://bugreports.qt.io/browse/QTBUG-103718 Fix is also under progress.
  • Memory leak when modifying a model of a MapItemView

    Unsolved qtpo qml mapitemview memory leak
    2
    0 Votes
    2 Posts
    385 Views
    Y
    I have encountered a similar problem, which has not been resolved. However, your example does not illustrate this issue.I test the example ,when myModel = newModel,print myModel.length =0
  • 0 Votes
    1 Posts
    123 Views
    No one has replied
  • Pickable model with QQuick3DGeometry

    Unsolved
    2
    1 Votes
    2 Posts
    273 Views
    B
    I have the same question. Did you ever figure out if Picking works with custom geometry? Thanks.
  • QML canvas.save() or Item grabToImage() create a png file with transparent background

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    V
    Canvas { id: canvas anchors { fill : parent } // antialiasing: true onPaint: { var ctx = canvas.getContext("2d") ctx.fillStyle = "white" ctx.fillRect(0, 0, canvas.width, canvas.height) } } // Adding a fillStyle might help !!!!
  • Controls.Windows dark mode

    Unsolved
    1
    0 Votes
    1 Posts
    205 Views
    No one has replied
  • Load the QML plugin automatically when application starts

    Unsolved
    3
    0 Votes
    3 Posts
    296 Views
    dheerendraD
    Thank you @Axel-Spoerl. QML file(MyPthinkSMain.qml) to load is present in the plugin itself. Code snippet QPluginLoader loader("/Users/dheeru/libs/India/Bengaluruu/PthinkS/QtExperts/libPthinkSUtilplugin.dylib"); loader.load(); const QUrl urlu"qrc:/India/Bengaluruu/PthinkS/QtExperts/MyPthinkSMain.qml"_qs); engine.load(url); The file qrc:/India/Bengaluruu/PthinkS/QtExperts/MyPthinkSMain.qml comes from the plugin libPthinkSUtilplugin.dylib itself. If I comment loader.load(), application does not show up window. As I understand plugin will be loaded once engine see the import statement in qml. Hope this is what you are describing. In my use case qml file itself comes from the plugin built using qt_add_qml_module.
  • UNSELECTED WHEN CLICK OUTSIDE A MOUSEAREA

    Unsolved
    1
    0 Votes
    1 Posts
    103 Views
    No one has replied
  • Question about pacthing functionalities to Qt

    Solved
    4
    0 Votes
    4 Posts
    248 Views
    SGaistS
    Good Then please make the thread as solved so other forum users may know a solution has been found :-)
  • Question About resource reference qml file from plugin dll

    Unsolved
    6
    0 Votes
    6 Posts
    511 Views
    dheerendraD
    @michael_su Finally solved this. Let me know if you need help.
  • QML FileDialog size

    Unsolved
    4
    0 Votes
    4 Posts
    319 Views
    K
    Some more info. I use kiosk-shell mode for weston (I need use one app in full screen mode). When I change it to desktop-shell, dialog size is normal, but I see maximize, minimize and close buttons for app.
  • How is child property of type Item binded to parent?

    Unsolved
    1
    0 Votes
    1 Posts
    107 Views
    No one has replied