file.setFileName("/proc/oem_gpio/oem_gpio8");
file.open(QIODevice::ReadOnly | QIODevice::Text);
m_watcher = new QFileSystemWatcher(this);
m_watcher->addPath("/proc/oem_gpio/oem_gpio8");
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, &battery::onCheckState);
文件发生改变,发送信号 fileChanged
QSocketNotifier同样可以监听文件