diff options
| author | Christoph Berg <christoph.berg@credativ.de> | 2022-08-23 10:23:16 +0200 |
|---|---|---|
| committer | Christoph Berg <christoph.berg@credativ.de> | 2022-08-23 10:23:16 +0200 |
| commit | 2d1068e60bce7ae1fff11623454900e8cee956b1 (patch) | |
| tree | acebe276e30466ef0ab91bc3da5e379bec0d7dc5 /SampleDownloader/DirectoryNode.hpp | |
| parent | 43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef (diff) | |
New upstream version 2.6.0~rc3+repackupstream/2.6.0_rc3+repack
Diffstat (limited to 'SampleDownloader/DirectoryNode.hpp')
| -rwxr-xr-x | SampleDownloader/DirectoryNode.hpp | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/SampleDownloader/DirectoryNode.hpp b/SampleDownloader/DirectoryNode.hpp index 2de16eac..d846f865 100755 --- a/SampleDownloader/DirectoryNode.hpp +++ b/SampleDownloader/DirectoryNode.hpp @@ -1,51 +1,51 @@ -#ifndef DIRECTORY_NODE_HPP__ -#define DIRECTORY_NODE_HPP__ - -#include <QTreeWidgetItem> -#include <QString> - -// -// Tree widget item representing a file system directory. -// -// It renders the directory name in the first column and progress -// information in the 2nd column. The progress information consists of -// two 64 bit integer values, the 1st in the DisplayRole is the number -// of bytes received and the 2nd in the UserRole the total bytes -// expected. The progress information is not automatically -// maintained, see the Directory class for an example of how to -// dynamically maintain the DirectoryNode progress values. The 1st -// column also renders a tristate check box that controls the first -// column check boxes of child items. -// -class DirectoryNode final - : public QTreeWidgetItem -{ -public: - explicit DirectoryNode (QTreeWidgetItem * parent, QString const& name) - : QTreeWidgetItem {parent, Type} - { - setFlags (flags () | Qt::ItemIsUserCheckable | Qt::ItemIsTristate); - setText (0, name); - setCheckState (0, Qt::Unchecked); - - // initialize as empty, the owning QTreeWidget must maintain these - // progress values - setData (1, Qt::DisplayRole, 0ll); // progress in bytes - setData (1, Qt::UserRole, 0ll); // expected bytes - } - - bool operator == (QString const& name) const - { - return name == text (0); - } - - static int constexpr Type {UserType}; -}; - -inline -bool operator == (QString const& lhs, DirectoryNode const& rhs) -{ - return rhs == lhs; -} - -#endif +#ifndef DIRECTORY_NODE_HPP__
+#define DIRECTORY_NODE_HPP__
+
+#include <QTreeWidgetItem>
+#include <QString>
+
+//
+// Tree widget item representing a file system directory.
+//
+// It renders the directory name in the first column and progress
+// information in the 2nd column. The progress information consists of
+// two 64 bit integer values, the 1st in the DisplayRole is the number
+// of bytes received and the 2nd in the UserRole the total bytes
+// expected. The progress information is not automatically
+// maintained, see the Directory class for an example of how to
+// dynamically maintain the DirectoryNode progress values. The 1st
+// column also renders a tristate check box that controls the first
+// column check boxes of child items.
+//
+class DirectoryNode final
+ : public QTreeWidgetItem
+{
+public:
+ explicit DirectoryNode (QTreeWidgetItem * parent, QString const& name)
+ : QTreeWidgetItem {parent, Type}
+ {
+ setFlags (flags () | Qt::ItemIsUserCheckable | Qt::ItemIsTristate);
+ setText (0, name);
+ setCheckState (0, Qt::Unchecked);
+
+ // initialize as empty, the owning QTreeWidget must maintain these
+ // progress values
+ setData (1, Qt::DisplayRole, 0ll); // progress in bytes
+ setData (1, Qt::UserRole, 0ll); // expected bytes
+ }
+
+ bool operator == (QString const& name) const
+ {
+ return name == text (0);
+ }
+
+ static int constexpr Type {UserType};
+};
+
+inline
+bool operator == (QString const& lhs, DirectoryNode const& rhs)
+{
+ return rhs == lhs;
+}
+
+#endif
|
