Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • How to pack the c++ data into QVariant Object list

    4
    0 Votes
    4 Posts
    1k Views
    shavS
    Hi, You can use code like this: @ QVariant getVaraintObect() //This method must have prototype with Q_INVOKABLE macros in you C++ class. { QVariantMap map; map["key1"] = list; //your QVariantList object with items. map["key2"] = 20; //your int value. //.... return QVariant(map); //The method return QVariant object. } @ In QML you call the method of your class which must to return to you your QVaraint object, for example: @ Text { text: yourCPPObject.getVaraintObect().key2. } @ In result you must see 20 in Text element of your QML file. Also you can use console.log to print all structure of object: @ console.log(yourCPPObject.getVaraintObect()); @ In result you must must see something like this: @ {"key1": [], "key2": 20} @
  • QML Binding is inversed

    3
    0 Votes
    3 Posts
    1k Views
    C
    Property declarations in QML are declarative, not imperative. There is no (explicit or implied) ordering of when declarations will be resolved by the engine. If you do need such guarantees, then you should instead call an imperative init() function which sets those properties in the order you expect. Note that the engine implementation may change (to achieve better optimization, for example) in a subsequent patch release which might change the order in which those declarations are resolved, which would "break" your code, so your workaround is a dangerous one. Cheers, Chris.
  • How to show swf file in webview!

    2
    0 Votes
    2 Posts
    2k Views
    E
    the file's location, where is? try it with the file path
  • How to set individual combo boxes currentindex?

    4
    0 Votes
    4 Posts
    1k Views
    G
    Thanks for your suggestion and reply!!
  • How to save and read from .ini file using QSetting from the custom path

    4
    0 Votes
    4 Posts
    4k Views
    SGaistS
    Hi, Even with elevated rights you can't do everything. Ini files don't belong to the same folder as your application especially since you will be writing to it. You have a set of paths you can use (and that are recommended) You can retrieve them use QStandardPaths Hope it helps
  • Animate Image on changing source property

    2
    0 Votes
    2 Posts
    1k Views
    J
    Well, you can make a tiled sprite and use Sprite QML type to do animation. it's easy and quick.
  • How to convert string to double ?

    4
    0 Votes
    4 Posts
    17k Views
    X
    Ah sorry I misunderstood you, I thought you wanted to convert a string to a number, but if you want to add comma you want to convert a number to a string (numbers can't have commas of course, so you need a string to display the number as a formatted string). :) It makes no sense to do something like @ text: parseFloat("20") @ because that will convert the string "20" to a float and then convert it back to a string "20", which is the same as before obviously. there is no easy way of doing that I guess, you can maybe use a regular expression, I found this on "stackoverflow":http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript it looks like a good solution: @ function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } @ or you can do it by yourself, split the string and add commas, but the result will be the same :) Edit: Just got an idea, maybe you can also use QLocale and Qt's number formatting, since all you want is a thousand separator and QLocale::toString should be able to do that for you, but you need c++ for that, don't think that can be done from QML.
  • Handling States from another qml file

    2
    0 Votes
    2 Posts
    747 Views
    S
    You can use a signal which sends the properties to your "menu.qml". Just define a signal in "menu.qml" and execute this signal in "submenu.qml". In "menu.qml" you can define an "onYouSignal" function where you can do anything with send values from "submenu.qml".
  • Performace Problem with Text

    8
    0 Votes
    8 Posts
    2k Views
    F
    Hey, i just installed the 5.3.0 RC. The problem is solved with this release. Thanks! Greets Nico
  • Bad Resolution of SVG's on iOS and Mac Retina Displays

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • How to unpack all the data's in C++ of type QVariant that send from QML

    2
    0 Votes
    2 Posts
    1k Views
    sierdzioS
    Try this: @ QVariant qmlData; QVariantList temp = qmldata.value<QVariantList>(); foreach (QVariant var, temp) { QObject *myObject = var.value<QObject *>(); if (myObject) { // yay! } } @
  • Re-size Image

    1
    0 Votes
    1 Posts
    506 Views
    No one has replied
  • Seg fault: WorkerScript.onMessage called after destructor

    2
    0 Votes
    2 Posts
    807 Views
    U
    Filed a bug: https://bugreports.qt-project.org/browse/QTBUG-38863 Loader and WorkerScript don't work well together.
  • How to get all the elements of qml file dynamically in C++ class

    2
    0 Votes
    2 Posts
    679 Views
    T
    Is it enough for you: http://qt-project.org/doc/qt-5/qtqml-cppintegration-interactqmlfromcpp.html ?
  • QML big memory consumption?

    12
    0 Votes
    12 Posts
    9k Views
    X
    I don't know if there are any performance comparison charts for Qt/QML apps (maybe one will create some, who knows), but I have currently two Qt Quick 2 apps and they usually use 40-60 Mb memory and not more, they are text, image and network heavy and use multiple screens and stuff, so not the simplest app every I would say.
  • [SOLVED]Qml OpenGL Shaders requirements

    9
    0 Votes
    9 Posts
    3k Views
    S
    all of these are no surprise. whatever driver you're using on desktop, it sucks. likely it's nvidia, and they let just about any bad-behavior code go.. if ( r < (range - depth) || r > (range + depth) ) return; ^ that should result in garbage data, which it did. either you always define gl_fragcolor, or you use discard and the fragment shader will not run for that fragment.(which could potentially result in garbage). same with the explicit type usages, one should always be explicit in any type conversions. it's just the way glsl is, and nvidia is very annoying in the sense that they allow broken code.
  • Blur effect for Rectangle

    4
    0 Votes
    4 Posts
    4k Views
    sierdzioS
    [quote author="freddy311082" date="1399480977"]because the rectangle can be in any place over my application, so, I can't have an exactly component as source....[/quote] That has nothing to do with the blur effect, it still needs to be applied over your semi-transparent rectangle. Best option is to make it fill it's parent. And if you need to place it in an arbitrary place, then do that with the base Rectangle, not with the blur. In any case, please check the console log. I am almost certain the QML engine is printing some errors because you are mixing anchors and fixed coordinates. In that case, don't be surprised it does not work ;-)
  • Polling for SDL events in a custom QObject-derived C++ class?

    2
    0 Votes
    2 Posts
    2k Views
    P
    If the API that you are using for polling events is blocking, then a thread is the only option. Otherwise you can install a even filter at either the QApplication or your top level widget and do you work whenever a paint event comes. In case of QML, I dont remember the exact details but scenegraph renders emit frame start and frameend signals. A simple search on google should give you the exact api. Just be aware if the poll method will take a long time thread approach will be better
  • Is any Auto Repeat function for image in qml?

    4
    0 Votes
    4 Posts
    3k Views
    M
    thanks favoritas37 i used it. :)
  • ListView, PathView, GridView multiple instance touch event support

    1
    0 Votes
    1 Posts
    571 Views
    No one has replied