• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿

            使用QGraphicsScene顯示矩形框

            int main(int argc, char *argv[])
            {
                QApplication app(argc,argv);
                QGraphicsScene scene;
                scene.setSceneRect(
            0,0,3000,3000);
                
                
            for(int i=0;i<32;i++)
                {
                    
            for(int j=0;j<12;j++)
                    {
                        QGraphicsRectItem
            * item = new QGraphicsRectItem(20+300*i,20+120*j,240,72);
                        item
            ->setBrush(QColor(79,136,187,255));
                        scene.addItem(item);
                    }
                }
                
                QGraphicsView view(
            &scene);
                view.setDragMode(QGraphicsView::ScrollHandDrag);
                view.resize(
            600,540);
                view.show();

                
            return app.exec();
            }
            posted @ 2015-12-09 18:14 ccsdu2009 閱讀(445) | 評論 (0)編輯 收藏
             
                 摘要: 最近想做個基于Opengl的GUI試了下SFML發(fā)現(xiàn)其String類對寬字節(jié)轉(zhuǎn)換有問題,就修改了下String并重命名為Utf8使用這個應(yīng)該可以正確顯示中文該類修改如下:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->/////////////////...  閱讀全文
            posted @ 2015-11-20 13:09 ccsdu2009 閱讀(609) | 評論 (0)編輯 收藏
             
            import QtQuick 1.1

            Text 
            {
                Timer 
                {
                    triggeredOnStart: 
            true
                    onTriggered: parent.text 
            = Qt.formatTime(new Date())
                    interval: 
            1000; running: visible; repeat: true;
                }

                font.pixelSize: 
            32
                font.family: 
            "sans-serif"
                font.bold: 
            true
                color: 
            "#a1ff09"
            }
            posted @ 2015-11-04 11:43 ccsdu2009 閱讀(782) | 評論 (0)編輯 收藏
             
            import QtQuick 2.0
            import QtQuick.Controls 
            1.3  
            import QtQuick.Window 
            2.2  

            ApplicationWindow 
            {
                id: window 
                visible: 
            true   
                title: qsTr(
            "Hello World")  
                width: 
            480  
                height: 
            480  
                color: 
            "#339546"
                property variant colorArray: [
            "#00bde3","#67c111","#ea7025","#ef0748","#1894af"

                Column
                {
                    id: flow
                    spacing: 
            2
                    anchors.fill: parent

                    Grid
                    {
                        anchors.margins: 
            8
                        spacing:
            2
                        Repeater
                        {
                            model: 
            12
                            Rectangle
                            {
                                id: flag
                                width: 
            120
                                height: 
            0
                                property 
            int colorIndex: Math.floor(Math.random()*5)
                                color: window.colorArray[colorIndex]
                                border.color: Qt.lighter(color)
                                Text
                                {
                                    anchors.centerIn: parent
                                    color: 
            "#f0f0f0"
                                    font.pixelSize: 
            18
                                    text: qsTr(
            "WPS表單")
                                }

                                MouseArea 
                                {
                                     anchors.fill: parent
                                     onClicked: 
                                     {
                                         animateColor.start()
                                         animateOpacity.start()
                                     }
                                }

                                PropertyAnimation 
                                {
                                     id: animateColor; 
                                     target: flag; 
                                     properties: 
            "color"
                                     to: 
            "green"
                                     duration: 
            100
                                }

                                NumberAnimation 
                                {
                                     id: animateOpacity
                                     target: flag
                                     properties: 
            "opacity"
                                     from: 
            0.99
                                     to: 
            1.0
                                     loops: Animation.Infinite
                                     easing {type: Easing.OutBack; overshoot: 
            500}
                                }

                                PropertyAnimation on height{to: 
            24 ;duration:600; loops:Animation.Infinite }
                            } 
                        }
                    }
                    
                    Rectangle
                    {
                        id: desc
                        width: 
            486
                        height: 
            0
                        property 
            int colorIndex: Math.floor(Math.random()*5)
                        color: window.colorArray[colorIndex]
                        border.color: Qt.lighter(color)
                        
                        Text
                        {
                            anchors.centerIn: parent
                            color: 
            "#f0f0f0"
                            font.pixelSize: 
            18
                            text: qsTr(
            "描述信息")
                        }

                        PropertyAnimation on height{to: 
            32 ;duration:600; loops:Animation.Infinite }
                    }

                    Rectangle
                    {
                        id: detail
                        width: 
            486
                        height: 
            0
                        property 
            int colorIndex: Math.floor(Math.random()*5)
                        color: window.colorArray[colorIndex]
                        border.color: Qt.lighter(color)
                        
                        Text
                        {
                            id: text
                            anchors.centerIn: parent
                            color: 
            "#f0f0f0"
                            font.pixelSize: 
            18
                            text: qsTr(
            "點(diǎn)擊展開")
                        }

                        MouseArea  
                        {  
                            anchors.fill: parent  
               
                            onReleased:
                            {
                                text.text 
            = row.visible == true ? qsTr("點(diǎn)擊展開") : qsTr("點(diǎn)擊折疊")
                                row.visible 
            = row.visible == true ? false : true
                            } 
                        }  

                        PropertyAnimation on height{to: 
            32 ;duration:600; loops:Animation.Infinite }
                    }  

                    Row
                    {
                        id: row
                        visible: 
            false
                        spacing: 
            2
                        
                        Rectangle
                        {
                            id: d1
                            width: 
            120
                            height: 
            32
                            property 
            int colorIndex: Math.floor(Math.random()*5)
                            color: window.colorArray[colorIndex]
                            border.color: Qt.lighter(color)
                            Text
                            {
                                anchors.centerIn: parent
                                color: 
            "#f0f0f0"
                                font.pixelSize: 
            18
                                text: qsTr(
            "WPS表單")
                            }
                        }
                        Rectangle
                        {
                            id: d2
                            width: 
            120
                            height: 
            32
                            property 
            int colorIndex: Math.floor(Math.random()*5)
                            color: window.colorArray[colorIndex]
                            border.color: Qt.lighter(color)
                            Text
                            {
                                anchors.centerIn: parent
                                color: 
            "#f0f0f0"
                                font.pixelSize: 
            18
                                text: qsTr(
            "WPS表單")
                            }
                        }
                        Rectangle
                        {
                            id: d3
                            width: 
            120
                            height: 
            32
                            property 
            int colorIndex: Math.floor(Math.random()*5)
                            color: window.colorArray[colorIndex]
                            border.color: Qt.lighter(color)
                            Text
                            {
                                anchors.centerIn: parent
                                color: 
            "#f0f0f0"
                                font.pixelSize: 
            18
                                text: qsTr(
            "WPS表單")
                            }
                        }
                    }
                }

            posted @ 2015-11-03 19:37 ccsdu2009 閱讀(394) | 評論 (0)編輯 收藏
             
                bool unzip(const QString& in_file_path, const QString& out_file_path)  
                {  
                    QuaZip archive(in_file_path);  
                    
            if (!archive.open(QuaZip::mdUnzip))  
                        
            return false;  
                      
                    QString path 
            = out_file_path;  
                    
            if (!path.endsWith("/"&& !out_file_path.endsWith("\\"))  
                        path 
            += "/";  
                  
                    QDir dir(out_file_path);  
                    
            if (!dir.exists())  
                        dir.mkpath(out_file_path);  
                  
                    
            forbool f = archive.goToFirstFile(); f; f = archive.goToNextFile() )  
                    {  
                        QString filePath 
            = archive.getCurrentFileName();  
                        QuaZipFile zFile(archive.getZipName(), filePath);  
                        zFile.open(QIODevice::ReadOnly );  
                        QByteArray ba 
            = zFile.readAll();  
                        zFile.close();  
                  
                        
            if (filePath.endsWith("/"))  
                        {  
                            dir.mkpath(filePath);  
                        }  
                        
            else  
                        {  
                            QFile dstFile(path 
            + filePath);  
                            
            if (!dstFile.open(QIODevice::WriteOnly))  
                                
            return false;  
                            dstFile.write(ba);  
                            dstFile.close();  
                        }  
                    }  
                  
                    
            return true;  
                }  

            源于:
            http://blog.csdn.net/kfbyj/article/details/13888101
            證實(shí)可用.
            posted @ 2015-10-16 16:33 ccsdu2009 閱讀(1024) | 評論 (0)編輯 收藏
             
            #include <QtCore/QCoreApplication>
            #include 
            <QTextStream>
            #include 
            <QXmlStreamReader>
            #include 
            <QtXML/QDom.h>
            #include 
            <QZip/QuaZipFile.h>
            #include 
            <iostream>

            int main(int argc,char *argv[])
            {
                QCoreApplication app(argc,argv);
                QuaZip zip(
            ":qrc/zip.zip");
                
            if(!zip.open(QuaZip::mdUnzip))
                {
                    std::cout
            <<"open failed:"<<zip.getZipError()<<std::endl;
                    system(
            "pause");
                    
            return -1;
                }

                
            if(zip.setCurrentFile("list.xml"))
                {
                    QuaZipFile zipfile(
            &zip);
                    
            if(!zipfile.open(QIODevice::ReadOnly))
                    {
                        std::cout
            <<"open zipfile failed"<<std::endl;
                        system(
            "pause");
                        
            return -1;
                    }

                    QTextStream stream(
            &zipfile);
                    
            while(!stream.atEnd())
                        std::cout
            <<qPrintable(stream.readLine())<<std::endl;

                    zipfile.close();
                    zip.close();
                }
                
            else
                    std::cout
            <<"set current file failed."<<std::endl;
                system(
            "pause");
                
            return 1;
            }

            如上,需要使用QuaZip庫
            posted @ 2015-10-10 10:11 ccsdu2009 閱讀(2728) | 評論 (0)編輯 收藏
             
            本來打算使用QFtp,居然上傳不成功

            #include <stdio.h>
            #include <string.h>
            #include <curl/curl.h>
            #include <sys/types.h>
            #include <sys/stat.h>
            #include <fcntl.h>
            #include <errno.h>
            #ifdef WIN32
            #include <io.h>
            #else
            #include <unistd.h>
            #endif

            #define REMOTE_URL      "sftp://account:password@xx.xx.xx.xx/"

            static size_t read_callback(void *ptr, size_t size, size_t nmemb, void *stream)
            {
                curl_off_t nread;
                size_t retcode = fread(ptr, size, nmemb, stream);
                nread = (curl_off_t)retcode;
                fprintf(stderr, "*** We read %" CURL_FORMAT_CURL_OFF_T " bytes from file\n", nread);
                return retcode;
            }

            int main(int argc,char *argv[])
            {
                if(argc != 3)
                {
                    printf("2 paramenters is needed.\n");
                    return -1;
                
            }

                char* local_file = argv[1];
                char* remote_file = argv[2];

                printf("call me for update -:%s,%s\n",local_file,remote_file);

                char remoteurl[1024] = 
            {0};
                strcpy(remoteurl,REMOTE_URL);
                strcat(remoteurl,remote_file);

                CURL* curl;
                CURLcode res;
                FILE* file;
                struct stat file_info;
                curl_off_t fsize;

                if(stat(local_file,&file_info))
                
            {
                    printf("couldnt open '%s'
            : %s\n", local_file, strerror(errno));
                    return 1;
                
            }

                fsize = (curl_off_t)file_info.st_size;
                printf("Local file size: %" CURL_FORMAT_CURL_OFF_T " bytes.\n", fsize);

                file = fopen(local_file, "rb");
                curl_global_init(CURL_GLOBAL_ALL);

                curl = curl_easy_init();

                if(curl)
                
            {
                    curl_easy_setopt(curl,CURLOPT_READFUNCTION,read_callback);
                    curl_easy_setopt(curl,CURLOPT_UPLOAD,1L);
                    curl_easy_setopt(curl,CURLOPT_URL,remoteurl);
                    curl_easy_setopt(curl,CURLOPT_READDATA,file);
                    curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,(curl_off_t)fsize);
                    curl_easy_setopt(curl,CURLOPT_FTP_RESPONSE_TIMEOUT,120);
                    res = curl_easy_perform(curl);
                    if(res != CURLE_OK)
                        fprintf(stderr,"curl_easy_perform() failed
            : %s\n",curl_easy_strerror(res));
                    curl_easy_cleanup(curl);
                    fprintf(stderr,"finished update.");
                
            }

                fclose(file);
                curl_global_cleanup();
                return 0;
            }

            以上代碼經(jīng)過實(shí)際測試.
            posted @ 2015-08-31 17:21 ccsdu2009 閱讀(2157) | 評論 (0)編輯 收藏
             
             -no-icu -no-opengl -confirm-license -opensource -nomake examples -nomake tests -mp -no-harfbuzz -no-angle -D _CRT_SECURE_NO_WARNINGS -skip qtactiveqt -skip qtandroidextras -skip qtconnectivity -skip qtdeclarative -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmacextras -skip qtquick1 -skip qtquickcontrols -skip qtscript -skip qtsensors -skip qtserialport -skip qtsvg -skip qtwebkit -skip qtwebkit-examples -skip qtx11extras -skip qtxmlpatterns
            posted @ 2015-08-27 09:43 ccsdu2009 閱讀(652) | 評論 (0)編輯 收藏
             
            import QtQuick 2.0
            import QtQuick.Particles 2.0

            Rectangle 
            {
                id
            : root
                width: 480
            ; height: 360
                color: "#1f1f1f"
                ParticleSystem 
                {
                    id: ps
                
            }
                
                Emitter 
                
            {
                    id
            : emitter
                    anchors.left: parent.left
                    anchors.verticalCenter: parent.verticalCenter
                    width: 1
            ; height: 1
                    system: ps
                    emitRate: 10
                    lifeSpan: 6400
                    lifeSpanVariation: 600
                    size: 32
                    
                    velocity: PointDirection 
                    {
                        x: 100
                        y: 0
                        xVariation: 0
                        yVariation: 100/6
                    
            }
                    
                    acceleration: AngleDirection 
                    
            {
                        angle
            : 90
                        magnitude: 30
                    
            }
                }
                ImageParticle 
                
            {
                    source
            : "assets/ufo.png"
                    system: ps
                
            }
            }
            posted @ 2015-08-20 14:31 ccsdu2009 閱讀(549) | 評論 (0)編輯 收藏
             
            import QtQuick 2.2  
            import QtQuick.Controls 1.1
                
            Canvas
            {
                id: root
                width: 200; height: 200
                onPaint:
                {
                    var ctx = getContext("2d")
                    ctx.lineWidth = 2
                    ctx.strokeStyle = "blue"
                    ctx.fillStyle = "red"
                    ctx.beginPath()
                        ctx.moveTo(50,50)
                        ctx.lineTo(150,50)
                        ctx.lineTo(150,150)
                        ctx.lineTo(50,150)
                    ctx.closePath()
                    ctx.fillRect(10,10,10,10)
                    ctx.strokeRect(20,20,10,10);
                    ctx.fill()
                    ctx.stroke()
                }
            }
            使用漸變
            import QtQuick 2.2  
            import QtQuick.Controls 1.1
                
            Canvas
            {
                id: root
                width: 200; height: 200
                onPaint:
                {
                    var ctx = getContext("2d")
                    var gradient = ctx.createLinearGradient(0,0,200,200)
                    gradient.addColorStop(0,"blue")
                    gradient.addColorStop(0.5,"red")
                    gradient.addColorStop(1,"yellow")
                    ctx.fillStyle = gradient
                    ctx.fillRect(10,10,100,100)
                }
            }
            增加陰影
            import QtQuick 2.2  
            import QtQuick.Controls 1.1
                
            Canvas
            {
                id: root
                width: 200; height: 200
                onPaint:
                {
                    var ctx = getContext("2d")
                    ctx.shadowColor = "black";
                    ctx.shadowOffsetX = 2;
                    ctx.shadowOffsetY = 2;
                    var gradient = ctx.createLinearGradient(0,0,200,200)
                    gradient.addColorStop(0,"blue")
                    gradient.addColorStop(0.5,"red")
                    gradient.addColorStop(1,"yellow")
                    ctx.fillStyle = gradient
                    ctx.fillRect(10,10,100,100)
                }
            }
            posted @ 2015-08-20 14:11 ccsdu2009 閱讀(582) | 評論 (0)編輯 收藏
            僅列出標(biāo)題
            共38頁: First 5 6 7 8 9 10 11 12 13 Last 
             
            久久www免费人成精品香蕉| 无码国内精品久久人妻| 亚洲&#228;v永久无码精品天堂久久 | 久久偷看各类wc女厕嘘嘘| 久久免费线看线看| 色综合久久夜色精品国产| 久久超碰97人人做人人爱| 久久久青草青青国产亚洲免观| 国内精品久久久久影院一蜜桃| 久久久久亚洲AV成人网人人网站| 蜜臀av性久久久久蜜臀aⅴ麻豆| 久久精品成人免费观看97| 69国产成人综合久久精品| 97香蕉久久夜色精品国产| 国产精品午夜久久| 99久久人妻无码精品系列| 狠狠精品久久久无码中文字幕| 久久久久综合中文字幕| 国产高清美女一级a毛片久久w | 久久se精品一区精品二区| 精品无码久久久久国产动漫3d| 午夜精品久久影院蜜桃| 99久久婷婷国产一区二区| 99久久人妻无码精品系列| 香蕉久久夜色精品升级完成| 国内精品久久久久影院亚洲| 久久免费香蕉视频| 久久久久国产一区二区三区| 精品国产乱码久久久久久浪潮| 久久国产精品-国产精品| 99久久综合狠狠综合久久止| 久久亚洲私人国产精品vA| 久久人人爽人人爽人人片AV高清| 色偷偷91久久综合噜噜噜噜| 欧美国产精品久久高清| 欧美粉嫩小泬久久久久久久| 色婷婷久久久SWAG精品| 性做久久久久久久久浪潮| 麻豆精品久久久久久久99蜜桃| 无码人妻久久一区二区三区蜜桃| 一级做a爰片久久毛片毛片|