#include <node.h>
Public Member Functions | |
node (QString path, QObject *parent=0) | |
void | addToTotalSize (qint64 size) |
void | traverse () |
bool | isDir () |
QRectF | calculateRect () |
void | addParentOffset (float offset) |
void | addParentOffset (QRectF rect) |
node * | parent () |
bool | isVertical () |
qint64 | getTotalSize () |
QString | getPath () |
QVector< node * > | getChildren () |
int | getDepth () |
float | getScaleFactor () |
void | setTreeItem (QTreeWidgetItem *item) |
Static Public Member Functions | |
static void | setTreeWidget (QTreeWidget *tw) |
Public Attributes | |
QVector< node * > | children |
Liste von untergeordneten Knoten. | |
Protected Member Functions | |
qint64 | traverse (QDirIterator &it) |
void | addChild (node *childNode) |
float | getRelativeSize () |
void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
void | setSize (qint64 size) |
qint64 | getSize () |
float | getOffset () |
Protected Attributes | |
QString | path |
Pfad des aktuellen Knotens (relativ zum Elternknoten). | |
int | depth |
Tiefe aktuellen Knotens. | |
qint64 | fileSize |
Größe des aktuellen Knotens. | |
float | totalSize |
Größe des aktuellen Unterbaumes. | |
float | offset |
bool | bDir |
QTreeWidgetItem * | treeItem |
Static Protected Attributes | |
static float | scaleFactor = 1.0 |
static QTreeWidget * | treeWidget = NULL |
Die Klasse node repräsentiert ein Verzeichnis bzw. eine Datei im Verzeichnisbaum.
Ein node-Objekt speichert jeweils Pfad (path), Typ (bDir) Größe (fileSize), sowie einen Zeiger auf den Elternknoten (parent()). Verzeichnisse speichern zudem eine Liste der untergeordneten Dateien und Verzeichnisse (children), sowie deren Gesamtgröße (totalSize).
Definition at line 13 of file node.h.
node::node | ( | QString | path, | |
QObject * | parent = 0 | |||
) |
void node::addToTotalSize | ( | qint64 | size | ) |
void node::traverse | ( | ) |
Definition at line 28 of file node.cpp.
References path.
Referenced by MainWindow::chooseFolder(), and traverse().
bool node::isDir | ( | ) | [inline] |
Definition at line 22 of file node.h.
References bDir.
Referenced by BeamTreeScene::draw(), MainWindow::fillTree(), and BeamTreeScene::render().
QRectF node::calculateRect | ( | ) |
Definition at line 79 of file node.cpp.
References getOffset(), getRelativeSize(), isVertical(), and parent().
Referenced by BeamTreeScene::render().
void node::addParentOffset | ( | float | offset | ) |
Definition at line 112 of file node.cpp.
References offset, and parent().
Referenced by addParentOffset(), and BeamTreeScene::render().
void node::addParentOffset | ( | QRectF | rect | ) |
node * node::parent | ( | ) |
Definition at line 126 of file node.cpp.
Referenced by addParentOffset(), calculateRect(), getRelativeSize(), and mousePressEvent().
bool node::isVertical | ( | ) |
Definition at line 75 of file node.cpp.
References depth.
Referenced by addParentOffset(), calculateRect(), BeamTreeScene::draw(), mousePressEvent(), and BeamTreeScene::render().
qint64 node::getTotalSize | ( | ) | [inline] |
QString node::getPath | ( | ) | [inline] |
Definition at line 35 of file node.h.
Referenced by MainWindow::fillTree(), and BeamTreeScene::hilight().
QVector<node*> node::getChildren | ( | ) | [inline] |
Definition at line 36 of file node.h.
References children.
Referenced by MainWindow::fillTree(), and BeamTreeScene::render().
int node::getDepth | ( | ) | [inline] |
float node::getScaleFactor | ( | ) | [inline] |
void node::setTreeItem | ( | QTreeWidgetItem * | item | ) | [inline] |
static void node::setTreeWidget | ( | QTreeWidget * | tw | ) | [inline, static] |
Definition at line 41 of file node.h.
References treeWidget.
Referenced by MainWindow::createDock().
qint64 node::traverse | ( | QDirIterator & | it | ) | [protected] |
Definition at line 34 of file node.cpp.
References addChild(), addToTotalSize(), bDir, depth, getSize(), node(), setSize(), totalSize, and traverse().
void node::addChild | ( | node * | childNode | ) | [protected] |
float node::getRelativeSize | ( | ) | [protected] |
Definition at line 66 of file node.cpp.
References parent(), and totalSize.
Referenced by calculateRect().
void node::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected] |
Definition at line 130 of file node.cpp.
References isVertical(), parent(), path, treeItem, and treeWidget.
void node::setSize | ( | qint64 | size | ) | [inline, protected] |
qint64 node::getSize | ( | ) | [inline, protected] |
float node::getOffset | ( | ) | [inline, protected] |
QVector<node*> node::children |
Liste von untergeordneten Knoten.
Definition at line 30 of file node.h.
Referenced by addChild(), and getChildren().
float node::scaleFactor = 1.0 [static, protected] |
QTreeWidget * node::treeWidget = NULL [static, protected] |
QString node::path [protected] |
Pfad des aktuellen Knotens (relativ zum Elternknoten).
Definition at line 48 of file node.h.
Referenced by mousePressEvent(), and traverse().
int node::depth [protected] |
Tiefe aktuellen Knotens.
Definition at line 50 of file node.h.
Referenced by getDepth(), isVertical(), and traverse().
qint64 node::fileSize [protected] |
float node::totalSize [protected] |
Größe des aktuellen Unterbaumes.
Definition at line 60 of file node.h.
Referenced by addToTotalSize(), getRelativeSize(), getTotalSize(), and traverse().
float node::offset [protected] |
bool node::bDir [protected] |
QTreeWidgetItem* node::treeItem [protected] |