函数回调没有找到重载的成员函数 您所在的位置:网站首页 中没有找到重载的成员函数 函数回调没有找到重载的成员函数

函数回调没有找到重载的成员函数

2024-07-02 21:55| 来源: 网络整理| 查看: 265

0x01 现象

今天进行qt视频播放器的时候,定义了一个mediaplayer,但是要实现倍速播放,和全屏播放,没得办法只能使用函数回调,以下是错误信息在这里插入图片描述 以下是头文件

#pragma once #include "abstructMedia.h" #include "pch.h" class media :public abstructMedia { public: int mediaplayer(const char * filePath, media::playSpeed playerSpeedCallBack , media::fullsrc fullSrcCallBack ); virtual int InitMedia(const char * filePath); media(); ~media(); public: /* 媒体的信息 */ const char filePath[128] = { 0 }; char name[128] = { 0 }; int durationInfo; int sizeheight; int sizewigth; int sampleRate; int mediaState = 0; /* 暂时只能使用函数回掉 */ typedef int(*fullsrc)(int); typedef int(*playSpeed)(int); };

以下是摘取的部分cpp文件

int media::mediaplayer(const char * filePath, media::playSpeed playerSpeedCallBack , media::fullsrc fullSrcCallBack) 0x02 解决方案

就是将头文件中的 typedef int(*fullsrc)(int); typedef int(*playSpeed)(int);放在函数前面

#pragma once #include "abstructMedia.h" #include "pch.h" class media :public abstructMedia { public: /* 暂时只能使用函数回掉 */ typedef int(*fullsrc)(int); typedef int(*playSpeed)(int); int mediaplayer(const char * filePath, media::playSpeed playerSpeedCallBack , media::fullsrc fullSrcCallBack ); virtual int InitMedia(const char * filePath); media(); ~media(); public: /* 媒体的信息 */ const char filePath[128] = { 0 }; char name[128] = { 0 }; int durationInfo; int sizeheight; int sizewigth; int sampleRate; int mediaState = 0; }; 0x03 误区与思索 类进行编译时会进行类型检查,我开始只是以为跟调用一样,开始不会对函数进行编译,根据对象初始化顺序,先进行构造函数和类属性,然后在初始化成员函数,结果。。。下次注意吧


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有