• 5751阅读
  • 1回复

自己编的qprocess例子 各位看一下错在哪里了 [复制链接]

上一主题 下一主题
离线liuyang
 
只看楼主 倒序阅读 楼主  发表于: 2006-06-06
//main.cpp
#include <qapplication.h>
#include <qpushbutton.h>
#include <qfont.h>
#include "slot.h"
int main( int argc, char **argv )
{
  QApplication a( argc, argv );

  QPushButton quit( "mp3play", 0 );
  quit.resize( 175, 130 );
  quit.setFont( QFont( "Times", 18, QFont::Bold ) );
  MP3play b;
  b.addArgument("sh");
  b.addArgument("/1");
    QObject::connect( &quit, SIGNAL(clicked()), &b, SLOT(mySlot()) );

  a.setMainWidget( &quit );
  quit.show();
  return a.exec();
}


//slot.h
#include<qprocess.h>
class MP3play : QProcess
{
Q_OBJECT;
public:

MP3play();

public slots:
void myslot();
signals:
  };

//slot.c
                                                           
#include<qporcess.h>
#include<qwidget.h>
#include "slot.h"
void MP3play::myslot()
{
  start();
}


//error
[root@host test4]# make
g++ -c -pipe -Wall -W -O2 -march=i386 -mcpu=i686 -g -DGLX_GLXEXT_LEGACY -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG -I/usr/lib/qt-3.1/mkspecs/default -I. -I. -I/usr/lib/qt-3.1/include -o qt.o qt.cpp
qt.cpp: In function `int main(int, char**)':
qt.cpp:15: `QObject' is an inaccessible base of `MP3play'
make: *** [qt.o] Error 1


[ 此贴被XChinux在2006-06-07 00:36重新编辑 ]
信源于知 知源于行 不行不信
离线shiroki

只看该作者 1楼 发表于: 2006-06-07
class MP3play : QProcess
是不是因为这里没有写public阿

class MP3play : public QProcess
--
shiro is White
ki is tree
http://www.cuteqt.com
论坛 http://www.cuteqt.com/bbs
博客 http://www.cuteqt.com/blog
博客镜像: http://sites.cuteqt.com/cuteqt
Linux/Qt/嵌入式讨论群 http://qun.qq.com/air/5699823
快速回复
限100 字节
 
上一个 下一个