跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k 主題 77.7k 貼文
  • Scrollable QML Charts

    Unsolved qtcharts scrollbar
    2
    0 評價
    2 貼文
    2k 瀏覽
    K
    Worth linking this topic to the answer documented on StackOverflow: https://stackoverflow.com/questions/46886443/scrollable-qml-charts
  • QML Tableview resize column width by dragging the column header border

    Solved
    5
    0 評價
    5 貼文
    4k 瀏覽
    fcarneyF
    Sorry I didn't mention it. But you can pick and choose from different libraries by using the "as" clause on import. For instance if you want Quick.Controls 1 and 2 in same file you can do this: import QtQuick.Controls 2.15 import QtQuick.Controls 1.2 as QC1 ... QC1.TableView{ }
  • Translate model c++

    Unsolved
    6
    0 評價
    6 貼文
    809 瀏覽
    Pablo J. RoginaP
    @Fian said in Translate model c++: I decided to use files It looks like your issue is solved. If so, please don't forget to mark your post as solved!
  • Video not visible when using QtQuick3D

    Unsolved
    2
    0 評價
    2 貼文
    222 瀏覽
    L
    Here is the missing qml part: import QtQuick 2.15 import QtQuick3D 1.15 import QtQuick3D.Helpers 1.15 import QtMultimedia 5.15 Item { id: root_component anchors.fill: parent Video { anchors.fill: parent source: "assets/01_Animation_PTB.mp4" Component.onCompleted: { play() } } Item { // anchors.fill: parent width: 300 height: 200 View3D { id: view anchors.fill: parent environment: SceneEnvironment { clearColor: "skyblue" backgroundMode: SceneEnvironment.Color } PerspectiveCamera { position: Qt.vector3d(0, 200, 300) eulerRotation.x: -30 } DirectionalLight { eulerRotation.x: -30 eulerRotation.y: -70 } Model { position: Qt.vector3d(0, 150, 0) source: "#Sphere" materials: [ DefaultMaterial { diffuseMap: Texture { sourceItem: tester } } ] SequentialAnimation on y { loops: Animation.Infinite NumberAnimation { duration: 3000 to: -150 from: 150 easing.type:Easing.InQuad } NumberAnimation { duration: 3000 to: 150 from: -150 easing.type:Easing.OutQuad } } } } } }
  • Functions are not supported in a Qt Quick UI form

    Unsolved
    4
    0 評價
    4 貼文
    13k 瀏覽
    _
    @benlau Hi, I'm using Qt 5.15 and can't have your example working. I'm trying to use the onClicked signal handler of a button I have SomeForm.ui.qml: Item { property alias refresh: refreshBtn Button { id: refreshBtn // size, color, ... } } and in Some.qml: SomeForm { refresh.onClicked: console.log("foo") } NOTE: this does not work either: in Some.qml: SomeForm { refresh { onClicked: console.log("foo") } } What am I doing wrong ?
  • Qt Quick QML Bluetooth StringData Empty

    Unsolved
    6
    0 評價
    6 貼文
    1k 瀏覽
    H
    @7bitbyte for anybody who has this problem: try sending 0x0A (LF) in your packet for example: 0xA text also I have problem with receiving numbers more than 7f(127) which is maximum in utf8
  • QCharts performance on Windows is abyssmal compared to Linux

    Solved
    4
    1 評價
    4 貼文
    451 瀏覽
    GrecKoG
    I believe you would have even better performance with VXYModelMapper, and your C++ could stay decoupled from your charting code (no manipulation of your series in your model code).
  • QML Memory Mangement

    Unsolved
    1
    0 評價
    1 貼文
    175 瀏覽
    尚無回覆
  • Text implicit width

    Unsolved
    1
    0 評價
    1 貼文
    295 瀏覽
    尚無回覆
  • SwipeView inside of SwipeView

    Solved
    3
    0 評價
    3 貼文
    903 瀏覽
    W
    Hello everyone, @jpnurmi Referring to your example: what is the position and the size of a Page inside the SwipeView? As you said SwipeView doesn't have a geometry, so when I try to refer to Page's parent, where it points exactly? Qt says that Page's parent is an Item with undefined id. Can a SwipeView limit somehow the size and position of a Page or I need to treat it like it will always refer to the screen's x=0 and y=0? Thanks, wgrs33
  • Optimizing Listview performance

    Solved
    5
    0 評價
    5 貼文
    1k 瀏覽
    M
    @jeremy_k Thank you for your reply! I will look into DelegateChooser as well. I have also fixed that translated string issue. Was not meant to be in there!
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    3 瀏覽
    尚無回覆
  • Problem with displaying proper graphics with qt creator

    Unsolved
    4
    0 評價
    4 貼文
    421 瀏覽
    A
    @qtprogrammer123 Though I have just noticed that the same error occurs in the editor of the youtuber too. But his works fine regardless of the error.
  • RegExpValidator, empty field

    Solved
    6
    0 評價
    6 貼文
    569 瀏覽
    qtprogrammer123Q
    regExp: /^((?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){0,3}(?:[0-1]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])**|()**$/
  • Control width of Text Input in QML SpinBox

    Unsolved
    2
    0 評價
    2 貼文
    1k 瀏覽
    qtprogrammer123Q
    I understand you? You wonna set maximum width of TextInput with SpinBox, but field width should only grow when text gets longer? SpinBox{ id: widthSpin } TextInput { id: textField property int textMaxWidth: widthSpin.value property int textWidth: textMetrics.width width: textWidth < textMaxWidth ? textWidth : textMaxWidth TextMetrics { id: textMetrics font: textField.font text: textField.text } } Ofc you should add elide, max / min for widthSpin etc, property for minimum field length will be good idea too - if you set width to 0 it will look bad.
  • reuse of custom C++ class

    Solved
    5
    0 評價
    5 貼文
    422 瀏覽
    A
    Thank you, I will look into what you suggest. The signals to the instances contain different QVector arrays of data to be displayed. Aaron
  • QQuickPaintedItem and memory release

    Unsolved
    1
    0 評價
    1 貼文
    206 瀏覽
    尚無回覆
  • MouseArea disabled if item on top

    Solved
    4
    0 評價
    4 貼文
    361 瀏覽
    D
    Thanks for your feedbacks @J-Hilk and @jeremy_k . Your solutions seem good, I will pick on of the two.
  • Requirements for svg icons? Changed in Qt 5.10.1?

    Solved svg icons
    12
    0 評價
    12 貼文
    13k 瀏覽
    K
    Necro-threading this because this is still a problem, at least where it would work fine in macOS, but not when deployed to iOS. I solved it by adding QT += svg xml to the .pro file AND #include <QtSvg> to main.cpp. I haven't looked to see which one was minimum solution. Since this was an intermittent problem (why?), I didn't want to take any chances so just shotgunned it.
  • Q_ENUMS based model

    Unsolved
    3
    0 評價
    3 貼文
    860 瀏覽
    S
    Thank you for the reply! So based on your answer, I have implemented it in the following way: Have created ColorTypeModel: class ColorTypeModel : public QAbstractListModel { enum { ColorTypeIDRole = Qt::UserRole, ColorTypeNameRole }; Have made it singleton: public: static ColorTypeModel& Instance() { static ColorTypeModel colorTypeModel; return colorTypeModel; } virtual ~ColorTypeModel() {} private: explicit ColorTypeModel(QObject *parent = nullptr); Have added QStringList and static QMap anyway: private: QStringList m_data; static QMap<ColorType::Value, QString> m_namesMap; Then I have implemented fillModel() method and call it in the model's constructor: void ColorTypeModel::fillModel() { m_data.clear(); const QMetaEnum metaEnum = QMetaEnum::fromType<ColorType::Value>(); assert((m_namesMap.size() == metaEnum.keyCount()) && "ColorTypeModel map should be filled with names for the every enum item!"); for (int i = 0; i < metaEnum.keyCount(); ++i) { m_data.append(ColorTypeModel::m_namesMap.value(static_cast<ColorType::Value>(metaEnum.value(i)))); } } Have implemented in my backend class (which is set as ContextPropery) method to publish it to QML: QVariant Backend::getColorTypeModel() const { return QVariant::fromValue(&ColorTypeModel::Instance()); } Have created ComboBox in QML and connect with the aforementioned model: ComboBox { textRole: "colorTypeName" valueRole: "colorTypeID" model: backend.getColorTypeModel() } Everything works well! So here is my question: is my approach correct (and match with the described one in your reply)? And can it be simplified somewhere?