Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.6k Posts
  • 0 Votes
    3 Posts
    826 Views
    [quote author="Vincent007" date="1394117877"]Yes, I think it is possible, If your class is a QObject-dervied class.[/quote] Can you give me an example ?
  • Resizing Main Windows QML

    6 Mar 2014, 01:16
    0 Votes
    15 Posts
    10k Views
    Oh alright, so you basically want the part with the resizing, you already got your part done with the clicking? For the resizing part you'll still need a resize function in your mainwindow class. Let's keep the old one from above. In QML you'll just resize your top-level-component. If it is for example a Rectangle: @Rectangle { id: topLevelComp // more code .. }@ We'll give it an id. So if we have to resize the window, like for example with the onClicked: notification of a MouseArea, we just execute: @onClicked: { topLevelComp.width = 0 topLevelComp.height = 0 }@ The QML-resize part is mostly done. We now need a signal in our QML so we can call a Cpp function. For that we just declare it that way: @Rectangle { id: topLevelComp signal resizeMyApplication() // more code .. }@ Now we can emit it in our onClicked notification: @onClicked: { topLevelComp.width = 0 topLevelComp.height = 0 resizeMyApplication() }@ In Cpp we have got our QML-ApplicationViewer. For that case i'll use a QQuickView. We have to get the rootObject() of our Viewer: @QQuickView *view = new QQuickView(); // ... some code QObject *obj = (QObject *)view->rootObject();@ Now we just have to connect the signal with a given slot or signal, for example: @connect(obj, SIGNAL(resizeMyApplication()), this, SLOT(resizeMe()));@ You'll need the resizeMe() slot for that. In the slot you just execute the void MainWindow::rescaleWindow(int w, int h, int x, int y) function. You can also put the resize directly into the slot: @{ this->setGeometry(x, y, w, h); }@ I hope that you'll understand what i mean and that i could help you. Feel free to ask for further informations or read this documentations: "Qml Cpp Integration":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-topic.html "Interacting with QML Objects from Cpp ":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html "Thread on how to: invoke QML methods":http://qt-project.org/forums/viewthread/36154
  • 0 Votes
    4 Posts
    2k Views
    Well it doesn't look like it is a Qt or Cpp problem. I have not worked with matlab yet so i might be wrong but maybe you have to set the correct chunksize and other necessary settings in matlab? bq. so please tell me how to set chunk size, sample rate, bit rate You'll find all the record-settings here: "QAudioEncoderSettings":http://qt-project.org/doc/qt-5.0/qtmultimedia/qaudioencodersettings.html
  • 0 Votes
    6 Posts
    1k Views
    [quote author="bobbaluba" date="1394100498"]onek24 that will just give you notifications when the dimensions of the Item itself changes. Item has properties called width, height, x, y.[/quote] Yes that is right, my answer was based on the answer of Jens who also used the notification onWidthChanged. I just wanted to provide you a way without the Connector.
  • Injecting Events From C++

    5 Mar 2014, 13:09
    0 Votes
    6 Posts
    2k Views
    Alright, glad to see you found a solution. I am also parsing all children recursively. If i couldn't find a children in my list when i try to access it trough my class, it'll search the RootObject again for all children and add it to the list if it found it. This would fix the problem with dynamic object creation in qml, well at least for my purposes. For your purposes i would go ahead and add a signal on which it'll update the list of objects emitted by every created qml-component/object.
  • Get Repeater's child

    23 Dec 2010, 14:56
    0 Votes
    13 Posts
    11k Views
    Thank you for this answer, was very helpful!
  • ShaderEffect explication for 3D effect

    6 Mar 2014, 02:38
    0 Votes
    1 Posts
    634 Views
    No one has replied
  • 0 Votes
    2 Posts
    689 Views
    Ok, well Bidochon, next time just post your question sooner and you won't have to struggle with it for hours. The solution, like you said in your post was to use enabled: false and all you had to do is add this statement in the State like this @ State { name: "loadstep" PropertyChanges { target: introstep opacity: 0 } PropertyChanges { target: prepastep opacity: 0 } PropertyChanges { target: loadstep opacity: 1 } PropertyChanges { target: topmenu opacity: 1 } PropertyChanges { target: prepastep enabled: false } @ ps: Somehow, I always have to ask the question here to figure out the answer myself 10 seconds later…. is that a sign that I need friends ? :-) Bidochon ps: hope that will help someone else out there.
  • Programmatically scrolling ScrollView

    29 Oct 2013, 08:02
    0 Votes
    4 Posts
    3k Views
    I was finally able to move my scroll position by setting ScrollView.flickableItem.contentY
  • [Solved] QML Draw order

    31 May 2013, 20:21
    1 Votes
    7 Posts
    15k Views
    [quote author="tedmiddleton" date="1370140219"] Having to hack the tooltip under the common parent to get draw order right is ugly because it works against code re-use and encapsulation. Because of this issue, as far as the knowledge that I have right now goes, I wouldn't be able to make a reusable widget that draws its own tooltips. [/quote] I have the same problem as you, and I was looking for a solution without breaking the encapsulation rules, if you got any please let me know. Thanks
  • Move particles through a custom path

    5 Mar 2014, 16:14
    0 Votes
    1 Posts
    468 Views
    No one has replied
  • Resizing QML controls

    5 Mar 2014, 09:36
    0 Votes
    3 Posts
    1k Views
    [quote author="Jens" date="1394013563"]This is what GridLayout is for: http://qt-project.org/doc/qt-5.1/qtquicklayouts/qml-qtquick-layouts1-gridlayout.html There is also an example that shows how to use it here: http://qt-project.org/doc/qt-5/qtquickcontrols-controls-basiclayouts-example.html[/quote] Hi Jens, Thank you very much. I was really looking for this control. Warm Regards Ansif
  • Passing parameters between windows

    2 Mar 2014, 11:59
    0 Votes
    3 Posts
    3k Views
    ok I solved without knowing it. the data is from this javascript function. in the dialog was enough for me to do so: @ Text { anchors.centerIn: parent text: "AUTORE: " + author + "\n" + "EDITORE: " + editor } @ this is the javascript function, and is called in the main.qml @ function load() { listModelJson.clear(); var xhr = new XMLHttpRequest(); xhr.open("GET","http://www.sito.com/file.php", true); xhr.onreadystatechange = function() { if (xhr.readyState == xhr.DONE) { if (xhr.status == 200) { var jsonObject = JSON.parse(xhr.responseText); for (var i in jsonObject) { listModelJson.append({ "title" : jsonObject[i].title, "author" : jsonObject[i].author, "editor" : jsonObject[i].editor }); } } } } xhr.send(); } @ thanks!!
  • [solved] Custom dialog

    4 Mar 2014, 10:36
    0 Votes
    4 Posts
    2k Views
    And another sample, based on window: @ import QtQuick 2.0 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.0 Rectangle { width: 400 height: 400 Window { id: win_dialog flags: Qt.Dialog title: "Error message" modality: Qt.ApplicationModal ColumnLayout { anchors.fill: parent Text { text: "Text of sample" } Button { text: "close" onClicked: { win_dialog.visible = false; } } } visible: false } Button { text: "Show dialog" onClicked: win_dialog.visible = true; } } @
  • 0 Votes
    12 Posts
    12k Views
    Hi Andre, Yes, it depends :) And I find another way to play with ListView model qmlRegisterType a customized C++ Model such as: @ qmlRegisterType<MyModel>("cn.com.isoft.demo", 1, 0, "MyModel"); @ QStringList property such as: @ Q_PROPERTY(QStringList myLists READ myLists NOTIFY myListsChanged) @ put MyModel in QML such as: @ import cn.com.i-soft.demo 1.0 ... ListView { ... MyModel { id: myModel } model: myModel.myLists delegate: Rectangle { ... Text { text: modelData } } } @ Regards, Leslie Zhai
  • 0 Votes
    2 Posts
    2k Views
    This has been reported here: https://bugreports.qt-project.org/browse/QTBUG-36761
  • How can I set iconSize in ToolButton?

    26 Feb 2014, 19:45
    0 Votes
    6 Posts
    12k Views
    Hi Jens, When using ToolButton and Actions the scaling seems to be wrong on Android. Adding an Image {} inside ToolButton and also setting the image source in an action would create two images. Is this a temporary scaling bug for Android or how should I do this correctly? [quote author="Jens" date="1393503948"]True the ToolButton has a preferred platform specific icon size. For the time being the obvious workaround would be this: @ ToolButton{ id:openFile width: parent.height Image { source: "qrc:/images/zoom.png" anchors.fill: parent anchors.margins: 4 } } @[/quote]
  • No Opacity on top of Opacity

    28 Feb 2014, 23:54
    0 Votes
    4 Posts
    941 Views
    You're welcome! P.S. It's possible ;) http://www.troll.me/2012/01/24/uncategorized/late-night-coding-zero-build-errors/
  • Maps, Location API, custom plugin and QML

    1 Mar 2014, 22:35
    0 Votes
    2 Posts
    1k Views
    Ok, I believe that I have to subclasse QQuickPaintedItem or to use the Scene Graphe API. http://qt-project.org/doc/qt-5/qtquick-visualcanvas-scenegraph.html#custom-items-using-qpainter Hum. I go to use a GridView and a ListModel, it's easier ;-)
  • 0 Votes
    4 Posts
    1k Views
    Indeed, sorry I didn't state it explicitly, you have more information about the procedure "here":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-definetypes.html