Skip to content
QtWS25 Last Chance
  • How to support Vulkan with QML?

    Unsolved QML and Qt Quick vulkan qml c++ shader
    2
    0 Votes
    2 Posts
    158 Views
    SGaistS
    Hi, Are you looking for something like the Vulkan under QML example ?
  • 0 Votes
    2 Posts
    385 Views
    QjayQ
    hey solved using installing following qml packages too sudo apt install qml-module-qtquick-extras qml-module-qtquick-controls
  • 1 Votes
    3 Posts
    600 Views
    F
    @jsulm thanks! I just added target_include_directories(<appName> PUBLIC src) what works well.
  • 0 Votes
    2 Posts
    412 Views
    bibasmallB
    As I understand it, the child should receive the event before the parent, but in my case, the child is deaf. I thought maybe the problem was the size of the child, so I set it equal to the parent size, but it didn't help. I can call mousePressEvent(e) directly for the child in the parent's overload, but it looks like a very bad design. UPD: currentPrimitive_->setKeepMouseGrab(true); allows to pass the event to the child without ugly direct call of mousePressEvent(e) .
  • Ripple effect on material style

    Unsolved QML and Qt Quick qml c++ ripple linux qt quick
    3
    0 Votes
    3 Posts
    714 Views
    N
    I am also facing the same issue. Have you found any solution for this?
  • Painting images over qml maps

    Unsolved QML and Qt Quick qml qml map qml rendering qml c++ c++ qt
    1
    1 Votes
    1 Posts
    403 Views
    No one has replied
  • How to add C++ QQuickPaintedItem in QML

    Unsolved QML and Qt Quick qt6 qml types qml c++
    4
    0 Votes
    4 Posts
    812 Views
    C
    I am pretty sure you need to register it to the qmlEngine via qmlRegisterType<NotchedRectangle>("My.Items", 1, 0, "NotchedRectangle"); In your main.cpp, then you should be able to use it. (https://www.qt.io/blog/qml-type-registration-in-qt-5.15) In your qml file you can then just type: import My.Items and then you should be able to use NotchedRectangle
  • 0 Votes
    2 Posts
    298 Views
    sierdzioS
    Yes, you can put any QObject-subclass in as a property (use pointers). Also works with Q_GADGETs.
  • 0 Votes
    1 Posts
    343 Views
    No one has replied
  • 0 Votes
    3 Posts
    2k Views
    I
    They both seem like dead projects, nothing you can rely on. grassator/react-qml last commit was Dec 15, 2017 only 1 contributor, only active 4 years ago. ongseespace/react-qml last commit was Mar 26, 2020 had 2 contributors, most active 3-4 years ago. As you may sensed for the extremely few amount of responses before and considering that ReactJS is since many many years one the most prominent JavaScript library in the world, mostly top 1 (https://2021.stateofjs.com/en-US/libraries/front-end-frameworks). It looks not to be in the priority of the Qt strategy. Looking at the architecture of Qt, they seem pretty much incompatible. Qt is a complete stack with a complete e2e experience. Where you don't want to mix other stacks or other frameworks. That also means, I think, you cannot for example create QML based components that are reusable in other frontend stacks, where the backend may be anything else. QML are closed components. So, in other words no support for Web Components specification: https://www.webcomponents.org/introduction which was created to be able to produce reusable components. If anybody, disagrees or have more insights, happy to know about it :)
  • 0 Votes
    7 Posts
    913 Views
    G
    @sierdzio Ok now it's much clearer, thank you again. It looks like there is a lot of documentation to read, but apparently most things I have in mind should work. Still, for some reason, I feel QWidgets will perform faster. I'll try to make some tests and get back here. Thank you again!
  • QT QML realtime chart

    Unsolved QML and Qt Quick qml qml c++ qml binding chartview chart
    5
    0 Votes
    5 Posts
    1k Views
    V
    @J-Hilk Ok that's enough I think. One more question what will happen to scrolleft(). If I keep on incrementing these, will there be any increase in runtime memory or processor load?
  • 0 Votes
    1 Posts
    347 Views
    No one has replied
  • Deployment of QML/C++ app on windows

    Solved QML and Qt Quick qml c++ qml windows windeployqt
    7
    0 Votes
    7 Posts
    2k Views
    K
    @J-Hilk I got it to work with ifw as well. However, the option --plugindir apparently does not work correctly. The plugins were stored in the folder of the exe. However, also the installation using ifw was finally successful.
  • ComboBox together with QStringListModel

    Solved QML and Qt Quick qml c++ qml combobox
    4
    0 Votes
    4 Posts
    2k Views
    K
    The only solution I found is with inheriting from QStringListModel. main.cpp #include <QGuiApplication> #include <QQmlApplicationEngine> #include <QQmlContext> #include <QSettings> #include "MyStringListModel.h" #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication app(argc, argv); QQmlApplicationEngine engine; const QUrl url(QStringLiteral("qrc:/main.qml")); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { if (!obj && url == objUrl) QCoreApplication::exit(-1); }, Qt::QueuedConnection); qmlRegisterType <MyStringListModel> ( "StringListModel", 1, 0, "MyStringListModel" ); MyStringListModel lstModel; QSettings settings ( "TestQml.ini", QSettings::IniFormat ); lstModel.readSettings(&settings, "Components"); if ( lstModel.stringList().size() < 1 ) { lstModel.setStringList( QStringList() << "Test 1" << "Test 2"); lstModel.setCurrentIndex(0); } qDebug() << lstModel.stringList(); engine.rootContext()->setContextProperty ("myLstModel", &lstModel ); engine.load(url); return app.exec(); } MyStringListModel.h #ifndef MYSTRINGLISTMODEL_H #define MYSTRINGLISTMODEL_H #include <QObject> #include <QStringListModel> class QSettings; class MyStringListModel : public QStringListModel { Q_OBJECT Q_PROPERTY (int CurrentIndex READ getCurrentIndex WRITE setCurrentIndex NOTIFY sigCurrentIndex ) int CurrentIndex; public: MyStringListModel(); int getCurrentIndex () const; void setCurrentIndex ( int indx ); void readSettings ( QSettings *settings, const QString & category ); void writeSettings ( QSettings *settings, const QString & category ) const; public slots: void addNewText ( QString editText ); void sltEditText ( QString editText ); signals: void sigCurrentIndex(); }; #endif // MYSTRINGLISTMODEL_H MyStringListModel.cpp #include "MyStringListModel.h" #include <QSettings> MyStringListModel::MyStringListModel() : CurrentIndex ( 0 ) { } int MyStringListModel::getCurrentIndex() const { return CurrentIndex; } void MyStringListModel::setCurrentIndex(int indx) { CurrentIndex = indx; } void MyStringListModel::addNewText(QString editText) { const QStringList &lst = stringList(); for ( int i = 0; i < lst.size(); ++i ) { if ( editText == lst[i] ) return; } setStringList ( stringList() << editText ); setCurrentIndex ( rowCount() - 1 ); } void MyStringListModel::readSettings(QSettings *settings, const QString &category) { settings->beginGroup(category); QStringList lst = settings->value("Entries", QStringList()).toStringList(); setStringList ( lst ); int currentIndex = settings->value("CurrentPosition", 0 ).toInt(); setCurrentIndex(currentIndex); settings->endGroup(); } void MyStringListModel::writeSettings(QSettings *settings, const QString &category) const { settings->beginGroup(category); settings->setValue("Entries", stringList()); settings->setValue("CurrentPosition", CurrentIndex ); settings->endGroup(); } void MyStringListModel::sltEditText(QString editText) { addNewText ( editText ); QSettings settings ( "TestQml.ini", QSettings::IniFormat ); writeSettings(&settings, "Components"); } main.qml import QtQuick 2.15 import QtQuick.Controls 2.15 import StringListModel 1.0 ApplicationWindow { width: 640 height: 480 visible: true title: qsTr("Scroll") Frame { ComboBox { id: secondComboBox editable: true model: myLstModel currentIndex: model.CurrentIndex textRole: "display" onAccepted: { if (find(editText) === -1) model.addNewText ( editText ) } } } }