42 lines
954 B
C++
42 lines
954 B
C++
|
#include "common.h"
|
||
|
#include "quam/project.h"
|
||
|
|
||
|
#include <QAbstractItemModel>
|
||
|
#include <QErrorMessage>
|
||
|
#include <QMdiArea>
|
||
|
#include <QSortFilterProxyModel>
|
||
|
|
||
|
Project::Project(QErrorMessage *errors, QMdiArea *parent) :
|
||
|
QMdiSubWindow{parent},
|
||
|
Ui::Project{},
|
||
|
m_errors{errors}
|
||
|
{
|
||
|
auto widget = new QWidget(this);
|
||
|
setupUi(widget);
|
||
|
setWidget(widget);
|
||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||
|
showMaximized();
|
||
|
}
|
||
|
|
||
|
Project::Project(PakDir &&dir, QErrorMessage *errors, QMdiArea *parent) :
|
||
|
Project{errors, parent}
|
||
|
{
|
||
|
auto root = new PakDirRoot{std::move(dir), this};
|
||
|
auto model = new PakDirModel{root, this};
|
||
|
setupModel(model);
|
||
|
}
|
||
|
|
||
|
Project::~Project() {
|
||
|
}
|
||
|
|
||
|
void Project::setupModel(QAbstractItemModel *model) {
|
||
|
m_model = model;
|
||
|
m_sorter = new QSortFilterProxyModel{this};
|
||
|
m_sorter->setSourceModel(m_model);
|
||
|
tableView->setModel(m_sorter);
|
||
|
tableView->sortByColumn(int(Pak::Column::Name), Qt::AscendingOrder);
|
||
|
tableView->resizeColumnsToContents();
|
||
|
}
|
||
|
|
||
|
// EOF
|