Qt 5.10 Book Examples
main.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // main.cpp
3 // ======================================================================
4 // This file is a part of the book
5 // "Qt 5.10 Professional programming with C++"
6 // http://qt-book.com
7 // ======================================================================
8 // Copyright (c) 2017 by Max Schlee
9 // ======================================================================
10 
11 #include <QtWidgets>
12 #include "Viewer.h"
13 
14 // ----------------------------------------------------------------------
15 int main(int argc, char** argv)
16 {
17  QApplication app(argc, argv);
18  QFileSystemWatcher watcher;
19  Viewer viewer;
20 
21  QStringList args = app.arguments();
22  args.removeFirst();
23 
24  watcher.addPaths(args);
25 
26  viewer.append("Watching files:" + watcher.files().join(";"));
27  viewer.append("Watching dirs:" + watcher.directories().join(";"));
28  viewer.show();
29 
30  QObject::connect(&watcher, SIGNAL(directoryChanged(const QString&)),
31  &viewer, SLOT(slotDirectoryChanged(const QString&))
32  );
33  QObject::connect(&watcher, SIGNAL(fileChanged(const QString&)),
34  &viewer, SLOT(slotFileChanged(const QString&))
35  );
36 
37  return app.exec();
38 }
int main(int argc, char **argv)
Definition: main.cpp:15
Definition: Viewer.h:16