[Qt-interest] Creating Directory browser.
Gan Xiebin
gan.xiebin at gmail.com
Wed May 27 09:34:55 CEST 2009
On Wed, May 27, 2009 at 3:10 PM, shwetha sankethi <
shwetha.sankethi at gmail.com> wrote:
> Hello all,
> I am very much new to QT. I want to build a directory
> browser ( EX:- The left side of the window shows the tree structure and
> right side should show the files in the directory which will be clicked )
> .How to implement this in QT. Can i get some suggestions on this?
>
>
example :
------------------
#include <QApplication>
#include <QDirModel>
#include <QTreeView>
#include <QListview>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QDirModel *treeModel = new QDirModel;
QTreeView *tree = new QTreeView;
tree->setModel(treeModel);
QListView *list = new QListView;
list->setModel(treeModel);
list->setRootIndex(treeModel->index("C://"));
QObject::connect(tree, SIGNAL(clicked(const QModelIndex&)),
list, SLOT(setRootIndex(const QModelIndex&)));
tree->setWindowTitle("QTreeView");
tree->show();
list->setWindowTitle("QListView");
list->show();
return app.exec();
}
----------------------------
Hope that helps,
Bin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090527/52950482/attachment.html
More information about the Qt-interest-old
mailing list