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

置顶随笔

gaudio是一个基于C/12bet混合编程的跨平台音频库,当前支持windows32操作系统和linux32位操作系统

修改记录
1.2013.04.01
    初次发布
2.2013.04.10
    完成对wav格式采样频率8000-48000,采样格式4,8,16,24,32的支持     
3.2013.05.01
    a.版本提升为1.4.0.8
    b.修改一个退出异常
    c.支持二源混音
    d.使用载入插件的方式提供对wav播放的支持
    e.增加对au格式的支持
    f.增加echo音效
    g.增加bassboost音效
    h.增加函数gaudio_address_get
    i.增加使用例子:echo/mixer/stream/boost
    j.把设置,获取音源三维空间信息的函数调整为: gaudio_source_set_float3,gaudio_source_get_float3
    k.修改解码器结构为回调模式
4.2013.05.10
    a.版本提升为1.6.8.0
    b.优化部分代码
    c.增加speedchanger音效
    d.增加音频翻转(g168)
    e.增加音频声道交换(g168)
    f.增加声道合并(g168)
    g.增加speedchanger/invert测试用例
    h.增加vc调用静态链接库libgaudio.lib
    i.增加调制音效和测试例子
    j.修改解码器框架
    k.修改获取音频采样编码格式不正确的问题
    l.解决seek定位不准的问题
    m.增加音效链测试例子
    n.增加函数gaudio_set_long,gaudio_get_long
    o.修改stream例子
    p.支持压缩mpc音频格式
    q.支持ogg/vorbis格式
    r.修改获取采样格式错误的bug
    t.增加接口说明文档    
5.2013.06.10
    a.版本提升为1.7.2.0
    b.gaudio_source_set_error_callback回调函数增加音源参数
    c.gaudio_source_set_finish_callback回调函数增加音源参数
    d.移除gaudio_get_version函数
    e.gaudio_effect_setcallback函数调整为gaudio_effect_set_callback
    f.使用插件式的音频驱动模式 - gwinmm
    g.gaudio代码优化
    h.增加音频源码率的获取
    i.增加feature范例
    j.完善文档
    k.增加对mp3的支持
    l.移除invert/modulator/bassboost例子
    m.增加balance
6.2013.07.07
    a.版本提升到1.8.0.2
    b.增加对交换文件aiff的支持
    c.修改音频驱动插件实现
    d.增加移相器音效
    e.修改部分API接口使用的long为int32_t以方便移植
    f.增加code::blocks测试工程
    g.增加msvc2008测试工程
    h.增加函数接口gaudio_source_create_from_buffer2以播放raw音频数据
    i.把各个音效参数提到单独文件
    j.简化wav解码
    k.修改几处内存泄漏
    l.增加音频回录功能,输出格式MP2,MP3,APE,WV,AAC,WAV,AU,AIFF,VOC,CAF,OGG
    当前录制信息:16位音频,双声道,采样频率44100
    m.增加音频回录的例子recorder
    n.测试例子使用getopt和usage提示
    o.增加对tta格式的支持    
7.2013.07.28
    a.版本提升到1.9.8.6                   
    b.解决了wav,au,aiff播放进度不准的故障
    c.优化wav/au/aiff解码性能        
    d.增加distortion音效              
    e.增加foldback distortion音效       
    f.增加distortion音效使用例子       
    g.增加声音穿透力                      
    h.修改结构最大支持八声道             
    i.增加portaudio插件驱动(win32&linux)  
    j.完成g168,bassbost的liux版本     
    k.完成wav,au音频格式的linux版本      
    l.代码增加部分注释(未完成)            
    m.尝试性支持linux操作系统             
    n.支持midi/mid音乐格式             
    o.解决了mixer混音退出报错的问题
    p.skip id3v2    
8.2013.08.16
    a.版本提升到2.0.0.1                    
    b.变量宏增加AUDIO_ENUM前缀
    c.增加非标准插件gsndfile支持flac/ogg/au/wav/aiff/voc/caf/..基于(sndfile)
    d.改用mpg123解码mp3
    e.支持FFT频谱
9.2013.09.08
    a.版本提升到2.0.6.0
    b.修改CROSSFEED宏和相关    
    c.引入200号插件支持s3m/mod/it/xm音频格式
    d.整理测试用例
    e.增加autowah音效
    f.增加驱动检测
10.2015.12.10 版本2.2.1.0
支持常见音频格式和音效,使用超级方便
下载在这里:/Files/gaimor/gaudio-sdk-2.2.1.0.zip

    
 
posted @ 2013-07-11 22:49 ccsdu2009 阅读(5222) | 评论 (2)编辑 收藏

uedbet 2019年8月23日

m88 188bet uedbet 威廉希尔 明升 bwin 明升88 bodog bwin 明升m88.com 18luck 188bet unibet unibet Ladbrokes Ladbrokes casino m88明升 明升 明升 m88.com 188bet m88 明陞 uedbet赫塔菲官网 365bet官网 m88 help
188bet www.188bet.com bwin 平博 unibet 明升 188bet uk Ladbrokes 德赢vwin 188bet m88.com w88 平博88 uedbet体育 188bet 188bet 威廉希尔 明升体育app 平博88 M88 Games vwin德赢 uedbet官网 bodog fun88 188bet
#include <QString>
#include 
<QtPlugin>
#include 
<QObject>

struct AddonInfo
{
    QString name;
    QString description;
    QString version;
    QString author;
};

class AddonInterface : public QObject
{
    Q_OBJECT
public:
    
virtual ~AddonInterface() {}
    
virtual AddonInfo addonInfo()const { return AddonInfo(); }
};

Q_DECLARE_INTERFACE(AddonInterface,
"com.ppx.addon.interface/1.0")

class AddonInterfaceIMPL : public AddonInterface
{
    Q_OBJECT
public:
    AddonInfo addonInfo()
const;

#if QT_VERSION >= 0x050000
    Q_PLUGIN_METADATA(IID 
"com.ppx.addon.interface")
    Q_INTERFACES(AddonInterface);
#endif 
};

#include "addon.h"
#if QT_VERSION < 0x050000
Q_EXPORT_PLUGIN2(FilterInterface,plugin)
#endif // QT_VERSION < 0x050000

AddonInfo AddonInterfaceIMPL::addonInfo()const
{
    AddonInfo addon;
    addon.name = "MyAddOn";
    addon.author = "Coder";
    addon.description = "Description";
    addon.version = "1.0";
    return addon;
}

使用
#include <qplugin.h>
#include <qpluginloader.h>
#include <qdebug>
#include "addon.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QPluginLoader loader("addon.dll");
    qDebug()<<"load plugin :"<<loader.load();

    auto object = loader.instance();
    qDebug() << "object:" << object;
    if (object)
    {
        AddonInterface* face = qobject_cast<AddonInterface*>(object);
        qDebug() << "face ptr:"<<face;
        auto info = face->addonInfo();
        qDebug() << info.author << " " << info.description << " " << info.name << " " << info.version;
    }

    return a.exec();
}

posted @ 2019-08-23 17:49 ccsdu2009 阅读(4) | 评论 (0)编辑 收藏

2019年8月22日

import QtQuick 2.4

Rectangle
{
    id: dragBackground
    visible: 
true
    color: 
"#dad1db"
    width:
720
    height:
480

    DragRectangle
    {
        z: 
10
        id:dragRectangle
        width: 
480
        height:
240

        Component.onCompleted:
        {
             dragBackground.makeViewCenter(dragRectangle)
        }
    }

    
function makeViewCenter(view)
    {
        
var cx = (width-view.width)*0.5
        
var cy = (height-view.height)*0.5
        view.x 
= cx
        view.y 
= cy
    }
}

Rectangle
import QtQuick 2.0

Rectangle
{
    id:resizeRectangle
    property int enableSize: 12
    property bool isPressed: false
    property point customPoint
    color: "#00debff3"
    border.color: "#d37e49"
    readonly property int minWidth: 64
    readonly property int minHeight: 64

    MouseArea
    {
        id: mouseArea
        anchors.fill: resizeRectangle
        drag.target: parent

        onWheel:
        {
            var diff_w = 0.0
            var diff_h = 0.0

            if(wheel.angleDelta.y > 0)
            {
                diff_w = resizeRectangle.width * 0.02
                diff_h = resizeRectangle.height * 0.02
            }
            else if(wheel.angleDelta.y < 0)
            {
                diff_w = -resizeRectangle.width * 0.02
                diff_h = -resizeRectangle.height * 0.02
            }
            else
            {
                resizeRectangle.width = width
                resizeRectangle.height = height
            }

            fixedRetangle(diff_w,diff_h)

            drag.minimumX = 0
            drag.maximumX = dragBackground.width - resizeRectangle.width
            drag.minimumY = 0
            drag.maximumY = dragBackground.height - resizeRectangle.height
        }
    }

    Item
    {
        id: leftTop
        width: enableSize
        height: enableSize
        anchors.left: parent.left
        anchors.top: parent.top

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(1)
            onReleased: release()
            onPositionChanged: positionChange(mouse, -1, -1)
        }
    }

    Item
    {
        id: top
        height: enableSize
        anchors.left: leftTop.right
        anchors.right: rightTop.left
        anchors.top: parent.top

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(2)
            onReleased: release()
            onMouseYChanged: positionChange(Qt.point(customPoint.x, mouseY), 1, -1)
        }
    }

    Item
    {
        id: rightTop
        width: enableSize
        height: enableSize
        anchors.right: parent.right
        anchors.top: parent.top

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(3)
            onReleased: release()
            onPositionChanged: positionChange(mouse, 1, -1)
        }
    }

    Item
    {
        id: left
        width: enableSize
        anchors.left: parent.left
        anchors.top: leftTop.bottom
        anchors.bottom: leftBottom.top

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(4)
            onReleased: release()

            onMouseXChanged: positionChange(Qt.point(mouseX, customPoint.y), -1, 1)
        }
    }

    Item
    {
        id: center
        anchors.left: left.right
        anchors.right: right.left
        anchors.top: top.bottom
        anchors.bottom: bottom.top

        MouseArea
        {
            anchors.fill: parent
            property point clickPos

            onPressed: clickPos = Qt.point(mouse.x,mouse.y)
            onPositionChanged:
            {
                if(pressed)
                {
                    var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y)
                    resizeRectangle.x += delta.x
                    resizeRectangle.y += delta.y
                    fixedRetangle(0,0)
                }
            }
        }
    }

    Item
    {
        id: right
        width: enableSize
        anchors.right: parent.right
        anchors.top: rightTop.bottom
        anchors.bottom: rightBottom.top

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(6)
            onReleased: release()
            onMouseXChanged: positionChange(Qt.point(mouseX, customPoint.y), 1, 1)
        }
    }

    Item
    {
        id: leftBottom
        width: enableSize
        height: enableSize
        anchors.left: parent.left
        anchors.bottom: parent.bottom

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(7)
            onReleased: release()
            onPositionChanged: positionChange(mouse, -1, 1)
        }
    }

    Item
    {
        id: bottom
        height: enableSize
        anchors.left: leftBottom.right
        anchors.right: rightBottom.left
        anchors.bottom: parent.bottom

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(8)
            onReleased: release()
            onMouseYChanged: positionChange(Qt.point(customPoint.x, mouseY), 1, 1)
        }
    }

    Item
    {
        id:rightBottom
        width: enableSize
        height: enableSize
        anchors.right: parent.right
        anchors.bottom: parent.bottom

        MouseArea
        {
            anchors.fill: parent
            hoverEnabled: true

            onPressed: press(mouse)
            onEntered: enter(9)
            onReleased: release()

            onPositionChanged: positionChange(mouse,1,1)
        }
    }

    function fixedRetangle(dx,dy)
    {
        if(resizeRectangle.width <= minWidth && resizeRectangle.height <= minHeight && dx <=0 && dy <= 0)
            return

        resizeRectangle.x -= dx*0.5
        resizeRectangle.y -= dy*0.5
        resizeRectangle.width += dx
        resizeRectangle.height += dy

        if(resizeRectangle.width < minWidth)
            resizeRectangle.width = minWidth
        if(resizeRectangle.height < minHeight)
            resizeRectangle.height = minHeight

        if(resizeRectangle.width > dragBackground.width)
            resizeRectangle.width = dragBackground.width
        if(resizeRectangle.height > dragBackground.height)
            resizeRectangle.height = dragBackground.height

        if(resizeRectangle.width + resizeRectangle.x > dragBackground.width)
            resizeRectangle.x = dragBackground.width - resizeRectangle.width
        if(resizeRectangle.height + resizeRectangle.y > dragBackground.height)
            resizeRectangle.y = dragBackground.height - resizeRectangle.height

        if(resizeRectangle.y < 0)
            resizeRectangle.y = 0

        if(resizeRectangle.x < 0)
            resizeRectangle.x = 0
    }

    function enter(direct)
    {
    }

    function press(mouse)
    {
        isPressed = true
        customPoint = Qt.point(mouse.x, mouse.y)
    }

    function release()
    {
        isPressed = false
    }

    function positionChange(newPosition,directX, directY)
    {
        if(!isPressed)
            return

        var delta = Qt.point(newPosition.x-customPoint.x, newPosition.y-customPoint.y)
        var tmpW,tmpH

        if(directX >= 0)
            tmpW = resizeRectangle.width + delta.x
        else
            tmpW = resizeRectangle.width - delta.x

        if(directY >= 0)
            tmpH = resizeRectangle.height + delta.y
        else
            tmpH = resizeRectangle.height - delta.y

        if(tmpW < resizeRectangle.minimumWidth)
        {
            if(directX < 0)
                resizeRectangle.x += (resizeRectangle.width - resizeRectangle.minimumWidth)
            resizeRectangle.width = resizeRectangle.minimumWidth
        }
        else
        {
            resizeRectangle.width = tmpW
            if(directX < 0)
                resizeRectangle.x += delta.x
        }

        if(tmpH < resizeRectangle.minimumHeight)
        {
            if(directY < 0)
                resizeRectangle.y += (resizeRectangle.height - resizeRectangle.minimumHeight)
            resizeRectangle.height = resizeRectangle.minimumHeight
        }
        else
        {
            resizeRectangle.height = tmpH
            if(directY < 0)
                resizeRectangle.y += delta.y
        }

        fixedRetangle(0,0)
    }
}

posted @ 2019-08-22 15:00 ccsdu2009 阅读(5) | 评论 (0)编辑 收藏
 
void adjustImageHSL(QImage& image,qreal hue,qreal saturation,qreal lightness)
{
    unsigned 
int* data = (unsigned int*)image.bits();
    
int size = image.width()*image.height();
    QColor color;

    
for(int i = 0; i < size; i++)
    {
        
int red = qRed(data[i]);
        
int green = qGreen(data[i]);
        
int blue = qBlue(data[i]);
        color.setRed(red);
        color.setGreen(green);
        color.setBlue(blue);
        qreal h 
= color.hueF() + hue;
        qreal s 
= color.saturationF() + saturation;
        qreal l 
= color.lightnessF() + lightness;
        h 
= qBound<qreal>(0,h,1);
        s 
= qBound<qreal>(0,s,1);
        l 
= qBound<qreal>(0,l,1);
        color.setHslF(h,s,l);
        color.setAlpha(qAlpha(data[i]));
        data[i] 
= qRgba(color.red(),color.green(),color.blue(),color.alpha());
    }

    
return;
}
posted @ 2019-08-22 11:49 ccsdu2009 阅读(5) | 评论 (0)编辑 收藏

2019年8月21日

import QtQuick 2.4
import QtQuick.Controls 
2.4
import QtQuick.Layouts 
1.3
import QtQuick.Dialogs 
1.2

Popup
{
    width: 
360
    height: 
90
    modal: 
true
    focus: 
true
    opacity: 
0.96

    
function setWarningText(input)
    {
        warningText.text 
= input
    }

    Text
    {
        id:warningText
        anchors.centerIn: parent
        text: 
"WarningText"
    }
}
posted @ 2019-08-21 15:58 ccsdu2009 阅读(6) | 评论 (0)编辑 收藏

2019年8月20日

import QtQuick 2.9

Item
{
    visible: 
true
    width: 
1620
    height: 
720
    id:background

    Image
    {
        source: 
"images/2560.png"
        anchors.fill: parent
    }

    Flickable
    {
        id: flick
        anchors.top: parent.top;
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.bottom: parent.bottom
        anchors.margins: 
3
        contentWidth: 
0
        contentHeight: 
0
        clip: 
true

        Image
        {
            id: image
            smooth: 
true
            transformOrigin: Item.Center
            source:
"mark.png"

            onStatusChanged:
            {
                
if(status === Image.Ready)
                {
                    image.width 
*= 0.5
                    image.height 
*= 0.5

                    image.x 
= background.width*0.5-0.5*image.width
                    image.y 
= background.height*0.5-0.5*image.height

                    
/*mouseArea.drag.minimumX = 0
                    mouseArea.drag.maximumX = flick.width - image.width
                    mouseArea.drag.minimumY = 0
                    mouseArea.drag.maximumY = flick.height - image.height
*/
                }
            }
        }
    }

    
function makeImageCenter(imageWidth,imageHeight)
    {
        
var cx = image.x + 0.5*image.width
        
var cy = image.y + 0.5*image.height

        image.width 
= imageWidth
        image.height 
= imageHeight

        image.x 
= cx - image.width*0.5
        image.y 
= cy - image.height*0.5
    }

    MouseArea
    {
        id: mouseArea
        anchors.fill: flick
        drag.target: image

        onWheel:
        {
            
var diff_w = 0.0
            
var diff_h = 0.0

            
if(wheel.angleDelta.y > 0)
            {
                diff_w 
= image.width * 0.02
                diff_h 
= image.height * 0.02
            }
            
else if(wheel.angleDelta.y < 0)
            {
                diff_w 
= -image.width * 0.02
                diff_h 
= -image.height * 0.02
            }
            
else
            {
                image.width 
= width
                image.height 
= height
            }

            
if(wheel.angleDelta.y != 0)
                background.makeImageCenter(image.width
+diff_w,image.height+diff_h)

            drag.minimumX 
= 0
            drag.maximumX 
= flick.width - image.width
            drag.minimumY 
= 0
            drag.maximumY 
= flick.height - image.height
        }
    }
}
posted @ 2019-08-20 13:53 ccsdu2009 阅读(4) | 评论 (0)编辑 收藏

2019年8月19日

void buildTreeItem(QObjectList* list,QStandardItem* item)
{
    
foreach(auto object,*list)
    {
        auto current 
= new QStandardItem();
        current
->setText(object->objectName());
        item
->appendRow(current);
        auto chidren 
= object->children();
        
if(!chidren.isEmpty())
            buildTreeItem(
&chidren,current);
    }
}

void buildTree(QTreeView* view,const QList<QObject*>& list)
{
    view
->header()->hide();
    view
->setColumnHidden(0,true);
    QStandardItemModel
* model = new QStandardItemModel(view);
    
foreach(auto object,list)
    {
        auto item 
= new QStandardItem(object->objectName());
        auto list 
= object->children();
        buildTreeItem(
&list,item);
        model
->appendRow(item);
    }
    view
->setModel(model);
}

QObject
* buildObjectTree(QObject* parent,const QString& text)
{
    auto 
object = new QObject(parent);
    
object->setObjectName(text);
    
return object;
}



    QWidget widget;
    auto box 
= new QVBoxLayout();
    widget.setLayout(box);
    QTreeView
* tree = new QTreeView(&widget);
    box
->addWidget(tree);

    QList
<QObject*> list;
    auto 
object = buildObjectTree(nullptr,"1");

    list.append(
object);
    
    buildObjectTree(
object"2");
    buildObjectTree(
object"3");
    
object = buildObjectTree(object"4");
    buildObjectTree(
object"5");
    buildObjectTree(
object"6");
    
object = buildObjectTree(object"7");

    buildObjectTree(
object"8");
    buildObjectTree(
object"9");
    buildObjectTree(
object"10");
    buildObjectTree(
object"11");
    
    buildTree(tree,list);
    widget.show();
posted @ 2019-08-19 13:42 ccsdu2009 阅读(8) | 评论 (0)编辑 收藏

2019年8月16日

static QObject* cpp_qobject_singletontype_provider(QQmlEngine* engine,QJSEngine* scriptEngine)
{
    Q_UNUSED(engine)
    Q_UNUSED(scriptEngine)
    return cppobject;
}

qmlRegisterSingletonType<CppObject>("cppobject", 1, 0, "CppObject",cppobject_qobject_singletontype_provider);
posted @ 2019-08-16 12:14 ccsdu2009 阅读(3) | 评论 (0)编辑 收藏

2019年8月15日

    auto box = new QVBoxLayout();
    qml = new QQuickWidget();
    setLayout(box);

    qml->setResizeMode(QQuickWidget::SizeRootObjectToView);
    qml->setClearColor(Qt::gray);

    QMLObjectInterface* face = new QMLObjectInterface(this);
    qml->engine()->rootContext()->setContextProperty("cplusplusObject",face);

    qml->setSource(QUrl("QML.qml"));
    foreach(auto error, qml->errors())
        qDebug() << "error:" << error;

    auto object = qml->rootObject();
    object->setProperty("width",480);
   
    auto items = object->findChildren<QQuickItem*>("button");
   
    if (!items.isEmpty())
        items[0]->setProperty("text",QStringLiteral("按键"));
 

    box->addWidget(qml);
QML
import QtQuick 2.11
import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import "qmls" as QMLS
import cplusplus 1.0

Rectangle
{
    id: base
    width:640
    height:480

    ColumnLayout
    {
        anchors.fill:parent
        anchors.margins: 6
        spacing: 4

        Rectangle
        {
            id:image
            Layout.fillWidth: true
            Layout.fillHeight: true
            color:"#cdcdc0"

            TextEdit
            {
                id:text
                anchors.centerIn: parent
                width:parent.width
                text:"请点击下方按键"
                verticalAlignment: Text.AlignVCenter
                horizontalAlignment: Text.AlignHCenter
                wrapMode: Text.WordWrap
                font.pointSize: 12
            }
        }

        RowLayout
        {
            Rectangle
            {
                Layout.fillWidth: true
            }

            Button
            {
                id:button
                property int index: 0
                property string buttonText:"Click"
                text:buttonText
                objectName: "button"
                onClicked:
                {
                    text.text = cplusplusObject.getString()
                }
            }

        }
    }
}
posted @ 2019-08-15 09:40 ccsdu2009 阅读(4) | 评论 (0)编辑 收藏

2019年8月14日

import QtQuick 2.11
import QtQuick.Controls 2.1
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import cplusplus 1.0

Rectangle
{
    id: base
    width:640
    height:480

    ColumnLayout
    {
        anchors.fill:parent
        anchors.margins: 6
        spacing: 4

        Rectangle
        {
            id:image
            Layout.fillWidth: true
            Layout.fillHeight: true
            color:"#cdcdc0"

            TextEdit
            {
                id:text
                anchors.centerIn: parent
                width:parent.width
                text:"请点击下方按键"
                verticalAlignment: Text.AlignVCenter
                horizontalAlignment: Text.AlignHCenter
                wrapMode: Text.WordWrap
                font.pointSize: 12
            }
        }

        RowLayout
        {
            Rectangle
            {
                Layout.fillWidth: true
            }

            Button
            {
                property int index: 0
                text:"点击"

                onClicked:
                {
                    text.text = cplusplusObject.getString()
                }
            }

        }
    }
}

posted @ 2019-08-14 17:46 ccsdu2009 阅读(5) | 评论 (0)编辑 收藏
 
ListView
        {
            id: view
            orientation: Qt.Horizontal
            Layout.fillWidth: true
            height:64
            //model: 180
            spacing: -24
            clip: true

            delegate: Rectangle
            {
                width: 50
                height: parent.height

                Image
                {
                    id:imageItem
                    width:64
                    height:64
                    anchors.centerIn: parent
                    source:getFileName(index*Math.floor(2560/180))
                    property int current: 0

                    onSourceChanged:
                    {
                        current = index;
                    }

                    MouseArea
                    {
                        id: mouseArea
                        anchors.fill: parent
                        onClicked:
                        {
                            var filename = getFileName(Math.floor(2560/180)*imageItem.current)
                            image.source = filename
                        }
                    }
                }

                function getFileName(index)
                {
                    return "images/"+index+".png"
                }
            }
        }
posted @ 2019-08-14 16:02 ccsdu2009 阅读(5) | 评论 (0)编辑 收藏
仅列出标题  下一页