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
    20k Views
    F
    [quote author="Hawk30100" date="1400049362"]TextEdit and TextInput are derived classes from ... QWidget I think TextArea and TextField was added with QtQuickControls. They are derived classes from ... QQuickItem. [/quote] Thanks Hawk, but Jens was right, I wasn't talking about QWidget at all :) [quote author="Jens" date="1400058672"] I could probably add that TextField and TextEdit make use of TextInput and TextArea as part of their implementation.[/quote] Thanks Jens! Realizing that a TextField actually embeds a TextInput, and a TextArea actually embeds a TextEdit clears lots of doubt :) For those interested, you can see how TextField and TextArea are implemented here: C:\Qt\Qt5.2.1\5.2.1\Src\qtquickcontrols\src\controls\TextField.qml C:\Qt\Qt5.2.1\5.2.1\Src\qtquickcontrols\src\controls\TextArea.qml
  • [solved] Derived Component?

    3
    0 Votes
    3 Posts
    994 Views
    D
    Oh, I didn't realize. I tried it and it seems to work! Thanks!
  • 0 Votes
    2 Posts
    727 Views
    E
    I cropped the image using QImage copy and scaled method. Now I want to fit the cropped image in the full window when increasing and decreasing the window. Anybody suggest ideas its very helpful to me for proceeding.
  • Question regarding Loader and Signals

    10
    0 Votes
    10 Posts
    8k Views
    ?
    [quote author="arrowhou" date="1384162598"]So it is. Thanks![/quote] Hi, I also found that "ignoreUnknownSignals:true" will solve the above problem. Please mark this post as "Solved, if that solves the problem. Ansif
  • Resolution independent gui

    9
    0 Votes
    9 Posts
    6k Views
    O
    Hello, certainly there is a very good way on how to create an resolution independent gui using for example the metric system and centimeters. You will have to import QtQuick.Window. @import QtQuick 2.2 import QtQuick.Window 2.0@ Then you can just ask the class Screen for the pixelDensity of our screen: @function cm(cm) { return cmScreen.pixelDensity10 }@ If we access the function that way: "... width: cm(1)", then the width will be 1 centimeter wide.
  • 0 Votes
    2 Posts
    2k Views
    B
    I found out that it is possible (and easy) to directly pass a component created in C++ to QML. So right now, I modified the code pretty much like this: @ WindowManager::prepareNewView(int stuffId) { MyDatabase db; // Getting something to show in QML from somewhere based on the parameter received SomeStuff stuff = db.getStuff(stuffId) // Creating the new context, based on the global one QQmlContext *context = new QQmlContext(this->rootContext()); // Exposing the object I need to show in QML to the new context context ->setContextProperty("someStuff", stuff); // Creating the component QQmlComponent component(this->engine(), QUrl("qrc:/qml/MyComponent.qml")); // Creating the istance of the new component using the new context QQuickItem *newView = qobject_cast<QQuickItem*>(component.create(context)); // Getting the root component (the Rectangle with it mainWindow) QObject *object = this->rootObject(); // Manually setting the new component as a child of mainWIndow newView->setParentItem(qobject_cast<QQuickItem*>(object)); // Invoking the QML that will connect the events of the new window, while passing the component created above as QVariant QMetaObject::invokeMethod(object, "addView", Q_ARG(QVariant, QVariant::fromValue(newView))); } @ In QML the function in the main.qml is now like this: @ // Function called from C++; the param "newView" is the last component added function addView(newView) { // ... Here I would use the new view to connect signals to slots and such as if I created "newView" directly in QML } @ So I managed not to change the code too much after all.
  • Add image slider in Qt Quick

    1
    0 Votes
    1 Posts
    691 Views
    No one has replied
  • How to Color an Image

    8
    0 Votes
    8 Posts
    2k Views
    E
    Thank you all.I Solved it by registering QGraphicsColorizeEffect and applying effect for QML Image.
  • Help me to make an Animation :-(

    1
    0 Votes
    1 Posts
    444 Views
    No one has replied
  • [SOLVED] How to get path to photo gallery

    3
    0 Votes
    3 Posts
    993 Views
    J
    Well, the pure QML may not help you in any way, I am looking for solutions too. As an alternate, QStandardPaths::standardLocations(QStandardPaths::PicturesLocation); sounds good.
  • Emitting signal from different thread causes QML to crash

    2
    0 Votes
    2 Posts
    2k Views
    K
    Hi, I answer to that old thread because I have the exact same issue with Qt 5.2.1 and Qt 5.3 RC. Is it possible to use Connections to connect a C++ signal from a non-main thread to a QML slot ? The error I get is @QObject::setParent: Cannot set parent, new parent is in a different thread@
  • [SOLVED] QtQuick2ControlsApplicationViewer connect signal to slot

    3
    0 Votes
    3 Posts
    2k Views
    H
    Thanks! I just did what you said. Installed Qt Creator 3.1 and used the engine class. Works perfect! I also manually transfered all data from my old projekt into a new one. Just saw that some new files will be added to the project if you create a new project within Qt Creator 3.1. "qtquick2controlsapplicationviewer" was replaced with "deployment" folder and the qml-files(quick2) will be added to the resources folder instead of the QML folder.
  • Image mask particle system differs

    3
    0 Votes
    3 Posts
    898 Views
    p3c0P
    Hi, I tested your code on Ubuntu 14.04 with Qt 5.2.1 and it works as desired. What is your development environment ? !http://i59.tinypic.com/2hdyy9w.png(Output)!
  • List Model elements from Qt to QML

    1
    0 Votes
    1 Posts
    431 Views
    No one has replied
  • Link Slider and TextInput values together

    1
    0 Votes
    1 Posts
    752 Views
    No one has replied
  • Render QML element as bitmap

    10
    0 Votes
    10 Posts
    4k Views
    T
    Yes! Maybe I will use some tricks to do that. If I have any problem I will ask you. Thank you so much :)
  • Enums not working or be referenced correctly in QML

    8
    0 Votes
    8 Posts
    5k Views
    X
    QML ist mostly "just" JavaScript, and JS has dynamic objects. so the code is valid if you try something like this: @ var obj = {} // empty object console.log(obj.foo) @ obj.foo is valid code, it will just be undefined and that is why your code shows no warnings or error, you just try accessing a property that is not there and Qt will convert "undefined" to 0 if the target type in c++ is an int :)
  • 0 Votes
    2 Posts
    1k Views
    G
    Fail was here... @QQuickView *view = new QQuickView; view->rootContext()->setContextProperty("translation", (QObject *)&translation_obj); view->rootContext()->setContextProperty("json", (QObject *)&file_obj); // Moved up this line... :D view->setSource(QStringLiteral("qml/Main.qml")); view->show();@ Now everything works fine ;)
  • QML serialization for saving whatever on the image

    4
    0 Votes
    4 Posts
    1k Views
    T
    For saving QML element into image, I still don't know how to do it with QT >5.0 any guide I have read are for 4.8. If you know that, you can share it
  • How to Using tableView model in C++ code with UI in QML

    13
    0 Votes
    13 Posts
    5k Views
    ?
    [quote author="Andre" date="1399887061"]No, you'll have to do your own debugging. This forum does not provide a free debugging service.[/quote] Thank you for helping I try to solve it.