Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • [Solved]Create enum for qml

    4
    0 Votes
    4 Posts
    2k Views
    C
    You can use Q_ENUMS to export enum names to the QML typesystem. Internally, all enums are just treated as ints so if something doesn't work, change your property type to int and things should start working ;-) @ class MyType : public QObject { Q_OBJECT Q_PROPERTY(MyEnum enumProp READ enumPropAccessor CONSTANT) Q_ENUMS(MyEnum) public: enum MyEnum { FirstValue = 1, SecondValue = 2 }; MyType(QObject *parent = 0) : QObject(parent) {} ~MyType() {} MyEnum enumPropAccessor() const { return FirstValue; } }; @ In QML, you should be able to do: @ MyType { property int someValue: MyType.SecondValue } @ Cheers, Chris.
  • Capture the camera image after postprocessing by shaderEffect

    2
    0 Votes
    2 Posts
    1k Views
    S
    Is this possible for shaderEffects? Or I have to implement a new type by c++?
  • Increase Performance of Text and Large String

    5
    0 Votes
    5 Posts
    2k Views
    T
    I suggest using the same text layout engine that Qt Creator uses, its optimized for huge amounts of text and only does layout of the stuff you see on screen. See the QPlainTextDocumentLayout class. Also see QTextEdit::document() and QTextDocument::setDocumentLayout().
  • Check if certain anchors are anchored

    2
    0 Votes
    2 Posts
    909 Views
    sierdzioS
    Try checking for 'undefined'. Anchors are an attached property, I'm not sure you can check that.
  • 0 Votes
    2 Posts
    809 Views
    S
    Because of signature is onImageCaptured(requestId, preview) so the preview is the parameter of the signal
  • Key navigation image change.

    2
    0 Votes
    2 Posts
    892 Views
    A
    Hi, why are you using the focus attribute? If you want key navigation, then use "KeyNavigation":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-keynavigation.html - with two or more Image elements with separate sources specified. Second thought: seeing that you want to implement highlighting and would rather have one Image element, I want to point out that you're "binding":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-syntax-propertybinding.html the source property to the focus property, which in turn you set to true. Make sure that you have the focus property changed at some point. This "stackoverflow.com thread":http://stackoverflow.com/questions/16343196/qt-qml-keyboard-and-mouse-does-not-work-together-to-change-the-source-image has a similar problem.
  • Qml root deleted on startup

    6
    0 Votes
    6 Posts
    2k Views
    C
    I am having this same problem. I created the following bug: https://bugreports.qt-project.org/browse/QTBUG-31678
  • Return var from js file to qml.

    2
    0 Votes
    2 Posts
    1k Views
    A
    Hello, you have some nested function definitions but you don't actually call them, hence the return is undefined. Try moving the inner function definition aside and calling it as an argument to the transaction() function instead. You will have to provide a variable to assign to as well, since currently you do nothing with the returned variable in the outer function.
  • [SOLVED] Updating single item in CppModel does not update QML

    9
    0 Votes
    9 Posts
    10k Views
    O
    I solved it! To make it work I implemented my own setData() in CppModelItem, which seems really straight-forward when you think of it! @ void CppModelItem::setData(const QVariant &value, int role) { if( role == NameRole ) { m_name = value.toString(); this->model()->dataChanged(this->index(), this->index()); } } @ In the setData() I call the models dataChanged() with this index and everything works!
  • How to draw the area chart by using canvas ?

    2
    0 Votes
    2 Posts
    2k Views
    J
    Canvas implements the html5 canvas API. In other words you can google up "how to draw area charts in html5" and use those guides almost without modification. Try for instance this page: http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/HTML-canvas-guide/CreatingChartsandGraphs/CreatingChartsandGraphs.html
  • To display video on qml (Qt-5)

    4
    0 Votes
    4 Posts
    2k Views
    B
    Here some sample of video player on QML: @import QtQuick 1.0 import QtMultimediaKit 1.1 // do not forgot to import this Item { id: videoPlayerItem property bool isVideoPlaying: videoPlayer.hasVideo // property to know if videoPlaying id ongoing or not /* Functions Which starts Video Playing / function playVideo(){ videoPlayer.play() } / Function Which Stops Video Playing / function stopVideo(){ videoPlayer.stop() } / Function Which Stops Video Playing / function pauseVideo(){ videoPlayer.pause() } / Actual QML based Video Component */ Video{ id:videoPlayer anchors.fill: videoPlayerItem // never forget to mention the size and position source: "Video/Bear.wmv" focus: true } }@
  • 0 Votes
    10 Posts
    5k Views
    sierdzioS
    I'm glad to hear that! Happy coding! Please add "[Solved]" to thread's title (you need to edit your initial post) if you have a spare minute.
  • Mouse cursor visible on Android mobile 5.1.0 beta 1 build ?

    2
    0 Votes
    2 Posts
    1k Views
    R
    This was a bug that was reported.
  • Weird behavior when switching the view between Image and Camera

    2
    0 Votes
    2 Posts
    928 Views
    S
    I explicit specified the state of "FULLSCREEN" in main.qml as @ State { name: "FULLSCREEN" PropertyChanges { target: photoTest; state: param.fullScreenPreviousState == "PHOTO" ? "PHOTO" : "CAMERA"} //new conditon PropertyChanges { target: toolBarTest; width: 0} } @ We have to explicit specify all of the conditions of different components when changing state?
  • QtQuick 2 laggy?

    7
    0 Votes
    7 Posts
    3k Views
    Z
    I tried the angle version of qmlscene and the resizing is now much smoother, thanks :)
  • Qml screens on dual monitor(Qt-5 -ubuntu)

    1
    0 Votes
    1 Posts
    2k Views
    No one has replied
  • To capture image from video frame qml(Qt -5)

    2
    0 Votes
    2 Posts
    3k Views
    A
    Hello, the only QtMultimedia element that has screen capturing capabilities on its own is CameraCapture, related to camera functionality. Perhaps capturing an image from C++ side is possible through "QGraphicsScene::render":http://qt-project.org/doc/qt-5.0/qtwidgets/qgraphicsscene.html#render or "QGraphicsView::render":http://qt-project.org/doc/qt-5.0/qtwidgets/qgraphicsview.html#render, but I am not sure. See also "this thread":http://qt-project.org/forums/viewthread/27117 with its "QQuickView::grabWindow":http://qt-project.org/doc/qt-5.0/qtquick/qquickwindow.html#grabWindow recommendation.
  • ListView doesn't update after changing data in QStringListModel

    3
    0 Votes
    3 Posts
    3k Views
    D
    Hi sierdzio, That's true for QStringList-based models and QObjectList-based models. But in this case I'm dealing with QStringListModel, a QAbstractItemModel subclass. In the third section of the page you mention: bq. QML views are automatically updated when the model changes. Remember the model must follow the standard rules for model changes and notify the view when the model has changed by using QAbstractItemModel::dataChanged(), QAbstractItemModel::beginInsertRows(), and so on. See the Model subclassing reference for more information. The thing is that the model automatically notifies the changes (as a QAbstractItemModel subclass) but for some reason it doesn't take effect. Thank you for your reply, anyway :-)
  • QMenuBar CSS problème

    2
    0 Votes
    2 Posts
    1k Views
    A
    Hello, please don't post multiple threads on the same topic. One is enough. Since you request help with programming GUI using Qt widgets, stick to "this thread":http://qt-project.org/forums/viewthread/28644/.
  • How to convert QML Object to QImage ?

    3
    0 Votes
    3 Posts
    1k Views
    S
    Yes i want to print it. I know how to use QPrinter but i want the QImage of a child QML Item of my view and not all the view. Thank You.