Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.2k Posts
  • QtQuick Controls Slider pressed signal

    1
    0 Votes
    1 Posts
    655 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
    546 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.
  • Most basic imports

    1
    0 Votes
    1 Posts
    426 Views
    No one has replied
  • [solved] How to modify Gradient in a state's PropertyChange?

    2
    0 Votes
    2 Posts
    2k Views
    D
    I found the solution: Simply give each GradientStop an id, and use these ids as the target of the PropertyChange.
  • Embedding a QWindow inside a QML scene?

    3
    0 Votes
    3 Posts
    4k Views
    D
    I'm not actually trying to embed a QML scene within another QML scene, I am more interested how it could be done than actually doing it. What I really want to be able to do is embed any QWindow in a QML scene like you can do in QWidgets with QWidget::createWindowContainer. What I want to do with this is embed external windows in a QML applications (for example, Java windows or SDL windows). I've a hack that works well enough, but it would be nice to have proper integration. Basically, I can get the window id from the external window (both Swing and SDL2 let you do this easily if you have access to the source, I'm sure other GUI tools do too. Otherwise you can get it through platform API's), then I use QWindow::fromWinId(...) to create a new QWindow from the existing native window. Then I can setParent to reparent the window to my existing QML window and use mapToScene and position()/size() of the QML Item where I want to position the external window. When the "parent" item changes position or size, I need to change my QWindows position and size too. Now I have an external window "embedded" in a QML scene. Of course, its far from perfect... for one, the window is basically just overlayed over the scene, so it doesn't play nice with QML elements that might be overlapping it. Even if you could embed properly, this may still be the case though. Also, I find that input capture is very... hit or miss... with this approach. The second approach I've had success with (and input capture seems to work much better) is basically the opposite: create a QWindow, get its windId and then have the external window created from that id. SDL 2 supports this with SDL_CreateWindowFrom, not sure about other libraries though and this only works if you have access to the window creation code, so doesn't work for many use cases. bq. This was possible in Qt Quick 1, but not Qt Quick 2. Hmm. I was sure I saw something that was essentially the opposite of QWidget::createWindowContainer, but I can't find it now and don't have time to go digging... I know there was some work around Qt 5.0 or 5.1 to render QWidgets to a texture and then render that within QML and I thought I remembered 5.1.1 or 5.2 or something release it, but I could be wrong.
  • Problem with states when pressed

    5
    0 Votes
    5 Posts
    1k Views
    K
    When you release mouse this state @states: State { when: icon.pressed PropertyChanges { target: mask; opacity: 0.75 } }@ stops working because of when is not set to true, it works fine withour flickable. But with flickable area from time to time when i click a button it gets dark(state works) and move my finger a little bit signal about releasing it is not sent. I think its because flickable get the signals now. in 95% it works perfectly but there is this 5% that is annoying and I am not sure if my app freezed or its just this bug
  • Multimedia keys

    1
    0 Votes
    1 Posts
    676 Views
    No one has replied
  • Large virtual canvas

    2
    0 Votes
    2 Posts
    1k Views
    R
    Solved this problem with requestDraw() at event when canvas window go outside of the drawn tile(s).
  • [Solved] Qml Canvas loadImage not working

    3
    0 Votes
    3 Posts
    4k Views
    SGaistS
    Hi and welcome to devnet, The SSL errors are probably completely unrelated. However the path problem is more a string problem, one backslash means that you are escaping the next character so you are giving something invalid. On windows you would need to use two backslashes if you wanted to keep that notation. But you already found out that you can use the unix notation which is less error prone with Qt :) Since you found the solution, can you please update the thread title prepending [solved] so other forum users may know a solution has been found :) Happy coding !
  • QtQuick 2 unreliable, breaking and showing "anonymous" error messages ?!?

    1
    0 Votes
    1 Posts
    542 Views
    No one has replied
  • Getting bytes from VideoOutput

    1
    0 Votes
    1 Posts
    457 Views
    No one has replied