Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • 0 Votes
    4 Posts
    2k Views
    J
    I'm missing big parts of your code. Next time please place your code between at-sign characters (most right icon on the top) I do not quite understand what your trying to do, but as far as I know putting JavaScript code in the component does not work. You may put them in the attached property Component.onCompleted. @ Loader { id: cmpntLoader Component{ id: dialogComponent property int slotNum // I expect you have something like this too Component.onCompleted: { var component = Qt.createComponent("BrandPopup.qml"); if (component.status === Component.Ready) { component.createObject(main, {"slot":slotNum}); } } } @ Maybe it would help if you give a more complete example of your code to show what you try to do.
  • How does the "Getting Started" tutorial code actually launch?

    3
    0 Votes
    3 Posts
    1k Views
    U
    I'm using Qt 5.1.0 and the following process works for me. Copy an example directory to somewhere. $ cd ~/src $ cp -r /usr/local/Qt-5.1.0/examples/quick/tutorials/gettingStartedQml/parts/part5 ./ Make plugins of the example (if any). $ cd filedialog $ qmake $ make When you see .pro file, you can execute qmake and make to build .cpp files. Run the example $ cd ~/src/part5 $ qmlscene TextEditor.qml
  • Public API for creating user defined basic types

    2
    0 Votes
    2 Posts
    792 Views
    SGaistS
    Hi, Since it's getting to private API, you should rather ask this question on the interest mailing list, you'll find Qt's developers/maintainers there (this forum is more user oriented)
  • 0 Votes
    6 Posts
    5k Views
    sierdzioS
    I don't think they are in any way related.
  • Help with this simple property change

    6
    0 Votes
    6 Posts
    1k Views
    Q
    In the gradient stop, I should have used testrect.gradcolor. I forgot to reference where the property came from.
  • 0 Votes
    8 Posts
    10k Views
    C
    Oh! Sorry, I clearly wasn't paying attention. My bad. You get the same error? If you #include <qqml.h> does it fix the issue? I expect not, since I assume that the QQmlEngine header would include that, but clearly there's some header in the module which is included by the module include (QtQml) but not from QQmlEngine or QQmlView... Strange. Cheers, Chris.
  • Problems with Gridview

    5
    0 Votes
    5 Posts
    2k Views
    D
    Thanks for your response and explanations Jens. I've definately learnt a bit more about Qml.
  • Cannot set an image background in a Button (qt quick controls)

    3
    0 Votes
    3 Posts
    2k Views
    M
    Thank you, I've work around it with the Image child solution ;)
  • [Solved] ComboBoxStyle: QtQuick.Controls and QtQuick.Controls.Styles

    8
    0 Votes
    8 Posts
    5k Views
    H
    I've recreated the files (luckily in the bin) and reopened the project. It now works. I have no idea of what happened, and why I cannot reproduce the error. In the meantime I have also rebooted Qt Creator (it hang - otherwise I would not have done this). Maybe the issue was related to that as well? (Qt Creator was not rebooted before I got it working in the new project, so it was not the reboot only that did it) Again, thanks for your help.
  • Import Qt Quick Components

    5
    0 Votes
    5 Posts
    2k Views
    I
    ah ok very nice thank you
  • How to change the Screen coordinates to bottom left corner

    3
    0 Votes
    3 Posts
    1k Views
    ?
    [quote author="sierdzio" date="1375952043"]This is the standard in TV and graphics: the root is top left corner. You can rotate the whole scene using Transform element, that would simulate a different coordinate system.[/quote] Hi, I Will try this. Thank you
  • How to use console.log in this case

    3
    0 Votes
    3 Posts
    946 Views
    Q
    I see, so the brackets basically act like an anonymous function in place.
  • Tree View on QML

    4
    0 Votes
    4 Posts
    10k Views
    U
    :) Wow this post was unanswered for a long time which had me post a simplified version of the code I used in my project at http://www.codeproject.com/Articles/632795/QML-TreeModel-and-TreeView a few days back. Component recursion and apropriate javascript object for the model can build trees (etc.) of any complexity. The code is dynamic and can add / nest subnodes to any depth.
  • Who takes care of deleting QImage returned from QQuickImageProvider?

    4
    0 Votes
    4 Posts
    2k Views
    C
    It's a cache of QQuickPixmap rather than QPixmap. I should have been clearer. Probably best to read the code I linked at gitorious. To create a texture from a QPixmap, it is first converted to a QImage. The rest of the code is basically identical, and it's cached the same way (what is cached is QQuickPixmapData which consists of a texture factory for the image data). In short, two requests for the same QQuickPixmap (ie, see QQuickImage for an example) won't need to go through the provider->requestImage() or provider->requestPixmap() codepath; instead, the data will be returned directly from the cache. Performance should be mostly identical, I guess. Benchmark it to find out for yourself though, as I may be wrong about that. Certainly pixmap.toImage() must have some overhead. What is eventually rendered is a texture, not a pixmap or an image, of course. Cheers, Chris.
  • The model data in the model data

    2
    0 Votes
    2 Posts
    815 Views
    JKSHJ
    Hi, You probably want a tree model, not a list model. Let your top-level model have 1 column, and m rows for m people. Let each top-level item contain a child model with n rows for n phones. The child model should have 4 columns, one for each property of the phone (name, colour, model, image).
  • 0 Votes
    8 Posts
    3k Views
    SGaistS
    Read this "followup":http://woboq.com/blog/qthread-you-were-not-doing-so-wrong.html article. Most of the time you don't need to subclass but in some cases you have to
  • Best way to load an QML item from Qt plugin, written in C++

    1
    0 Votes
    1 Posts
    542 Views
    No one has replied
  • [SOLVED] Sorting in QtQuick 1.1 GridView

    3
    0 Votes
    3 Posts
    1k Views
    napajejenunedk0N
    Yes, I've already resolved the case by just calling the sort of the QSortFilterProxy model since it was not enough just to reimplement the lessThan() member function. Forgot to mark the topic as solved.
  • How to use "Qt Desktop Components" on Qt5

    11
    0 Votes
    11 Posts
    5k Views
    C
    So I finally figured it out. There's no QtQuick 2 template with C++ integration that supports QtQuick.Controls in QtCreator out of the box as of now (version 2.8). We will have to create an empty Qt project from scratch: File -> New File or Project -> Other Project -> Empty Qt Project let's name it 'mytestproject' Modify mytestproject.pro by adding this: @ TEMPLATE = app TARGET = mytestproject QT += qml quick widgets @ Add main.qml file to the project @ import QtQuick 2.1 import QtQuick.Controls 1.0 ApplicationWindow { id: rootWindow height: 500 width: 500 visible: true // <-- this is important because the window is hidden by default Button { text: "Quit app" anchors.centerIn: parent onClicked: { Qt.quit(); } } }@ Add main.cpp file to the project @ #include <QApplication> #include <QQmlApplicationEngine> int main(int argc, char** argv) { QApplication app(argc, argv); QQmlApplicationEngine engine("main.qml"); app.exec(); } @ Disable Shadow build QtCreator creates a shadow directory by default where it builds our application. i.e if our app is located at: /home/foo/mytestproject then it will create a debug and release directory at: /home/foo/mytestproject-Debug-Desktop /home/foo/mytestproject-Release-Desktop This means that inside 'main.cpp' the QQmlApplicationEngine won't be able to find our 'main.qml' file that we want to load. I don't know any other workaround, so let's just disable the shadow directory feature altogether and let's build our application inside it's folder. To do this click on the large Projects icon on the lefthand side of QtCreator and untick 'Shadow build'. Build Run and Enjoy Now the project should be building and we should be seeing a window with a buton.
  • Qt Quick controls styling ToolBar, MenuBar and StatusBar

    2
    0 Votes
    2 Posts
    2k Views
    J
    The simple answer is that you can only style those components that provide a style at the moments. The others will come in a later version. This includes MenuBar which is tricky as it depends on the platform if it can even be styled or not (think mac os/ubuntu). But ToolBar and StatusBar are actually quite easy to work around. Both of them can be replaced by any item. Ie to create a custom toolbar all you have to do is: @toolBar: Rectangle { color: "red" height: 40 width: parent.width }@ StatusBar is similar. The only drawback is that you have to provide your own margins and the tool bar will not automatically adjust to content height but that should be easily solved by adding anchors or a layout.