Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • How to change TextField font size

    2
    0 Votes
    2 Posts
    2k Views
    p3c0P
    Hi, Move it under TextField instead of style.
  • Should KeyNavigation.priority behavior depend on where it is in the QML?

    1
    0 Votes
    1 Posts
    572 Views
    No one has replied
  • 0 Votes
    8 Posts
    8k Views
    A
    Thanks guys, it's solved. I just had to remove the first declaration of my slot: myclass.h @#ifndef MYCLASS_H #define MYCLASS_H #include <QDebug> #include <QObject> class MyClass : public QObject { public: MyClass(); public slots: //void buttonClicked(); <~ This had to be removed in order to make it work void buttonClicked(QString &in); }; #endif // MYCLASS_H @
  • Noob Question: What's up with QtQuick.Window ?

    3
    0 Votes
    3 Posts
    893 Views
    G
    Thanks for the reply. I assume QQuickView is used you make a "QT Quick UI" as opposed to a "QT Quick Application" in creator. I can probably live either way for now. :)
  • Object transfer from javascript to c++

    1
    0 Votes
    1 Posts
    728 Views
    No one has replied
  • TableView remove ScrollBar

    2
    0 Votes
    2 Posts
    1k Views
    p3c0P
    Hi, AFAIK, you can access the private member @ TableView { __verticalScrollBar.visible: false } @
  • [fixed] OpenGL under QML text is distorted

    2
    0 Votes
    2 Posts
    830 Views
    strahlexS
    Found it: The paint method took to long. I did more than painting in it.
  • How to set the frame rate of camera preview in QT

    4
    0 Votes
    4 Posts
    3k Views
    F
    It turns out that there is a bug in Qt that makes actually setting the frame rate difficult. My colleague is submitting a patch that will fix this.
  • Array not accessible

    4
    0 Votes
    4 Posts
    1k Views
    J
    Ohh srry, made a mistake. The line where I change the state actually says: @repeater.children[i].state = "inactive"@ But this results in an error: @TypeError: Type error@ I've also tried to work around it in various ways but some of these work arounds make my architecture less modular which is absolutely not what I want. So managing to evaluate this statement right would carry high benefit in design ways. (I would eventually like to use this widgets in a few more applications) I changed the line to: @repeater.itemAt(i).state = "inactive"@ which seems to do what I want. But now I guess, due to I eagerly change the state of the ListTab, it calls the function in the creation process which leads to null pointers. So I removed the line where I change the state in my ListTab.qml file and added this to the TabbedList.qml file: @ Component.onCompleted: { for(var i = 0; i < tabs.length; i++){ //repeater.itemAt(i).state = "inactive" console.log(repeater.itemAt(i)) } } @ and this now returns that: @ qml: ListTab_QMLTYPE_1(0xfd6b30) qml: ListTab_QMLTYPE_1(0x868c80) @ Which seems valid but it doesn't solve my problem. Any advice? Just to give you a clear overwiew: TabbedList.qml: @import QtQuick 2.0 Rectangle { id: tabbedList height: 500 width: 200 color: "gray" //property var tabs: 2 property var rowSize: 50 property var tabs: ["Kunden", "Bestellungen"] Component.onCompleted: { for(var i = 0; i < tabs.length; i++){ //repeater.itemAt(i).state = "inactive" console.log(repeater.itemAt(i)) } } Column{ id:container Repeater{ id: repeater model: tabs.length ListTab{ text: tabs[index] expandSize: tabbedList.height - rowSize * (repeater.count - 1) onStateChanged: evStages(index) } } } function evStages(index){ //console.log("lol") for(var i = 0; i < tabs.length; i++){ if(i != index){ repeater.itemAt(i).state = "inactive" console.log(repeater.itemAt(i)) } } } } @ ListTab.qml: @import QtQuick 2.0 Rectangle { id: listTab width: 200 property var rowSize: 70 property var expandSize: 500 property var text: "" state: header.state states: [ State { name: "active" PropertyChanges { target: listTab height: expandSize } }, State { name: "inactive" PropertyChanges { target: listTab height: listTab.rowSize } } ] transitions: [ Transition { from: "inactive" to: "active" reversible: true ParallelAnimation{ PropertyAnimation{ target: listTab properties: "height" duration: 50 } } } ] TabButton { id: header width: parent.width height: rowSize text: listTab.text /*MouseArea{ anchors.fill: parent onClicked: if(listTab.state == "active"){ listTab.state = "inactive" } else { listTab.state = "active" } }*/ } ListView{ anchors.top: header.bottom anchors.bottom: parent.bottom width: parent.width delegate: TabListItem{ height: listTab.rowSize } clip: true; model: 20; } } @ TabButton.qml: @import QtQuick 2.0 Rectangle { id: tabButton width: 100 height: 62 property var text: "" //state: "inactive" MouseArea{ anchors.fill: parent Image { id: background anchors.fill: parent } onClicked: if(tabButton.state == "active"){ tabButton.state = "inactive" } else { tabButton.state = "active" } } Text { id: "text" text: tabButton.text color: "white" anchors.centerIn: parent } states: [ State { name: "active" PropertyChanges { target: background source: "resources/tab_active.png" } }, State { name: "inactive" PropertyChanges { target: background source: "resources/tab_inactive.png" } } ] } @
  • Qt4 clear() issue : Am I using it right?

    7
    0 Votes
    7 Posts
    2k Views
    A
    @SGaist- Thanks for the greetings. I got my problem solved
  • OpenGL newbie - why won't these lines display properly?

    1
    0 Votes
    1 Posts
    635 Views
    No one has replied
  • Using QQuickView with ActiveQt

    1
    0 Votes
    1 Posts
    519 Views
    No one has replied
  • How to call a QtQuick Dialog form a Qt app

    4
    0 Votes
    4 Posts
    1k Views
    M
    Probably not but the question is: "why do you need a Qt Quick Dialog in a Qt Widgets application?"
  • Call a qml function from C++.

    8
    0 Votes
    8 Posts
    4k Views
    mrdebugM
    @ Connections { target: myCppClass onRunFunction: myQMLFuntion(); } @ Works perfectly!
  • Add QQmlComponent into QQuickView

    2
    0 Votes
    2 Posts
    2k Views
    T
    Hi, I have the same problem here! Any news on that issue? How did you solve it?
  • TextArea in ListView delegate

    6
    0 Votes
    6 Posts
    2k Views
    L
    I also found, that when setting the inputMask for the TextField, the issue also shows up for TextFields.
  • Qml and dinamic text height

    4
    0 Votes
    4 Posts
    1k Views
    B
    Ugly but works @ property real rowHeight: textHeight.height Text{ id: textHeight; visible: false; text: "Hello World"} TextArea { height: rowHeight * model.length } @
  • [solved] Can we access ListView model Role In QML ?

    8
    0 Votes
    8 Posts
    3k Views
    p3c0P
    You're Welcome :) You can mark the post as solved. Just edit the post title and prepend [solved]
  • Can I construct a custom Qml item that contains a placeholder child?

    2
    0 Votes
    2 Posts
    2k Views
    T
    Have you tried making your item the default property (http://qt-project.org/doc/qt-5/qtqml-syntax-objectattributes.html#default-properties) of MaskedItem? Alternatively you could try working with a Loader element.
  • QQuickWidget crash

    4
    0 Votes
    4 Posts
    2k Views
    M
    Thank you for your response. I try to compile with visual studio 2013 without opengl.