Just for the sake of completeness, the revised mainwindow class below does the same thing but uses multiple inheritance as suggested by fatjuicymole. I hope this helps other newbies experiencing the same problems I was having.
mainwindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include "ui_mainwindow.h"
class MainWindow
: public QMainWindow,
private Ui
::MainWindow{
Q_OBJECT
public:
~MainWindow();
private:
};
#endif // MAINWINDOW_H
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include "ui_mainwindow.h"
class MainWindow : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
};
#endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode
-------------------------------------------
mainwindow.cpp
#include "mainwindow.h"
#include <QDirModel>
#include <QTreeView>
MainWindow
::MainWindow(QWidget *parent
){
// new directoryTreeView;
setupUi(this);
directoryTreeView->setModel(model);
directoryTreeView->show();
}
MainWindow::~MainWindow()
{
}
#include "mainwindow.h"
#include <QDirModel>
#include <QTreeView>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
// new directoryTreeView;
setupUi(this);
QDirModel *model = new QDirModel;
directoryTreeView->setModel(model);
directoryTreeView->show();
}
MainWindow::~MainWindow()
{
}
To copy to clipboard, switch view to plain text mode
Bookmarks