QT monitor Hot plug and button event

 

1. monitor the file system (either /etc/fstab or /mnt/something)

2. use hal and dbus

 

if (!QDBusConnection::systemBus().isConnected()) {
   qDebug() << "Cannot connect to system bus";
   }
bool connected = QDBusConnection::systemBus().connect(
   "org.freedesktop.Hal",
   "/org/freedesktop/Hal/Manager",
   "org.freedesktop.Hal.Manager",
   "DeviceAdded",
   this, SLOT(deviceAdded()));

你可能感兴趣的:(qt)