diff options
author | Anne Jan Brouwer <brouwer@annejan.com> | 2014-07-30 23:43:37 +0200 |
---|---|---|
committer | Anne Jan Brouwer <ajbrouwer@totalactivemedia.nl> | 2014-07-30 23:43:37 +0200 |
commit | 392ec89574ea62c663b59d61a9e9b7bc7e5c238b (patch) | |
tree | 4985b0f3cea54475d81b80f9274ed2c50b3540b1 | |
parent | 017e2fda09e97c862ada8c31457c973f92b528a8 (diff) |
multipass
-rw-r--r-- | main.cpp | 20 | ||||
-rw-r--r-- | mainwindow.cpp | 6 | ||||
-rw-r--r-- | mainwindow.h | 5 | ||||
-rw-r--r-- | mainwindow.ui | 13 |
4 files changed, 26 insertions, 18 deletions
@@ -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> |