Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.2k Topics 77.9k Posts
  • To import pulgin in qml(Qt 4.7.4)

    2
    0 Votes
    2 Posts
    2k Views
    G
    What you probably need is this little piece of code: http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#addImportPath You need to do this in the main.cpp file. Or where ever you have access to the engine/viewer. Should work in 4.7.4 as well, I think. ;) For more information: http://qt-project.org/doc/qt-5.0/qtqml/qtqml-syntax-imports.html#qml-import-path http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-identifiedmodules.html
  • Save image from qml

    21
    0 Votes
    21 Posts
    15k Views
    S
    I tried Canvas, can't work either If you just need to load and save the image here is a simple class for that .hpp @ #include <QImage> #include <QObject> class QQuickItem; class QString; class imageSaver : public QObject { Q_OBJECT public: explicit imageSaver(QObject *parent = 0); imageSaver(imageSaver const&) = delete; imageSaver& operator=(imageSaver const&) = delete; public slots: void load(QString const &path); void loadAndSave(QString const &path); void save(QString const &path) const; private: QImage img_; }; @ .cpp @ #include "imageSaver.hpp" imageSaver::imageSaver(QObject *parent) : QObject(parent) { } void imageSaver::load(QString const &path) { img_.load(path); } void imageSaver::loadAndSave(QString const &path) { img_.load(path); img_.save(path); } void imageSaver::save(const QString &path) const { img_.save(path); } @ if you need to take the result after postprocessing, take the screenshot "take screenshot":http://qt-project.org/forums/viewthread/28822/ With these, we can keep on using the Image from qml2 no error handle, please refine it by yourself
  • [Solved]Render a QML scene into a texture and save it

    4
    0 Votes
    4 Posts
    3k Views
    S
    I found the other example "take screenshot":http://qt-project.org/forums/viewthread/28822/ Take the screenshot by QQuickView, then do what we want
  • [Solved]How to take ScreenShot Qt/QML

    2
    0 Votes
    2 Posts
    7k Views
    S
    I found a solution, pretty simple, change the function "capture" to @ void screenCapture::capture(QString const &path) const { QImage img = currentView_->grabWindow(); img.save(path); } @
  • Can't watch preview

    8
    0 Votes
    8 Posts
    2k Views
    G
    Yea, but perhaps you should try a re-install (if you have not already). I had to uninstall and then delete the folder manually sometime to fix an installation. Anyway the 2.7.0 based on Qt 5.0.2 works on my machine a Lenovo X230 running Win 7 64-bit.
  • [Solved] ListView highlight item over delegate

    10
    1 Votes
    10 Posts
    10k Views
    G
    You are welcome! QML is often simpler than you think. Remember mark your title as [Solved] for others to see. Happy coding!
  • 0 Votes
    2 Posts
    2k Views
    L
    Why no one answers QML video related questions??
  • [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
    931 Views
    sierdzioS
    Try checking for 'undefined'. Anchors are an attached property, I'm not sure you can check that.
  • 0 Votes
    2 Posts
    881 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
    912 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.