Cpper
C/C++高级工程师 Android高级软件工程师 IT集成工程师 音频工程师 熟悉c,c++,java,c#,py,js,asp等多种语言 程序猿

import QtQuick 2.11

Rectangle 
{
    width
: 640
    height: 480
    color: "#0ff90f"

    Flipable {
            id: flip
            width: 300
            height: 300
            anchors.centerIn: parent

            property bool flipped: false

            front: Image{
                anchors.fill: parent
                source: "file:///C:/Users/Administrator/Desktop/11111/2099720.png"

                transform: Rotation{
                    origin.x: flip.width / 2
                    origin.y: flip.height / 2
                    axis.x: 0
                    axis.y: 1
                    axis.z: 0
                    angle: 180
                
}
            }

            back: Image
{
                anchors.fill
: parent
                source: "file:///C:/Users/Administrator/Desktop/11111/2099720.png"
            
}

            transform: Rotation
{
                id
: rotation
                origin.x: flip.width / 2
                origin.y: flip.height / 2
                axis.x: 0
                axis.y: 1
                axis.z: 0
                angle: 0
            
}

            states:State
{
                PropertyChanges {
                    target
: rotation
                    angle: 180
                
}
                when:flip.flipped
            }

            transitions: Transition
{
                NumberAnimation{
                    target
:rotation
                    properties: "angle"
                    duration: 240
                
}
            }

            MouseArea 
{
                anchors.fill
: parent
                onClicked:  flip.flipped = !flip.flipped
            
}
        }
}
posted @ 2019-09-19 18:22 ccsdu2009 阅读(1148) | 评论 (0)编辑 收藏
 
import QtQuick 2.11

Rectangle 
{
    width
: 640
    height: 480
    color: "#0909ff"

    Flipable {
            id: flip
            width: 300
            height: 300
            anchors.centerIn: parent

            property bool flipped: false

            front:Image{
                anchors.fill: parent
                source: "file:///C:/Users/Administrator/Desktop/11111/2099720.png"
            
}

            back:Image
{
                anchors.fill
: parent
                source: "file:///C:/Users/Administrator/Desktop/11111/2099720-flip.png"
            
}

            transform: Rotation
{
                id
: rotation
                origin.x: flip.width / 2
                origin.y: flip.height / 2
                axis.x: 0
                axis.y: 1
                axis.z: 0
                angle: 0
            
}

            states:State
{
                PropertyChanges {
                    target
: rotation
                    angle: 180
                
}
                when:flip.flipped
            }

            transitions: Transition
{
                NumberAnimation{
                    target
:rotation
                    properties: "angle"
                    duration: 240
                
}
            }

            MouseArea 
{
                anchors.fill
: parent

                onClicked:  flip.flipped = !flip.flipped

            
}
        }
}
posted @ 2019-09-19 17:33 ccsdu2009 阅读(841) | 评论 (0)编辑 收藏
 
    int result = av_seek_frame(ffmpeg->formatCtx, -1,
        (ffmpeg->formatCtx->start_time + time) * AV_TIME_BASE,
        AVSEEK_FLAG_BACKWARD);
time单位为秒
posted @ 2019-09-19 09:51 ccsdu2009 阅读(864) | 评论 (0)编辑 收藏
 
import QtQuick 2.5
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle 
{
    width
: 640
    height: 480
    color: "#333333"

    Button {
        id: button
        text: "Button"
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.top: parent.top
        anchors.topMargin: 6

        onClicked: {
            var count = layout.count
            if(layout.currentIndex == count - 1)
                layout.currentIndex = 0
            else
                layout.currentIndex ++
        
}
    }

    StackLayout 
{
        id
: layout
        anchors.top: button.bottom
        anchors.topMargin: 6
        anchors.horizontalCenter: parent.horizontalCenter
        width: 480
        height: 320
        currentIndex: 1
        Rectangle {
            color: 'teal'
            implicitWidth: 200
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'plum'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: '#c90909'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'green'
            implicitWidth: 300
            implicitHeight: 200
        
}
        Rectangle 
{
            color
: 'grey'
            implicitWidth: 300
            implicitHeight: 200
        
}
    }
}
posted @ 2019-09-18 11:49 ccsdu2009 阅读(655) | 评论 (0)编辑 收藏
 
import QtQuick 2.5
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle 
{
    id
: circularProgressBar
    width: 60
    height: 60

    color: "#333333"
    property real currentValue: 86
    property bool textVisible: true
    property bool canClick: false

    Canvas {
        id: canvas
        anchors.fill: parent
        antialiasing: true

        property color primaryColor: "transparent"
        property color secondaryColor: "lightblue"

        property real centerWidth: width / 2
        property real centerHeight: height / 2
        property real radius: Math.min(canvas.width-10, canvas.height-10) / 2

        property real minimumValue: 0
        property real maximumValue: 100
        property alias currentValue : circularProgressBar.currentValue

        property string text: "0"
        property real angle: (currentValue - minimumValue) / (maximumValue - minimumValue) * 2 * Math.PI
        property real angleOffset: -Math.PI / 2

        property real rotate: 0.0

        onPrimaryColorChanged: requestPaint()
        onSecondaryColorChanged: requestPaint()
        onMinimumValueChanged: requestPaint()
        onMaximumValueChanged: requestPaint()
        onCurrentValueChanged: requestPaint()
        onRotateChanged: requestPaint()

        onPaint: {
            var ctx = getContext("2d")
;
            ctx.save();

            ctx.clearRect(0, 0, canvas.width, canvas.height);

            ctx.translate(width/2,height/2)
            ctx.rotate(rotate*Math.PI/180.0)
            ctx.translate(-width/2,-height/2)

            ctx.beginPath();
            ctx.lineWidth = 10;
            ctx.strokeStyle = primaryColor;
            ctx.arc(canvas.centerWidth,
                    canvas.centerHeight,
                    canvas.radius,
                    angleOffset + canvas.angle,
                    angleOffset + 2*Math.PI);
            ctx.stroke();

            ctx.beginPath();
            ctx.lineWidth = 3;
            ctx.strokeStyle = canvas.secondaryColor;
            ctx.arc(canvas.centerWidth,
                    canvas.centerHeight,
                    canvas.radius,
                    canvas.angleOffset,
                    canvas.angleOffset + canvas.angle);
            ctx.stroke();

            ctx.restore();
        
}

        MouseArea 
{
            id
: mouseArea
            anchors.fill: parent
            visible: circularProgressBar.canClick
            onClicked: canvas.clicked()
            onPressedChanged: canvas.requestPaint()
        
}

        Timer
{
            id
: timer
            interval: 150
;
            running
: true
            repeat: true
;
            onTriggered
: {
                canvas.rotate += 5
            
}
        }
    }
}
posted @ 2019-09-18 10:59 ccsdu2009 阅读(1257) | 评论 (0)编辑 收藏
 
import QtQuick 2.11
import QtQuick.Controls 2.4

Rectangle
{
    width
:640
    height:480
    color:"#cfcfc0"

    anchors.margins: 6

    property bool load1: true

    Button
    {
        id:button
        text: "Button"
        anchors.horizontalCenter: parent.horizontalCenter
        onClicked:
        {
            if(area.visible)
                fadeOut.start()
            else
                fadeIn.start()
        
}
    }

    PropertyAnimation
    
{
        id
: fadeOut
        target: area
        duration: 300
        property: "opacity"
        from: 1.0
        to: 0.0

        onStopped: area.visible = false
    
}

    PropertyAnimation
    
{
        id
: fadeIn
        target: area
        duration: 300
        property: "opacity"
        from: 0.0
        to: 1.0

        onStarted: area.visible = true
    
}

    Rectangle
    
{
        id
: area
        width: parent.width - 12
        height: parent.height - button.height - 12
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.topMargin: 6
        anchors.top: button.bottom
        visible: false
        color: "#9900ff00"
    
}
}
posted @ 2019-09-17 16:06 ccsdu2009 阅读(757) | 评论 (0)编辑 收藏
 
上层MouseArea需要接受右键事件,如下
    MouseArea {
        anchors.fill
: parent
        acceptedButtons: Qt.LeftButton | Qt.RightButton
    
}
posted @ 2019-09-17 11:18 ccsdu2009 阅读(353) | 评论 (0)编辑 收藏
 
import QtQuick 2.11
import QtQuick.Controls 2.4

Rectangle
{
    width
:640
    height:480
    color:"#cfcfc0"

    anchors.margins: 6

    MouseArea {
        id: mouseRegion
        anchors.fill: parent
;
        acceptedButtons
: Qt.LeftButton | Qt.RightButton

        onClicked: {
            if(mouse.button == Qt.RightButton)
                contentMenu.popup()
        
}

        Menu 
{
            id
: contentMenu

            MenuItem {
                text: "Cut"
                onTriggered: {
}
            }

            MenuItem 
{
                text
: "Copy"
                onTriggered: {
}
            }

            MenuItem 
{
                text
: "Paste"
                onTriggered: {
}
            }

            MenuSeparator 
{ }

            Menu 
{
                title
: "More"
                MenuItem {
                    text: "Edit"
                
}
                MenuItem 
{
                    text
: "Select All"
                
}
            }
        }
    }
}
posted @ 2019-09-17 11:10 ccsdu2009 阅读(951) | 评论 (0)编辑 收藏
 
 1     Button {
 2         anchors.left: button
 3         text: "菜单"
 4         anchors.leftMargin: 12
 5         onClicked: popupMenu.popup()
 6      }
 7 
 8      Menu {
 9           id : popupMenu
10           title: "&File"
11 
12           MenuItem {
13               text: "&Open"
14               onTriggered:{}
15           }
16 
17           MenuItem {
18               text: "&Save"
19               onTriggered: {}
20           }
21 
22           MenuItem {
23               text: "&Close"
24               onTriggered: Qt.quit()
25           }
26     }
posted @ 2019-09-17 11:06 ccsdu2009 阅读(1147) | 评论 (0)编辑 收藏
 
import QtQuick 2.5
import QtQuick.Layouts 1.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle 
{
    id
: circularProgressBar
    width: 60
    height: 60

    color: "#333333"
    property real currentValue: 0
    property bool textVisible: true
    property bool canClick: false

    Canvas {
        id: canvas
        anchors.fill: parent
        antialiasing: true

        property color primaryColor: "transparent"
        property color secondaryColor: "lightblue"

        property real centerWidth: width / 2
        property real centerHeight: height / 2
        property real radius: Math.min(canvas.width-10, canvas.height-10) / 2

        property real minimumValue: 0
        property real maximumValue: 100
        property alias currentValue : circularProgressBar.currentValue

        property string text: "0"
        property real angle: (currentValue - minimumValue) / (maximumValue - minimumValue) * 2 * Math.PI
        property real angleOffset: -Math.PI / 2

        onPrimaryColorChanged: requestPaint()
        onSecondaryColorChanged: requestPaint()
        onMinimumValueChanged: requestPaint()
        onMaximumValueChanged: requestPaint()
        onCurrentValueChanged: requestPaint()

        onPaint: {
            var ctx = getContext("2d")
;
            ctx.save();

            ctx.clearRect(0, 0, canvas.width, canvas.height);

            if(mouseArea.pressed) {
                ctx.beginPath();
                ctx.lineWidth = 10;
                ctx.fillStyle = Qt.lighter(canvas.secondaryColor,1.25);
                ctx.arc(canvas.centerWidth,
                        canvas.centerHeight,
                        canvas.radius,
                        0,
                        2*Math.PI);
                ctx.fill();

                timer.running = true;
            
}

            ctx.beginPath();
            ctx.lineWidth = 10;
            ctx.strokeStyle = primaryColor;
            ctx.arc(canvas.centerWidth,
                    canvas.centerHeight,
                    canvas.radius,
                    angleOffset + canvas.angle,
                    angleOffset + 2*Math.PI);
            ctx.stroke();

            ctx.beginPath();
            ctx.lineWidth = 3;
            ctx.strokeStyle = canvas.secondaryColor;
            ctx.arc(canvas.centerWidth,
                    canvas.centerHeight,
                    canvas.radius,
                    canvas.angleOffset,
                    canvas.angleOffset + canvas.angle);
            ctx.stroke();

            ctx.restore();
        }

        Text 
{
            id
: progressText
            anchors.centerIn: parent

            font.pixelSize: 16
            text: canvas.text
            visible: circularProgressBar.textVisible
            color: canvas.secondaryColor
        
}

        MouseArea 
{
            id
: mouseArea
            anchors.fill: parent
            visible: circularProgressBar.canClick
            onClicked: canvas.clicked()
            onPressedChanged: canvas.requestPaint()
        
}

        Timer
{
            id
: timer
            interval: 100
;
            running
: true
            repeat: true
;
            onTriggered
: {

                if(circularProgressBar.currentValue === 100) {
                    circularProgressBar.currentValue = 0
;
                    progressText.text = "0"
                
}

                circularProgressBar.currentValue += 1;
                progressText.text = circularProgressBar.currentValue.toString()+"%";
            }

        }
    }
}
posted @ 2019-09-16 16:38 ccsdu2009 阅读(1254) | 评论 (0)编辑 收藏
仅列出标题
共38页: 1 2 3 4 5 6 7 8 9 Last