Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • [SOLVED] Wierd looking text in TableView section in Qt 5.1.0 Beta

    7
    0 Votes
    7 Posts
    4k Views
    R
    Unfortunaltey I do not get a real solution to the problem, but I found setting "renderType: Text.NativeRendering" of text that renders wierd to use solved my immediate problem. There are some disadvantages to this when the text is animated in any way. The blog post explains it in more detail: "Native-looking text in QML 2":http://blog.qt.digia.com/blog/2012/08/08/native-looking-text-in-qml-2/ Below is how I changed my text to display properly: @ Text { id: ta x: 20 text: section renderType: Text.NativeRendering // Added this } @ Hope that helps.
  • Program doesn't generate QML

    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    That's the wrong template, you should create a new Qt Quick application
  • Error: array initializer must be an initializer list or string literal

    3
    0 Votes
    3 Posts
    13k Views
    A
    It is discouraged to use C-style static arrays in C++; the code you wrote will probably not compile because of not specifying an array size beforehand. Instead of going this way, have a look at "C++ std::string":http://www.cplusplus.com/reference/string/string/ or better yet, since you're dabbling in Qt, stick to "QStrings":http://qt-project.org/doc/qt-5.0/qtcore/qstring.html when wanting to represent textual data of any kind and to "QByteArrays":http://qt-project.org/doc/qt-5.0/qtcore/qbytearray.html when wanting to represent "lower-level" data (bytes, flags, et cetera). @#include <QByteArray> #include <QDebug> #include <QString> int main() { QString string = QString::fromUtf8("This is a test QString variable. ½ ¼ ¾ ⅓ ⅔ † ‡ µ ¢ £ €"); QByteArray array = string.toUtf8(); qDebug() << string; qDebug() << array; }@
  • OpenGL 3.2+ and Qt Quick2

    13
    0 Votes
    13 Posts
    5k Views
    W
    I just compiled and ran the exact same code on windows on the same machine and it worked perfectly. It seems it's an OS X issue :/
  • Remove element from Row when changing states

    1
    0 Votes
    1 Posts
    573 Views
    No one has replied
  • How to access other QML elements ?

    2
    0 Votes
    2 Posts
    899 Views
    A
    You should read on the "QML Object identifier attribute":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-syntax-objectattributes.html#the-id-attribute, and then also on the "QML Object scope":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-documents-scope.html#component-scope.
  • What is .qmlproject file?

    3
    1 Votes
    3 Posts
    10k Views
    T
    .qmlproject is used by Qt Creator to handle projects that are QML-only. As Tomma already said, these kinds of projects use the Qmlviewer application to show QML files. This is rather convenient to play with small examples, but requires that a qmlviewer is installed. It also makes it close to impossible to use such projects on devices since it is very hard to limit these apps in what they can do. Basically the qmlviewer will need to have all the interesting permissions (access the network, etc.) so that all Qml applications will actually run in it and all these Qml applications will inherit those permissions. That is why bigger non-toy things have a .pro file that builds a small piece of code that is basically a stripped down Qmlviewer application and bundles that with the Qml files. This is a separate binary then which gets its own set of permissions. Since this binary is specific to one Qml application you can limit the program to those it actually needs to function.
  • 0 Votes
    2 Posts
    2k Views
    T
    Please "file bug reports":https://bugreports.qt-project.org/ about regressions. Bugreports will be seen by the developer, while it takes a bit of luck for the issue to get noticed here.
  • OpenGL (QGLWindow) functionality in QDeclarativeView

    7
    0 Votes
    7 Posts
    4k Views
    W
    Just found out that signals in QML (to c++) don't work. Changed QDeclarativeView->setScene etc. to QDeclarativeView->setSource Now it works. QGLWindow overlaps qml page.
  • Importing an existing QScriptExtensionPlugin to QML

    7
    0 Votes
    7 Posts
    3k Views
    T
    Now that I'm finally porting our Qt4 code to Qt5 I need to solve this issue somehow. to QJS[X] seems to be mostly straightforward stuff. Still, solution to the original problem with integrating my custom extensions to QML applications isn't obvious. Could someone elaborate the stuff a bit? I don't believe our need is unique in any way: we just need to be able to use our JavaScript extensions from both JavaScript and QML. I'm really surprised how difficult it really is to extend JavaScript this way in Qt5. It may be due to the lack of documentation, and I may certainly have missed something, but this is how I see it: QtScript seems to be phased out, and it isn't compatible with QML anyway. There is no documented extension mechanism for QJSEngine. There is an extension mechanism for QML, but the JavaScript global object is read-only. The simple question is: how do I add my own JavaScript extensions to QML applications? This is already a bit out of topic, but I have to admit I'm bit lost regarding the integration of C++ and QML code. I cannot see QJSValue appear anywhere in QML documentation. Does this mean QML has its own set of reflection objects to the C++ side? Such as QQmlProperty? Let's assume I have this QML code: @ // main.qml import QtQml 2.0 QtObject { id: test function test() {} } @ Assume I have created an object out of the "test" component: @ QQmlEngine engine; QQmlComponent component(&engine, QUrl::fromLocalFile("main.qml")); QObject* test = component.create(); @ Now I have a QObject pointer in C++. How do I iterate the properties and functions the QML object has? How do I add another function, say test2() to the object? What about adding properties? How do I call test()?
  • I need to connect a ComponentA Signal to a method of another ComponentB

    5
    0 Votes
    5 Posts
    2k Views
    S
    Thank you but i have a new problem with connections. Why i can't sometime access someObject with his unique ID ?
  • Qt MultmediaKit

    9
    0 Votes
    9 Posts
    4k Views
    M
    [quote author="aabc" date="1352733663"]Does it work now ?[/quote] Yes, works fine. I installed this package: http://packages.ubuntu.com/quantal/libdeclarative-multimedia
  • The problem with exception handle in QML 2 plugin

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Load shared library with QML files in resource file

    2
    0 Votes
    2 Posts
    4k Views
    F
    I found out, that putting a DynamicallyLoadedTestItem into the main.qml file did work! But only if the import of the plugin is added in the main.qml, otherwise the same error with type not being found occurs. Here is the source code: @ // main.qml: import QtQuick 1.1 import MyPlugin 1.0 Item { // this DOES WORK! but only if import MyPlugin 1.0 is added in main.qml DynamicallyLoadedTestItem {} // this causes the error "TestItem is not a Type" TestItem {} } // DynamicallyLoadedTestItem.qml: import MyPlugin 1.0 TestItem { } @ It seems that in the first loaded qml file the dynamic library is not loaded, but when another file is loaded it is available. Shouldn't the QML engine take care of completely loading the library before initializing it? Or how can I load it in advance so the library is accessible when the first qml file gets parsed?
  • [SOLVED]Returning a QList<QHash<QString, QString> > to Qml ???

    4
    0 Votes
    4 Posts
    6k Views
    T
    Thank you, it works wonderfully! QVariantList with QVariantMap is exactly what I was looking for :D I just wish I could mark a question as answered, and vote up answers and stuff...
  • Debugging small memory / cpu leaks

    6
    0 Votes
    6 Posts
    2k Views
    A
    Thans for your answer. So yea, "comp" and "p" are created in the constructor and therefore only once. "u" is an array with 4 pictures in it from which i randomly choose. "update" is called from a timer and yes setProperty "src" does work as expected. Valgrind could not point my near any hint since i already know which class is leaking. Disabling that class stops the leaking which makes it pretty obvious. Maybe the *size and &requestedSize properties of the image provider have something to do with this?
  • How to use the javascript in QML

    1
    0 Votes
    1 Posts
    727 Views
    No one has replied
  • [Solved] Error using states to change between pages

    4
    0 Votes
    4 Posts
    2k Views
    J
    Hi oosavu You are right I'm overcomplicating things. Using: @onGameclick: root.state = "game"@ and in main.qml: @PagePanel { id: pagepanel state: "menu" }@ works fine. Thank you
  • [solved] Relative URL when creating a reusable QML PageLoader component

    2
    0 Votes
    2 Posts
    1k Views
    P
    Okay, "Qt.resolvedUrl()" ... pretty simple :) All that time reading about import paths and it was right here all along http://qt-project.org/doc/qt-5.0/qtqml/qml-url.html
  • How to use Qt commercial chart

    6
    0 Votes
    6 Posts
    4k Views
    AndySA
    Assuming you have posted a request via the link that JKSH has provided then we should have seen this appear in our system and depending on when you submitted it then it should have been answered. If you contact me directly on andy DOT shaw AT digia DOT com with the details of the request (i.e. your name, license id and the subject you used for the request) then I can try and track it down for you. We do answer everything within 2 working days, so either it is already answered and I'm just seeing this late, or something has gone awry in our system for some reason.