Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • How to crop an image inside an item (rectangle)?

    5
    0 Votes
    5 Posts
    4k Views
    Q
    Woooow! Perfect! That's exactly what I need! Thank you so much
  • Grid View Qml Item hide with cell

    1
    0 Votes
    1 Posts
    972 Views
    No one has replied
  • How to get Screen Coordinates of a QML Item?

    6
    0 Votes
    6 Posts
    7k Views
    T
    None of these are actually screen coordinates. They are all relative to the main window which could be anywhere.
  • QML: Receive signals from C++ object in different thread

    3
    0 Votes
    3 Posts
    2k Views
    L
    its gonna be a lot of code to post. but, the way it works now is: the qml window's (window2,qml) parent is declared in main.qml (window1.qml). I then have a mainThread.cpp that connects to main.qml, so, any object running (e.g. test.cpp) in a different thread emits a signal to mainThread.cpp, and this signal is received by main.qml, then main.qml calls a function (decalred in window1.qml) to access the child window (window2.qml) and to process the signal emitted by test.cpp). so, i have main.qml, that receives any signals and passes it to the relevant window. thats what i'm not happy with. If there is a pattern to access the signal (emitted from test.cpp) directly to window2.qml, bypassing main.qml, I'd be very happy. but Window2.qml cannot receive signals directly from test.cpp. From what I could tell, I'd probably have to add something like this into the test.cpp object: QmlApplicationViewer viewer; viewer.setMainQmlFile(QLatinString("qml/project_folder/Window2.qml"); viewer.showExpanded(); but I want to confirm that I'm on the right track, if not, can you do it, and how do you do it. Thanks!
  • Mysterious height handling and Point size <= 0 assert

    3
    0 Votes
    3 Posts
    5k Views
    K
    thanks, but this will not solve the problem: we lose the dynamic height if somewhere changes the parent geometry the assert message is also shown because the binding of parent.height is in the timeline after the signal handling (using QML Profiler) At the moment my solution is @font { family: "Arial" pointSize: getFontSize(0.10 * height) }@ where getFontSize is a very simple function @function getFontSize(s) { return s === 0 ? 1 : s; }@ But over all I haven't found some useful documentation how can we handle all the sizes of a QML application. From my point of view I need to lot width, height informations also when I use layouts.
  • 0 Votes
    3 Posts
    1k Views
    M
    Ok SGaist: I followed your suggestion: the issue has been filed to the bug report system as "QTBUG-39621":https://bugreports.qt-project.org/browse/QTBUG-39621 I am going to update this discussion thread as soon as I have some news about it.
  • Sharing same data class through diferent qmlRegisterTypes

    1
    0 Votes
    1 Posts
    531 Views
    No one has replied
  • Menu Style?

    2
    0 Votes
    2 Posts
    1k Views
    Q
    This post is probably no longer relevant but just a FYI, Qt 5.3 has added MenuStyle; custom styling for Menu object in QML : https://qt-project.org/doc/qt-5/qml-qtquick-controls-styles-menustyle.html#frame-prop
  • [SOLVED] Problem with disable action areas (TextField, ...)

    3
    0 Votes
    3 Posts
    1k Views
    H
    Thanks for the answer. The enabled-property works fine now. For some reason, few days ago, it didnt worked...
  • QtQuick Controls Slider pressed signal

    1
    0 Votes
    1 Posts
    658 Views
    No one has replied
  • RCC Parse Error for adding qm file using QTranslate

    1
    0 Votes
    1 Posts
    3k Views
    No one has replied
  • 0 Votes
    1 Posts
    1k Views
    No one has replied
  • QML array alternative syntax

    4
    0 Votes
    4 Posts
    1k Views
    D
    edit: not useful anymore
  • [solved] Strange behaviour when animating opacity

    2
    0 Votes
    2 Posts
    652 Views
    D
    Oops, I think I already figured it out... I forgot to mention properites: "opacity" in the NumberAnimation. Apparently, ColorAnimation assumes the targeted property is "color", while NumberAnimation can't know. Sorry for the stupid question! Cheers
  • [Solved] Writing to one role of a C++ provided ListModel

    3
    0 Votes
    3 Posts
    7k Views
    _
    Hi, there is something I don't understand here, I dont understand why there is no way to set the data of a DataItem more easily. Let me explain myself : In the delegate of the QML list view, we can easily refer to properties thanks to the property <-> role mapping. So, when we write the following : @ ListView { ... // This is a C++ ListModel of DataItems model: datamodel ... delegate: Text { ... // note is the rolename assiociated to NoteRole enum. // The following line calls // ListModel::data(const QModelIndex &index, int role) // I then assume that index is known somewhere in QML text: note ... MouseArea { ... onDoubleClicked: { // I expected the following line to call // ListModel::setData() but it's not. // the application output tells me that I can't access // a read-only property, why ?? // Event if DataItem had a // Q_PROPERTY (note READ note WRITE setNote ...) // I'd still have the message. parent.text = "I changed the note" } } } ... } @ Why can't we set a property without worrying about the index ?
  • Block JS execution in same thread -- is it possible?

    1
    0 Votes
    1 Posts
    530 Views
    No one has replied
  • [solved] How to create a binding from C++ to a QML property?

    8
    0 Votes
    8 Posts
    2k Views
    D
    I finally solved the problem in a most stupidly simple way! In the component that is dynamically loaded, I added the following: @ Component.onCompleted: { parent.height = height; } @ Cheers!
  • Message Strings File

    1
    0 Votes
    1 Posts
    548 Views
    No one has replied
  • Using a Loader for a string of QML

    2
    0 Votes
    2 Posts
    1k Views
    J
    A few things that might help: It wasn't obvious to me that you can create a custom qml object just using qml in a text file. Create a qml file to define your object in the same directory as the code that calls it. The file name sets the qml object's name. It's very similar in effect to inheritance in C++. I think your creation code should be more like this: @ // dynamic object creation component = Qt.createComponent( qmlFileName ); if ( component.status == 3 ) // enumeration 'Component.Error' == 3 { // Error Handling console.log("Error loading component:", component.errorString()); } else if ( component.status == 1 ) // enumeration 'Component.Ready' == 1 finishCreation(); else component.statusChanged.connect( finishCreation );@ here's the function it references: @function finishCreation() { if ( component.status == 1 ) // enumeration 'Component.Ready' == 1 { var disp = component.createObject( _rootItem, { "parent": _rootItem } ); if (disp == null) { // Error Handling console.log( "Error loading plugin into display area" ); } } else if ( component.status == 3 ) // enumeration 'Component.Error' == 3 { // Error Handling console.log("Error loading component:", component.errorString() ); } } @ Note that this code sets the VISUAL parent of the created item. If you don't then inheriting parent properties doesn't work
  • How to access secondary camera device using QML camera element ?

    10
    0 Votes
    10 Posts
    7k Views
    sierdzioS
    I follow the Qt development mailing list, that is where I've got the information. I do not know whether this change was really merged into the release.