跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k 主題 77.4k 貼文
  • Deployment of QML/C++ app on windows

    Solved qml c++ qml windows windeployqt
    7
    0 評價
    7 貼文
    3k 瀏覽
    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.
  • keyboard does not show up

    Unsolved
    6
    0 評價
    6 貼文
    696 瀏覽
    Aleksey_KA
    So the problem was obvious because of following lines: #ifdef Q_OS_LINUX qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); #endif Changed to #if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard")); #endif And voila: Android keyboard works! :)
  • Shortcuts & QtQuick.Controls

    Unsolved
    1
    1 評價
    1 貼文
    195 瀏覽
    尚無回覆
  • How to implement TextInput drag and drop

    Unsolved qml textedit
    2
    0 評價
    2 貼文
    748 瀏覽
    fcarneyF
    You are trying to do 2 things that require the same actions. Drag and drop is not built into the TextInput object. So you need to learn how drag and drop works. Next, since you need to be able to change the mode of your TextInput you need to control when a selection can occur. Say for instance if text is selected that you do NOT want selection motion to work. Then use the selectedText property to control the selectByMouse property: selectByMouse: selectedText <= 0 I do not know if this will lock you into that mode. So you may need a way to back out of a selection. What happens when you click the text again? Does it deselect the text?
  • How to avoid text over flow in TextEdit

    Solved
    2
    0 評價
    2 貼文
    233 瀏覽
    ODБOïO
    @Rajashekara-V hi you can set clip: true on the parent rectangle see also https://wiki.qt.io/Flickable_Wrapped_TextEdit
  • Changing the graphic engine changes the way a path is drawn

    Solved qtquick qml dashed lines graphics engine
    2
    0 評價
    2 貼文
    783 瀏覽
    jeanmilostJ
    So as nobody answered this question, I found a workaround which seems to resolve my issue. I changed the stroke width from 1 to 1.5. However this unfortunately doesn't explain what happened here, and why the ShapePath object behaves this way. I have my own idea about that: I think it's a kind of pen alignment, as in GDI+ (https://docs.microsoft.com/en-us/windows/win32/api/gdiplusenums/ne-gdiplusenums-penalignment), however I found absolutely no way to configure that. So below is my solution, which works correctly in all situations on my side: import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Shapes 1.15 import QtGraphicalEffects 1.15 import QtQuick.Templates 2.15 as T /** * Dashed border *@author JMR */ T.Control { // advanced properties property real m_StrokeWidth: 1.5 property int m_Radius: 5 property string m_FillColor: "transparent" property string m_StrokeColor: "#bac1db" /** * Background rectangle */ Rectangle { // common properties anchors.fill: parent color: m_FillColor radius: m_Radius /** * Dashed outline shape */ Shape { // common properties id: shDashedBorder anchors.fill: parent anchors.margins: 0 //layer.enabled: true //layer.samples: 8 smooth: true clip: true /** * Dashed outline shape path */ ShapePath { // common properties fillColor: "transparent" strokeColor: m_StrokeColor strokeWidth: m_StrokeWidth strokeStyle: ShapePath.DashLine dashPattern: [5, 5] startX: m_Radius startY: 0 // path commands PathLine {x: shDashedBorder.width - m_Radius; y: 0;} PathQuad {x: shDashedBorder.width; y: m_Radius; controlX: shDashedBorder.width; controlY: 0;} PathLine {x: shDashedBorder.width; y: shDashedBorder.height - m_Radius;} PathQuad {x: shDashedBorder.width - m_Radius; y: shDashedBorder.height; controlX: shDashedBorder.width; controlY: shDashedBorder.height;} PathLine {x: m_Radius; y: shDashedBorder.height;} PathQuad {x: 0; y: shDashedBorder.height - m_Radius; controlX: 0; controlY: shDashedBorder.height;} PathLine {x: 0; y: m_Radius;} PathQuad {x: m_Radius; y: 0; controlX: 0; controlY: 0;} } } } }
  • Python with Qt Quick: Qt Quick emulation layer crashed. (Line 1:)

    Unsolved
    4
    2 評價
    4 貼文
    968 瀏覽
    S
    I have not found the solution but I have created a ticket: https://bugreports.qt.io/browse/QTCREATORBUG-25277
  • I get an error when refactoring connect.

    Unsolved
    2
    0 評價
    2 貼文
    218 瀏覽
    J.HilkJ
    @w-tkm what version of Qt do you use ? the error signal was deprecated and errorOccured was introduced. This was made due to the fact that error is not only a signal but also a regular function of QAbstractSocket. to use an overload in the new connect syntax requires the use of complicated casting, or the use of the qOverload macro https://doc.qt.io/qt-5/qtglobal.html#qOverload
  • How QML determines default font.pixelSize

    Solved
    2
    0 評價
    2 貼文
    1k 瀏覽
    SeeLookS
    OK. I've got it.... auto pixelSize = qApp.font().pointSizeF() / 72.0 * qApp->primaryScreen()->logicalDotsPerInch();
  • Not able to handle Signals

    Solved
    3
    0 評價
    3 貼文
    992 瀏覽
    P
    @LeLev Thanks for your quick response, it works
  • qml ListView delegate containing a Loader doesn't expand when loading some components?

    Solved
    6
    0 評價
    6 貼文
    1k 瀏覽
    mbruelM
    So thanks to @LeLev who gave me a solution using a ColumnLayout, here is from where I was starting ListView{ anchors.fill: parent spacing: 10 model: 5 delegate: Column { width: parent.width height: exp.checked ? r.height + v.height + spacing : r.height spacing: 10 Rectangle{ id: r width: parent.width height: 50 color: "grey" CheckBox{ id:exp anchors.right: parent.right text: "expand " + index } } ListView { id: v model: 10 spacing: 1 clip : true height: contentHeight width: parent.width visible: exp.checked delegate: Rectangle{ height: 30 width: parent.width color: "lightblue" } } } } The goal was to dynamically load the second ListView in Loader so the page loads much faster. Here is @LeLev solution using a ColumnLayout: // 2.: Solution with a ColumnLayout Component{ id:view ListView { model: 10 spacing: 1 clip : true height: contentHeight delegate: Rectangle{ height: 30 width: parent.width color: "lightblue" } } } ListView{ anchors.fill: parent spacing: 10 model: 5 delegate: ColumnLayout{ height: exp.checked ? 50 + l.item.contentHeight : 50 width: root.width spacing: 1 Rectangle{ Layout.fillHeight: true Layout.fillWidth: true Layout.preferredHeight: 50 Layout.maximumHeight: 50 color: "grey" CheckBox{ id:exp anchors.right: parent.right text: "expand " + index onCheckedChanged: { l.sourceComponent = checked ? view : undefined } } } Loader{ id:l Layout.fillHeight: sourceComponent != undefined Layout.fillWidth: true // Layout.preferredHeight: sourceComponent != undefined ? 100 : 0 } } } and finally after a break and fighting with Column, it is also working without a Layout :) // 3.: Solution with a Column Component{ id:view ListView { model: 10 spacing: 1 clip : true height: contentHeight width: root.width delegate: Rectangle{ height: 30 width: parent.width color: "lightblue" } } } ListView{ anchors.fill: parent spacing: 10 model: 5 delegate: Column{ width: parent.width height: exp.checked ? r.height + l.item.height + spacing : r.height spacing: 10 Rectangle{ id: r width: parent.width height: 50 color: "grey" CheckBox{ id:exp anchors.right: parent.right text: "expand " + index onCheckedChanged: { l.sourceComponent = checked ? view : undefined } } } Loader{ id:l } } }
  • QML Button invisible on some systems

    Solved
    2
    0 評價
    2 貼文
    297 瀏覽
    O
    Ok. Finally I managed to workaround the behavior. Thanks to a user that gave me the tip via PM. I replaced the Button by a Rectangle with MouseArea.
  • Change color to BusyIndicator

    Unsolved
    15
    0 評價
    15 貼文
    6k 瀏覽
    T
    Thank you very!
  • Getting notified when parent transformation changed

    已移動 Unsolved
    1
    0 評價
    1 貼文
    194 瀏覽
    尚無回覆
  • qml button clicked not triggered in *.qml file

    Solved
    3
    0 評價
    3 貼文
    788 瀏覽
    J
    Thank you , This solved the issue
  • Accessing QAbstractItemModel fields in QML

    Solved
    5
    0 評價
    5 貼文
    988 瀏覽
    ODБOïO
    @LeLev said in Accessing QAbstractItemModel fields in QML: To me it looks like i'm doing something wrong about QModelIndex creation, because if i pass the QModelIndex directly from qml to c++ like this : indeed this was the problem, instead of passing styleData.row and styleData.column to my Q_Invokable method i can pass styleData.index itemDelegate: Text { color: myUaModel.getSubActiveByIndex(styleData.index) ? "green" : "blue" } Q_INVOKABLE bool getSubActiveByIndex(QModelIndex ind){ bool isSub = false; if(!ind.isValid()) return isSub; auto item = static_cast<TreeItem *>(ind.internalPointer()); isSub = item->data(7).toBool(); return isSub; }
  • Problem integrating qt quick project with qt widgets project.

    Unsolved
    2
    0 評價
    2 貼文
    339 瀏覽
    KillerSmathK
    Hey @saumayd, welcome to Qt Forum. Where are you exporting the instance of object gmap to the qml ? [ERROR]: qrc:/maps/main.qml:26: ReferenceError: gmap is not defined Connections{ target: gmap onGetLat : mapmarker.center.latitude = lat } Are you passing the object to the qml context by calling setProperty before of line: view->setSource(QUrl("/maps/main.qml")); ? #include <QQmlContext> ... Gmap *gmap = new Gmap(this); // wherever you're creating the instance of object gmap ... QQmlContext *ctxt = view->rootContext(); ctxt->setContextProperty("gmap", gmap); // the property gmap is refered to gmap object in c++ view->setSource(QUrl("/maps/main.qml")); Read more: https://doc.qt.io/qt-5/qtqml-cppintegration-overview.html https://doc.qt.io/qt-5/qtqml-cppintegration-contextproperties.html
  • crazy frameworks integration.... and I'm stuck

    Solved
    7
    0 評價
    7 貼文
    2k 瀏覽
    Stanislav SilnickiS
    @doomdi Hi! The code is slightly outdated, so some errors may appear due to its legacy nature (initial post is 3+ y.o.). I highly discourage you to go this way of USB-Android integration if you're missing deep understanding at least one of listed items: Java, JNI, USB stack, libusb, linux ioctl stuff, C++/Qt, Android SDK, pthreads. As the initial post suggests, its a CRAZY integration, so it should be depricated. I did it initially for curiosity and this solution wasn't used in any production environment. I wish I could help you, but my current occupation doesn't allow this happen these days, sorry.
  • 此主題已被刪除!

    Solved
    5
    0 評價
    5 貼文
    88 瀏覽
  • Problems of QAbstractListModel

    Unsolved
    2
    0 評價
    2 貼文
    278 瀏覽
    raven-worxR
    @Munkhtamir QML support QAbstractItemModel instances. For this to fully support you need to implement roleNames() method in your model and map context variable names to your item roles. See this example.