summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.cpp20
-rw-r--r--mainwindow.cpp6
-rw-r--r--mainwindow.h5
-rw-r--r--mainwindow.ui13
4 files changed, 26 insertions, 18 deletions
diff --git a/main.cpp b/main.cpp
index 7dc33845..980485be 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1,26 +1,12 @@
#include "mainwindow.h"
#include <QApplication>
-#include <QFileSystemModel>
-#include <QTreeView>
-#include <QDirModel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
- QDirModel model;
- QTreeView tree;
+ MainWindow w;
+ w.show();
- tree.setModel(&model);
-
- tree.setRootIndex(model.index(QDir::homePath()+"/.password-store"));
- tree.setColumnHidden( 1, true );
- tree.setColumnHidden( 2, true );
- tree.setColumnHidden( 3, true );
-
- tree.setWindowTitle(QObject::tr("Dir View:")+QDir::homePath());
- tree.resize(640, 480);
- tree.show();
-
- return app.exec();
+ return app.exec();
}
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 49d64fce..2e38cbc6 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -6,6 +6,12 @@ MainWindow::MainWindow(QWidget *parent) :
ui(new Ui::MainWindow)
{
ui->setupUi(this);
+
+ ui->treeView->setModel(&model);
+ ui->treeView->setRootIndex(model.index(QDir::homePath()+"/.password-store"));
+ ui->treeView->setColumnHidden( 1, true );
+ ui->treeView->setColumnHidden( 2, true );
+ ui->treeView->setColumnHidden( 3, true );
}
MainWindow::~MainWindow()
diff --git a/mainwindow.h b/mainwindow.h
index a3948a91..678e33cf 100644
--- a/mainwindow.h
+++ b/mainwindow.h
@@ -2,6 +2,10 @@
#define MAINWINDOW_H
#include <QMainWindow>
+#include <QDirModel>
+#include <QFileSystemModel>
+#include <QTreeView>
+#include <QDirModel>
namespace Ui {
class MainWindow;
@@ -17,6 +21,7 @@ public:
private:
Ui::MainWindow *ui;
+ QDirModel model;
};
#endif // MAINWINDOW_H
diff --git a/mainwindow.ui b/mainwindow.ui
index 6f39c2c2..a2fc0bbf 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -13,7 +13,18 @@
<property name="windowTitle">
<string>MainWindow</string>
</property>
- <widget class="QWidget" name="centralWidget"/>
+ <widget class="QWidget" name="centralWidget">
+ <widget class="QTreeView" name="treeView">
+ <property name="geometry">
+ <rect>
+ <x>80</x>
+ <y>30</y>
+ <width>256</width>
+ <height>192</height>
+ </rect>
+ </property>
+ </widget>
+ </widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>