Hello,
I'm a complete newbie when it comes to QT and although I can find plenty of examples of coding from scratch, can not seem to find much in the way of help when it comes to using QT Designer 4.5.
How do you implement a tree view (not tree widget) with this version of designer?
I am obviously missing something basic in the way QT Designer works.
for instance I know that a directory view of the local file system can be generated with the following fairly trivial class:
-------------------------------------------
directoryTreeView.h
#ifndef DIRECTOTYTREEVIEW_H
#define DIRECTOTYTREEVIEW_H
#include <QWidget>
#include <QTreeView>
#include <QModelIndex>
#include <QDirModel>
class directoryTreeView
: public QWidget{
public:
directoryTreeView();
};
#endif // DIRECTOTYTREEVIEW_H
#ifndef DIRECTOTYTREEVIEW_H
#define DIRECTOTYTREEVIEW_H
#include <QWidget>
#include <QTreeView>
#include <QModelIndex>
#include <QDirModel>
class directoryTreeView : public QWidget
{
public:
directoryTreeView();
};
#endif // DIRECTOTYTREEVIEW_H
To copy to clipboard, switch view to plain text mode
-------------------------------------------
directoryTreeView.cpp
#include "directorytreeview.h"
directoryTreeView::directoryTreeView()
{
tree->setModel(model);
tree->show();
}
#include "directorytreeview.h"
directoryTreeView::directoryTreeView()
{
QDirModel *model = new QDirModel;
QTreeView *tree = new QTreeView();
tree->setModel(model);
tree->show();
}
To copy to clipboard, switch view to plain text mode
--------------------------------------------
With QT Designer you can create a QU GUI application, drag a model based tree view onto the resulting mainwindow.ui form, but then what?
Any help would be most appreciated, thanks.
Bookmarks