Giter Site home page Giter Site logo

calendar's Introduction

通过点击日历控件区域,选择日期的Qml组件。

Calendar 备注
导入方法 文件导入
兼容性 QtQuick 1.xQtQuick 2.x
继承 GridView

插图

属性

信号

  • signal clicked(variant date) : 在日历中的有效日期上单击鼠标时发出,date是鼠标被单击的日期

方法

  • function today()重定位当天日期
  • function getDate() : 获取日历当前日期
  • function setDate(date) : 设置日历的日期

示例

Calendar {
    width: 600; height: 480
}

插图

部分源码预览

    /**
     * @brief 在日历中的有效日期上单击鼠标时发出。
     * @param date: 鼠标被单击的日期。
     */
    signal clicked(variant date)

    /**
     * @brief 重定位到当天日期
     */
    function today() {
        var today = new Date()
        setDate(today)
    }

    /**
     * @brief 获取日历当前日期
     */
    function getDate() {
        return privateVar.getYMD(root.currentIndex)
    }

    /**
     * @brief 设置日历的日期
     */
    function setDate(date) {
        privateVar.monthAndYearNumber = [date.getMonth() + 1, date.getFullYear()]
        root.currentIndex = privateVar.getIndexByDate(date.getDate(), date.getMonth()+1, date.getFullYear())

        /* 更新日期任务列表 */
        __setNoteDates(privateVar.noteDates)
    }

    Item {
        id: weekItem
        width: root.width; height: root.height/13
        Repeater {
            model: ["日", "一", "二", "三", "四", "五", "六"]
            Item {
                x: index * width
                width: root.cellWidth; height: weekItem.height

                Text {
                    anchors.centerIn: parent
                    text: model.modelData
                    font.pixelSize: dpW(14)
                    color: "#666666"
                }
            }
        }
    }

关于

https://github.com/QtComponent/Calendar
https://github.com/QtComponent/Calendar/archive/master.zip
https://github.com/aeagean/Calendar

插图

calendar's People

Contributors

aeagean avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.