qfilesystemwatcher

QT - QFileSystemModel on server-client program

Deadly 提交于 2020-01-15 06:34:27
问题 I am working on a server-client QT project that allows to transfer files between server and client. Being a GUI project, I want to display the server's file system on client program, like a file explorer. The question is : is there a way to send the QFileSystemModel or QFileSystemWatcher from server to client, or to display the server's system file on client side? Thank you. 回答1: The best approach to tackle this problem is to implement a serialization technique for your object(s). Once that's

QFileSystemWatcher working only in main()

家住魔仙堡 提交于 2019-12-25 18:20:06
问题 I am trying to use QFileSystemWatcher like in the following example : How to use QFileSystemWatcher to monitor a folder for change My issue is that the watcher does work when I create it in the main() function like in the following : #include "mainwindow.h" #include <QApplication> #include <QFileSystemWatcher> #include <QDebug> #include "systemfilewatcher.h" int main(int argc, char *argv[]) { QApplication a(argc, argv); QFileSystemWatcher watcher; watcher.addPath("C:/QtTest");

Qt QFileSystemWatcher on Windows

大兔子大兔子 提交于 2019-12-14 03:47:42
问题 I have the following issue: I create a QFileSystemWatcher and it runs and works nicely on Linux, but no way on Windows 7. Can you spot anything in the code that might make it not to work? Thx. Here is the code to initialize it: mConfigChangeWatcher = new QFileSystemWatcher(); mConfigChangeWatcher->addPath(config_file_name); QObject::connect(mConfigChangeWatcher, SIGNAL(fileChanged(QString)), this, SLOT(configFileChanged(QString))); and this is supposed to be the slot getting the work done:

How to refresh a QFileSystemModel in a QTreeView after files change through another process?

霸气de小男生 提交于 2019-12-11 02:33:46
问题 I have a QTreeView with a QFileSystemModel as the model. Files and directories load correctly. In my application workflow, a different process copies and overwrites files on the file system. However, my QTreeView does not update the item/row for the overwritten file (eg: the size and lastModified values for the file do not update to the new values). Using the file path, I'm able to get a FileInfo that DOES have the updated lastModified value. However, using that same path to grab the

How to know that a file was opened ? QT

我的梦境 提交于 2019-12-10 17:47:40
问题 I want to know if a file was opened by user for reading (double click or open with ...), I am coding a C++ application with Qt Creator on Windows, after some research I found QFileSystemWatche, but it let me know only if a change was happened in the specific folder. void QFileSystemWatcher::fileChanged ( const QString & path ) [signal] This signal is emitted when the file at the specified path is modified, renamed or removed from disk. How to know if the file was opened? or is there a way to