Giter VIP home page Giter VIP logo

dduiclock's Introduction

QML时钟插件开发简单指导

QtQuick Website: http://www.heilqt.com

插件编译配置界面 插件使用界面

描述

  • QML插件以C++来实现绘制QML的组件

  • 功能:

  • 自由绘制需要的图形

  • 自由定制属性(暴露属性给QML)

  • 组件不可见可以将时钟停止运行

编译方法

  • 下载YSClockPlugin项目
  • 打开QtCreator IDE
  • 清理项目进行编译
  • 记得在QtCreator项目配置加入make install的步骤
  • 点击运行
  • 插件被安装到当前版本的QtSDK的qml插件目录(具体查看pro里面的install配置项)

使用方法

  • 新建QML项目
  • 在main.qml中加入 import com.ys.qmlcomponents 1.0
  • 在qml中加入YSClockPlugin对其进行属性配置和布局
  • 可以自由调整各种颜色
    YSClockPlugin{
        id:clock
        anchors.fill: parent
        smooth: true
        anchors.centerIn: parent
        hourColor:"#32334f"
        secondColor:"red"
        minuteColor:"#32334a"
        lineColor:"#3C0854"
        textColor:"white"
        background:"#04D56C"
        ysfamily:"Comic Sans MS"
    }

暴露属性

        hourColor:"#32334f"
        minuteColor:"#32334a"
        secondColor:Qt.rgba(Math.random(),Math.random(),Math.random(),0.5)
        lineColor:"#3C0854"
        textColor:"white"
        background:"#04D56C"
        ysfamily:"Comic Sans MS"

贡献

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.