fsWatcher=new QFileSystemWatcher(); 会报错怎么回事
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QFileSystemWatcher>
#include <QDir>
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
changeread();
path1="/home/ma/ma1/";
fsWatcher=new QFileSystemWatcher();
fsWatcher->addPath(path1);
connect(fsWatcher, SIGNAL(directoryChanged(QString)), this, SLOT(changeread()));
}
[root@localhost ]# make
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/local/Nokia/Qt-4.7.3_static/mkspecs/linux-g++ -I. -I/usr/local/Nokia/Qt-4.7.3_static/include/QtCore -I/usr/local/Nokia/Qt-4.7.3_static/include/QtGui -I/usr/local/Nokia/Qt-4.7.3_static/include -I. -I. -o widget.o widget.cpp
widget.cpp: In constructor ‘Widget::Widget(QWidget*)’:
widget.cpp:71: 错误:‘fsWatcher’ 在此作用域中尚未声明
widget.cpp: In member function ‘virtual void Widget::paintEvent(QPaintEvent*)’:
widget.cpp:187: 警告:将 ‘double’ 作为实参 1 传递给 ‘void QPainter::drawEllipse(int, int, int, int)’
widget.cpp:187: 警告:将 ‘double’ 作为实参 2 传递给 ‘void QPainter::drawEllipse(int, int, int, int)’
make: *** [widget.o] 错误 1
You have new mail in /var/spool/mail/root
[解决办法]