跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k 主題 77.4k 貼文
  • How to translate Dialog's standard buttons?

    Solved translation
    3
    0 評價
    3 貼文
    837 瀏覽
    D
    @Dmitriano Figured this out! I add qt-everywhere-src-6.2.2\qttranslations\translations\qtbase_ru.ts to the project and load qtbase_ru.qm with the Translator in C++ code.
  • Spinbox not fitting to rectangle, If it fits focus is missing

    Unsolved
    4
    0 評價
    4 貼文
    277 瀏覽
    MarkkyboyM
    This code does not compile. Where are the import statements?, I have to assume you are using QtQuick.Controls 1.4 not Quick 2. It is important to give as much info as you can and where possible, learn how to paste it properly making it readable and repeatable for those reading/helping. You are using components that do not exist, where does 'widthValue' and 'heightValue' come from in Rectangle? Not forgetting the strange use of anchors, why are you trying to anchor the rectangle to the top of itself?, error after error. So, all you are wanting to do, is place SpinBox in a Rectangle?; Rectangle{ id: upperValue color: "red" width: 200 height: 100 anchors.centerIn: parent SpinBox { id:spinbox minimumValue: 0.2 maximumValue: 40 stepSize: 0.2 decimals: 2 focus: true anchors.centerIn: parent } } } [image: 8cb34146-fb49-48cd-be1b-40905688d151.JPG]
  • Display text in pages

    Unsolved
    4
    0 評價
    4 貼文
    336 瀏覽
    ndiasN
    Hi @Iliass, If you plan to use PyQt or PySide you can check this example or follow this tutorial . Regards
  • make playback tone time constant when pitch is varying

    Unsolved
    1
    0 評價
    1 貼文
    109 瀏覽
    尚無回覆
  • How to fetch listtype data from qml to cpp?

    Unsolved qml qqmlcomponent qqmlengine qmetaobject invokemethod
    1
    0 評價
    1 貼文
    268 瀏覽
    尚無回覆
  • How to read properties for the currenetly selected item in a ListView

    Unsolved
    7
    1 評價
    7 貼文
    6k 瀏覽
    C
    @tskardal Hey, I know this is an old topic, but I was directed here from Google when looking for a solution for this exact problem. Luckily I found this SO question from 2015 that has a built-in elegant solution. It has to do with using DelegateModel to encapsulate the QAbstractListModel and let the user get any item at a certain index. In OP's case, the solution will look like this: import QtQml.Models 2.15 //need this for DelegateModel ListView { id: list width: 180; height: 200 model: DelegateModel{ id:myDelegateModel model: myModel // QAbstractListModel delegate: Component { Item { width: 200 height: 30 Text { id: text text: title } MouseArea { anchors.fill: parent onClicked: { list.currentIndex = index; } } } } } onCurrentItemChanged: { var currentModelItem = myDelegateModel.items.get(list.currentIndex).model console.log("Current Item title is: " + currentModelItem.title) } } There are more current answers that to my humble opinion are far more convoluted than this solution.
  • audio file pitch vs frequency relation in audio engine in qml

    Unsolved
    1
    0 評價
    1 貼文
    135 瀏覽
    尚無回覆
  • QtDeviceUtilities.DisplaySettings, QML and screen brightness

    Solved
    8
    0 評價
    8 貼文
    1k 瀏覽
    SGaistS
    Since you hold a commercial license do not hesitate to contact the Qt company about that matter.
  • Creating Flowchart dynamically through qt c++ qml

    Unsolved
    4
    0 評價
    4 貼文
    951 瀏覽
    GrecKoG
    Take a look at http://cneben.github.io/QuickQanava/index.html
  • Projects with QML Compile Blank

    Unsolved
    5
    0 評價
    5 貼文
    242 瀏覽
    MarkkyboyM
    I am also running Windows 7, but not QT6, I think may be the problem, QT6 seems not to be quite ready for public use, modules are missing/removed/buggy/incomplete. I am running QtCreator 5.0.3 based on Qt5.15.2. My apologies, I should have read your reply more thoroughly, then I would have noticed you're using QT6.......i think this is where the real problem is.
  • QtLocation - Filter output errors

    Unsolved
    1
    0 評價
    1 貼文
    186 瀏覽
    尚無回覆
  • How to dynamically set a Flickable's content

    Unsolved
    2
    0 評價
    2 貼文
    658 瀏覽
    sierdzioS
    @Ben-S said in How to dynamically set a Flickable's content: /** This is the object that will be clipped by the container */ property Item contentItem Try this: /** This is the object that will be clipped by the container */ default property alias contentItem: scrollView.contentItem (default is not necessary, but can be useful).
  • QtLottie gotoAndPlay(), start() methods doesnt work inside Connections

    Unsolved
    1
    0 評價
    1 貼文
    132 瀏覽
    尚無回覆
  • Subclass QAbstractListModel - count issue

    Solved
    9
    0 評價
    9 貼文
    761 瀏覽
    D
    Ok thank you it works.
  • What is the good way to work with pointers in Javascript/Qml?

    Unsolved pointers javascript qml instance object component
    2
    0 評價
    2 貼文
    1k 瀏覽
    C
    Javascript abstracts the concept of pointers. Data is only ever passed around by reference. It is usually safer, since memory management is handled automatically and you can be sure an object equals another object if they are compared. If you need to compare objects to see if they are identical, you may have better luck creating a "compare" method that directly compares primitive attributes (strings can be compared directly, for instance). Hope this helps, sorry I can't provide a more specific implementation suggestion. Too many details to focus on at once.
  • Ignore unresolved import?

    Unsolved
    1
    0 評價
    1 貼文
    200 瀏覽
    尚無回覆
  • Set objectName property as "required". How?

    Unsolved
    1
    0 評價
    1 貼文
    164 瀏覽
    尚無回覆
  • Displaying a View3D QML type in QQuickWidget looses input interaction

    Unsolved
    1
    0 評價
    1 貼文
    245 瀏覽
    尚無回覆
  • Alternative to TabView in Qt 6?

    Unsolved
    2
    0 評價
    2 貼文
    3k 瀏覽
    sierdzioS
    I'm not sure what TabView was, but in Controls 2 there is TabBar: https://doc.qt.io/qt-6/qml-qtquick-controls2-tabbar.html. Other navigation controls are: https://doc.qt.io/qt-6/qtquickcontrols2-navigation.html
  • Is it safe to bind to C++ subobject's property in QML?

    Solved qml c++ properties binding
    4
    0 評價
    4 貼文
    777 瀏覽
    B
    @GrecKo said in Is it safe to bind to C++ subobject's property in QML?: But why don't you do property var qmlCompProp: database.getDbpointObject() in yout qmlComp? prop1 and prop2 are passed to the database.getDbpointObject(prop1, prop2) function. prop1 and prop2 are properties of qmlComp. These properties are set when an instance of qmlComp is created. Item { required property string prop1 property bool prop2: false property var qmlCompProp: ({}) Component.onCompleted: { qmlCompProp = database.getDbpointObject(prop1, prop2) } } Since the properties evaluation order is undefined, and qmlCompProp depends on both prop1 and prop2 values, I've opted to initialize qmlCompProp with an empty object and assign the actual object in Component.onCompleted. Is this the right/recommended way, or is there a better way to handle this? Thanks for the information about the warning and it's workaround.