Own embedded QML Notification Center as Notification Center of Android or iOS



  • Hello All

    Perhaps this question has been asked
    But I have not found
    If there is a link to the answer - write here, please

    The essence of the problem: I want to make notification center as Notification Center of Android or iOS for my embedded device.
    I use Qt Quick 1 and QML.
    When sipping down the top bar crawls out the window with the list of events that you can scroll up and down. Also appears at top the toolbar. Just like in Android.
    How to do it - I do not understand ...

    Thanks



  • Hi, _dmp

    If I understand you correctly you want to fire some action when user is scrolling content to up or down, right? If this true, you may use signals for this. Qt is based on slot-signal technology. It's looks like iOS Notification centre. Please read more about signals from this "link":http://qt-project.org/forums/viewthread/1730 or "here":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html.

    QML object have a property which can be changed and you may use signal which called every time when property has changed value. it's work for all standard components from QML. If you using custom component you must create signal yourself. It's simple, all you need it's added to your C++ class code like this:
    @
    class Logger : public QObject
    {
    Q_OBJECT

        Q_PROPERTY(QString version READ getVersion WRITE setVersion NOTIFY versionChanged)
    
    private:
        QString m_version;
    
    
    public:
        inline QString getVersion(){return m_version;}   //Getter
        inline void setVersion(QString ver){m_version = ver; emit versionChanged(m_version);} //Setter
    
    signals:
        void versionChanged(QString data);  //signal which called when you change the property
    

    }
    @

    In the QML you may use it like:
    @
    import QtQuick 2.0
    import <access_to_your_cpp_module> 1.0

    Rectangle {
    Logger{
    version: "1.0.0"
    onVersionChanged: {
    //Some code here which called when value of version property was changed.
    }
    }
    }
    @

    I'm not check the code, so I'm not sure is it work or not, so if you have any problem leave post here, I will trying to help.

    If you not understand how to find signal for standard component you may try do this using a simple rule: All signals in QML have a prefix "on" and suffix "Changed". For example, is your component have a property with name "onAgeChanged" the name of signal will be "onAge" and so on. Also, you can create custom signal in QML components please look "here":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html#connecting-to-qml-signals for more information.



  • no, i mean else things. but thank you for your answer!
    i mean i want create dragdown notification panel. as it was made in ios and adroid- so it place for a clock, unanswered calls and news. i want make absolutelly as ios drag-down information panel by qml. it functional named Notification center.

    [quote author="shav" date="1365665589"]Hi, _dmp

    If I understand you correctly you want to fire some action when user is scrolling content to up or down, right? If this true, you may use signals for this. Qt is based on slot-signal technology. It's looks like iOS Notification centre. Please read more about signals from this "link":http://qt-project.org/forums/viewthread/1730 or "here":http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-interactqmlfromcpp.html.

    • skiped -[/quote]

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.