Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Access QObject Item from a QList

    4
    0 Votes
    4 Posts
    1k Views
    M
    [quote author="Zlatomir" date="1405190039"]You need to cast the pointer to the correct type, recommended ways are: dynamic_cast or (because you have a QObject) "qobject_cast":http://qt-project.org/doc/qt-5/qobject.html#qobject_cast: @ Champions* item2 = qobject_cast<Champions*>(datalist.at(2)); if(item2) item2->name(); @ [/quote] Thanks a lot ! It works well for me !
  • How to set dashed border in QML?

    3
    0 Votes
    3 Posts
    5k Views
    M
    i think it is possible with CSS, but i don't know the way.. btw, thanks
  • Qml problem with font size

    4
    0 Votes
    4 Posts
    2k Views
    G
    switching to pointSize do not help, the same problem !https://lh3.googleusercontent.com/-bv71O37AKeo/U8Iwagd8XJI/AAAAAAAAG_Q/wdfXHMnbnBg/w549-h878-no/Screenshot_2014-06-27-18-20-56.png(qml problem)!
  • Different OS's, different font sizes?

    4
    0 Votes
    4 Posts
    10k Views
    T
    Point sizes are device-independent. A 16pt font should theoretically be the same size no matter what device you're on or what the density of the screen is, assuming that the vendor of the display follows "VESA standards":http://en.wikipedia.org/wiki/Extended_display_identification_data. You can use JavaScript expressions in QML to achieve a percent value. For example: @font.pixelSize: parent.width * 0.9@ That's 90% of the parent.width. Figure out what you want 90% of, then multiply by 0.9. ;)
  • How to access a root context from QObject?

    3
    0 Votes
    3 Posts
    2k Views
    C
    Here's the full answer to the question. Inside your QObject derived subclass, you can do the following: @ // get rootContext() and required contextProperty as QVariant QVariant myobject_v = qmlEngine(this)->rootContext()->contextProperty("myname"); // cast QVariant first to QObject* and then to my desired ObjectClass* ObjectClass myobject = qobject_cast<ObjectClass>(qvariant_cast<QObject*>(myobject_v)); @ http://stackoverflow.com/a/3918893/532513 showed how to cast from QVariant to ObjectClass*, the rest was found through snippets of documentation scattered all over the place. :|
  • Javascript assignment destroys property binding

    11
    0 Votes
    11 Posts
    3k Views
    JKSHJ
    [quote author="flobe" date="1405152382"]Well, I'm looking for a reusable toggle button component which state (on or off) can be controlled by a mouse click (which results in - as far as I see - a Javascript assignment) as well as from a state property of another QML item. ... I have just checked the CheckBox implementation of QtQuick.Controls which show the same problem. It is not possible to keep two CheckBox items in sync by using property bindings.[/quote]I think that makes sense. A CheckBox and ToggleButton have a boolean property. Usually, the mouse controls that property. If you bind that property to an external boolean variable, then the external variable will also try to control that property. You now have two different and unsynchronized things trying to write to that property -- this can create conflicts, as you've discovered. I think your onStatusChanged solution is the only way to achieve what you want.
  • [SOLVED]Adding Tab in existing TabView from C++ side

    4
    0 Votes
    4 Posts
    3k Views
    M
    To pass component, pass pointer to QQmlComponent inside fromValue(), as follows... @ QObject* m_pTabView = findChild<QQuickItem >("myTabView"); if (m_pTabView) { QVariant returnedValue; QVariant title = "Hello"; QQmlComponent component = new QQmlComponent(&app.qmlEngine(), QUrl("qrc:/qml/Measurements.qml"), this); QMetaObject::invokeMethod(m_pTabView, "addTab", Q_RETURN_ARG(QVariant, returnedValue), Q_ARG(QVariant, title), Q_ARG(QVariant, QVariant::fromValue(component))); } @
  • [SOLVED] Local storage working on Desktop but not in Android

    11
    0 Votes
    11 Posts
    2k Views
    p3c0P
    That's great. It was a good effort from you. You can mark the thread as solved by editing the thread title and prepend [solved] so that other's may know that this thread has a possible solution.
  • How do I specify an absolute URL for a javascript import?

    2
    0 Votes
    2 Posts
    895 Views
    dheerendraD
    you can try importing like import "../../../../utils1.js" if qml and js are in drive.
  • Howto add a button to a TableView header column

    2
    0 Votes
    2 Posts
    2k Views
    p3c0P
    Hi, Yes that's possible. Check "headerDelegate":http://qt-project.org/doc/qt-5/qml-qtquick-controls-tableview.html#headerDelegate-prop. You will need to create a Button Component and assign to it.
  • Moving Pages using Listview with viewTransition

    6
    0 Votes
    6 Posts
    2k Views
    B
    Hi, I came across pathview..i am trying to get output...will update soon wen completed
  • [solved] Z-order in dynamically created object

    10
    0 Votes
    10 Posts
    4k Views
    p3c0P
    Also another observation, keeping ApplicationWindow if you set the z value of Rect to negative also works as expected.
  • GridLayout rowSpan bug

    1
    0 Votes
    1 Posts
    628 Views
    No one has replied
  • 0 Votes
    7 Posts
    5k Views
    sierdzioS
    That is all really cool, thanks for sharing!
  • Linking error: cannot find -lGL

    3
    0 Votes
    3 Posts
    2k Views
    W
    oh. thanks.
  • How to deal with the "time" basic type?

    9
    0 Votes
    9 Posts
    5k Views
    X
    You are very kind. thank you for your time ! :D
  • Alphabetical index in ListView

    1
    0 Votes
    1 Posts
    700 Views
    No one has replied
  • Focus policy

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Changing element property while being flicked

    2
    0 Votes
    2 Posts
    537 Views
    p3c0P
    Hi, Just another suggestion, would PathView be suitable to you requirement ? Check "PathView":http://qt-project.org/doc/qt-5/qml-qtquick-pathview.html docs. There's "PathAttribute":http://qt-project.org/doc/qt-5/qml-qtquick-pathattribute.html object which can be used to set Opacity or Scale etc.. Once used the corresponding properties are set properly as per the Item's position in the List. Check the example in it's description. With PathView you can simulate a Simple ListView or other Complex paths by setting the proper Path like PathQuad, PathLine etc..
  • Code examples - statemachine using Qt Quick and C++

    7
    0 Votes
    7 Posts
    6k Views
    R
    [quote author="andreyc" date="1404932898"]Thank you for the sample project. I tried to build it and got the errors: @ WARNING: Failure to find: qml.qrc /home/achichinov/Qt5.3.1/5.3/gcc_64/bin/rcc: File does not exist 'qml.qrc' @ Do I need to create it or you missed it in your submit?[/quote] Thanks. I forgot that it doesn't add those by default. I've added it to source control and it's out there now.