Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
19.8k Topics 76.6k Posts
  • 0 Votes
    6 Posts
    596 Views
    N

    hello, i wonder why toVariant() dont work for me,toVariant xxx is not a function

  • Icon image does not display correctly on QML button

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    Q

    where the explonation....?

  • 0 Votes
    10 Posts
    6k Views
    Q

    @p3c0 nice job!

  • 2-d Histogram

    Unsolved
    2
    0 Votes
    2 Posts
    168 Views
    SGaistS

    Hi and welcome to devnet,

    You might want to check the new Qt Graphs module.

    Hope it helps

  • sending signal from inline Component?

    Solved
    4
    0 Votes
    4 Posts
    204 Views
    A

    Although you used a different solution, I think doing the following should work:

    Connections { target: myLoader.item function onTextFieldClicked(yValue, itemHeight) {...} }
  • Hi guys I need help

    Unsolved
    2
    0 Votes
    2 Posts
    141 Views
    No one has replied
  • QQmlApplicationEngine failed to load component

    Unsolved
    3
    0 Votes
    3 Posts
    173 Views
    B

    My bad, here's the tree project :

    appTestQML/
    ├── CMakeLists.txt
    ├── Main.qml
    ├── resources.qrc
    ├── backend.cpp
    ├── backend.h
    └── main.cpp

  • QtChart: Single Axis-X with multiple Axis-Y

    Unsolved
    3
    0 Votes
    3 Posts
    201 Views
    T

    @Bob64 Thanks for your hint!
    I'm trying this way...

  • class member is changed by who????

    Unsolved
    5
    0 Votes
    5 Posts
    189 Views
    Q

    @SGaist
    I restart the computer, delete all obj file and rebuild , now it runs fine.
    stupid microsoft -_-

  • can u help me with these problems?

    Unsolved
    4
    0 Votes
    4 Posts
    156 Views
    Axel SpoerlA

    …please don’t post images of text. Post your code directly instead and use the </> code tags to mark it correctly.

  • ListView drag and drop Elements

    Solved
    2
    0 Votes
    2 Posts
    141 Views
    J

    Hi, I have fixed it now.
    Calling the wrapper function for the moveRows() in the DropArea does the job.
    Initially I tried to call it wrongly (mode.moveItNow() does not work because I think the model in here is the QAbstractListModel object and not my upper class which inherits from QAbstractListModel.
    So all the meme related function are not even necessary...

    so I replaced the model.moveItNow() with rootStore.pathToProperty.MyCustomModel.moveItNow()

    I hope that explains it for those who will end up with a similar problem/question

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    12 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    16 Views
    No one has replied
  • 0 Votes
    6 Posts
    287 Views
    SGaistS

    Would it be possible to have a picture of what you are getting and what you are expecting to get ?

  • Ways to make qml design responsive

    Unsolved
    3
    0 Votes
    3 Posts
    219 Views
    A

    Hi, perhaps someone more experienced can give a more authoritative answer.

    I would swear that bridge plugins are for when you are making layouts with a pre-set window size. Say a car or an embedded device. For all other applications, e.g. desktop / mobile i use:

    QtQuick.Layouts jugando con el Layout.MaximumWidth/Height and Layout.MinimumWidth/Height. For FontSize you can find the way that matches your style by searching here "Theme.qml" or "Style.qml" -> SourceGraph

    Doc ref: Qt Scalability Page

  • qtquick module not recognized

    Unsolved
    2
    0 Votes
    2 Posts
    139 Views
    SGaistS

    Hi and welcome to devnet,

    You looking for qt6-declarative-dev.

  • Automation IDs in QML

    Solved
    2
    0 Votes
    2 Posts
    134 Views
    A

    Found the answer to this question myself: It is by setting the objectName property:

    Control { objectName: "myAutomationId" }

    This will result in a Group automation element with automation ID myAutomationId.

    Found this by looking at https://github.com/faaxm/spix/blob/master/examples/RemoteCtrl/main.qml

  • Cannot edit QML files in Qt Creator

    Solved
    3
    0 Votes
    3 Posts
    160 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
    429 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(); }

    5dffe8ce-ee5f-4e99-80f6-b04c75f14e34-image.png
    fd48d1a7-e90b-4b61-a276-c6e7bf0d29b2-image.png

  • QML Qt.6.8.0beta2

    Unsolved
    4
    3 Votes
    4 Posts
    343 Views
    J

    I resolved this problem by clean install new built qt 6.8