Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • Problems with QML with OpenGL view

    5
    0 Votes
    5 Posts
    5k Views
    C
    Hi ultramanjones, It's not something I've tried to do. But, with your example: @ import QtQuick 1.0 import MDEPlugins 1.0 MDE{ width:200 height:200 } @ Just add some Q_INVOKABLE functions to it, if you want to call those functions from QML. Why can you not access the MDE object from C++? Alternatively, from C++, just qobject_cast (actually, there may be a qgraphics_cast or similar, for graphics-view based stuff, I can't remember) the pointer returned by view.rootObject() as an MDE and access it that way. Or am I misunderstanding what you're trying to do? In general, if you have an Item in QML, you can pass it back to C++ as an argument. Just give it an id, and then pass that id as a QObject* argument to a Q_INVOKABLE function of a helper item. eg: @ // assume that I have a QDeclarativeItem-derived class called // Helper which is installed into the Helper 1.0 namespace // where that class has a Q_INVOKABLE void doStuffWithObject(QObject* arg) { /whatever/ } function import Helper 1.0 Item { id: root MDE { id: mde width: 200; height: 200 } Helper { id: helper } Component.onCompleted: { helper.doStuffWithObject(mde); } } @
  • XmlListmodel with complex XML

    1
    0 Votes
    1 Posts
    1k Views
    No one has replied
  • Qt5 control, shift, all modifiers not working with mouse

    2
    0 Votes
    2 Posts
    2k Views
    sierdzioS
    Works for key events. But I confirm, there are problems with mouse, at least I had some with wheel events.
  • Speed up loading of QML

    9
    0 Votes
    9 Posts
    11k Views
    C
    In QtQuick 2.0, if you set asynchronous to true, loading/compilation will occur on a separate thread, and cooperative instantiation (on the main thread) will be used to instantiate it. Thus, while you won't be guaranteed that there won't be glitches in the animation (since the OS scheduling during loading/compilation might lead to skipped animation updates on a single-core system, and during instantiation the incubator only yields on element boundaries which may also lead to skipped frames) for most use-cases (especially if you're careful with your component design) you should see velvet animations. But you're right - in QtQuick 1.0, everything is done in the main thread, so loading a QML file will block the animation updates.
  • Qml video wmfengine trouble

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • Application unexpected crash while editing Text element (with C++)

    7
    0 Votes
    7 Posts
    2k Views
    G
    Supposing that createApplication does not take a reference to argc, this is what happens: For simplicity, we break down the method to this simple version: @ createApplication(int argc2, char *argv2[]) { return new QApplication(argc2, argv2); } @ You call createApplication(). The runtime system creates a copy of main's argc and passes that as argument to createApplication() which provides it as argc2 in its body. The [[Doc:QApplication]] takes argc2 as reference. It is vital for it that this reference stays alive during the complete life time of the application object - see the warning in the "QCoreApplication constructor docs":/doc/qt-4.8/qcoreapplication.html#QCoreApplication. createApplication() eventually returns the QApplication object and quits. That is the moment, when the runtime system destroys variable argc2. But the QApplication object still holds a reference to that variable - if the memory that was formerly used by argc2 is reused by some other object, and the QApplication tries to read or even write to its argc2 reference you access an invalid memory location - boom! This all does not apply to main(), as main's argc variable is destroyed after the QApplication object has been destroyed. WARNING: It may happen that your program works if using a copy of argc in createApplication, but that's by pure chance and it is not guaranteed! WARNING 2: The very same holds true if you subclass QCoreApplication or QApplication and do not use a reference to argc in your own constructors!
  • One listview, multiple XmlListModels

    4
    0 Votes
    4 Posts
    4k Views
    Q
    Ok i have an other related question. I have so far: A new Model which extends QAbstractListModel. QNetworkAccessManager requests (get) in the constructor. A "replyFinished" slot, where i parse the requests with QXmlStreamReader Add the Data to the Model (QList<News>) (in the replyfinished). News is just simple a class for link,pubdate,description and headline this is my model @ class NewsModel : public QAbstractListModel { Q_OBJECT public: enum NewsRoles { LinkRole = Qt::UserRole + 1, DescriptionRole, DateRole, HeadLineRole }; NewsModel(QObject *parent = 0); void addNews(const News &news); int rowCount(const QModelIndex & parent = QModelIndex()) const; QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const; public slots: void replyFinished(QNetworkReply* reply); private: QList<News> m_news; }; @ if i add news on startup than they are shown in the listview, but not the one i put in the model manually (edit: not manually, through the QNetworkAccessManager in the replyfinished method). @ NewsModel newsModel; newsModel.addNews(News("www.test.com","test","test","test")); view.rootContext()->setContextProperty("newsmodel", &newsModel); @ Do i have to fire a event? Or am i missing a method? EDIT: I just had to look into the addNews method, which was working, so you don't need to fire a event: @ beginInsertRows(QModelIndex(), rowCount(), rowCount()); m_news.append(News("1","2","3","4")); endInsertRows(); @
  • Creating Apps for s60v5

    6
    0 Votes
    6 Posts
    7k Views
    R
    hello, here can any one help me i have downloaded qt SDK v1.2.1 in which I need the entry Qt 4.7.3 for Symbian^1 in the settings menu > build and run > qt versions. so what can i do now please help me
  • Pool QML items

    4
    0 Votes
    4 Posts
    2k Views
    F
    I found a solution that is a little bit hacky, but it works: @ QDeclarativeProperty declarativeProperty(object, propertyName); QDeclarativeAbstractBinding *abstractBinding = QDeclarativePropertyPrivate::binding(declarativeProperty); if(abstractBinding) // if abstractBinding is not null, the property was defined as a binding and thus should not get overwritten @ So it is only doable in C++, and you also need to include private header files qdeclarativeproperty_p.h and qdeclarativebinding_p.h, which depend internally on many other private header files of QDeclarative module and 1 header from QScript module. I could not find another approach without having to include them. Any odds against this approach?
  • Commercial usage of QML components for desktop

    2
    0 Votes
    2 Posts
    3k Views
    sierdzioS
    Licensing for components is, AFAIK, undergoing changes right now. I think that BSD license will be applied to the whole project - but don't trust me, I am saying just what I remember from a thread on mailing list a few days ago. In order to get a real concrete response you should rather target developers themselves on mailing list or IRC. You can also ask Digia, but this is a bit out of their scope, since components are not officially in Qt yet. Also, remember that components are still a Labs project, so BC and SC rules that govern Qt do not apply there yet.
  • Splashscreen not shown, only when event queue is running

    5
    0 Votes
    5 Posts
    3k Views
    B
    I have found the solution: use a QTimer::singleShot: @ void main() { Qapplication lApp; QTimer::singleShot(100, this, SLOT(OnLoadApplication())); ShowSplash(); lApp.exec(); } @ Then: @ void OnLoadApplication() { DoSomeHeavyLoadStuff(); ShowMainWindow(); } @ The lApp.exec() after the ShowSplash() starts up the Qt eventing queue and thus shows the splash screen. The timer causes the OnLoadApplication to be called which can be used to start your app and show the main window.
  • 0 Votes
    5 Posts
    3k Views
    M
    I'm not sure exactly what you're trying to do. If you're trying to do something for all elements and then do something special with the last one, why not loop from 0 to count-1, then handle the special case of the last item on it's own?
  • [solved] Non-visual object in QML

    4
    1 Votes
    4 Posts
    7k Views
    L
    Not exactly what I suggested, but that should work too, I guess!
  • Pass object pointer throught c++ dataModel

    6
    0 Votes
    6 Posts
    2k Views
    D
    I have done the same thing and it works fine, so could you post some code?
  • C++/Qt3d binding Sequential Animation based on a variable

    3
    0 Votes
    3 Posts
    3k Views
    D
    Thanks sDubitskiy, I replaced my NumberAnimation line by the following: @ SmoothedAnimation{target:swivel2; property : "angle"; to: m_external; duration: 1000; easing.type: "Linear"}@ And didn't work. I think I am going to transfer my code to qt3d instead that looks more intuitive to me, as I don't know how to solve this relatively simple problem with qml.
  • QML MultiTouch - TouchArea

    5
    0 Votes
    5 Posts
    5k Views
    M
    [quote author="alexleutgoeb" date="1337615822"]What are you trying to achieve / what's your desired use case for multi touch?[/quote] Is for a joystick http://talk.maemo.org/showthread.php?t=84019 that I have starded design in QML but because the problems with multi-touch I changed to QGraphicsView. Need to try again with QML.
  • Simulating touchevents for QML

    2
    0 Votes
    2 Posts
    3k Views
    A
    I finally figured it out, the touch events are not converted to click events in the GraphicsScene so I'm sending the click events manually too. The PinchArea however does receive my custom touch events, so the code is conceptually correct.
  • 0 Votes
    6 Posts
    3k Views
    H
    I'm currently experiencing a similar problem and looking for some guidance. When I run the .exe I also get a blank screen. I have copied all the relevant dlls into the release dir, created a qt.conf file with the above info in. When I run Process Monitor I get this: release\imports\QtQuick.1.1 NAME NOT FOUND What do I need to copy into the release directory to solve this? Or is there something else that i'm missing. I'm using the QtDesktop components. If i remove these from the project the exe runs fine, its when the "import QtDesktop 0.1" is added, the window is blank when the exe is run. Process explorer isn't showing any errors with finding QtDesktop components though: release\imports\QtDesktop.0.1 SUCCESS I'm only seeing this issue when i'm building release. Debug works fine.
  • Singleton Item

    6
    0 Votes
    6 Posts
    2k Views
    L
    What you can do is separate all the visual aspects of the item from the data. Then you can have several instances of the visual item all sharing the same data. If it's the data that is expensive to to create, this should be a suitable solution. If it's the visual item that is expensive to create, then I'm really wondering what that visual item does and how it is created...
  • 0 Votes
    5 Posts
    3k Views
    X
    I just created a Meego app using the Qt Simulator and there it doesn't work, too. Maybe it doesn't work in Qt 4.8?