mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
It's a list now.
This commit is contained in:
parent
3e764dc3b8
commit
280a806e2f
@ -4,15 +4,14 @@ ArchiveContentsWidget::ArchiveContentsWidget(QWidget* parent, Qt::WindowFlags fl
|
||||
: QDockWidget(parent, flags), model(nullptr)
|
||||
{
|
||||
setWindowTitle("Archive");
|
||||
table = new QTableView();
|
||||
table->setShowGrid(false);
|
||||
table = new QListView();
|
||||
setWidget(table);
|
||||
}
|
||||
|
||||
void ArchiveContentsWidget::setArchive(const LoaderIMG& archive)
|
||||
{
|
||||
auto m = table->model();
|
||||
model = new IMGTableModel(archive);
|
||||
model = new IMGArchiveModel(archive);
|
||||
table->setModel(model);
|
||||
delete m;
|
||||
}
|
||||
|
@ -2,15 +2,15 @@
|
||||
#ifndef _ARCHIVECONTENTSWIDGET_HPP_
|
||||
#define _ARCHIVECONTENTSWIDGET_HPP_
|
||||
#include <QDockWidget>
|
||||
#include <QTableView>
|
||||
#include "IMGTableModel.hpp"
|
||||
#include <QListView>
|
||||
#include "IMGArchiveModel.hpp"
|
||||
|
||||
class ArchiveContentsWidget : public QDockWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
IMGTableModel* model;
|
||||
QTableView* table;
|
||||
IMGArchiveModel* model;
|
||||
QListView* table;
|
||||
|
||||
public:
|
||||
ArchiveContentsWidget(QWidget* parent = 0, Qt::WindowFlags flags = 0);
|
||||
|
@ -7,7 +7,7 @@ add_executable(rwviewer
|
||||
main.cpp
|
||||
ViewerWindow.cpp
|
||||
ViewerWidget.cpp
|
||||
IMGTableModel.cpp
|
||||
IMGArchiveModel.cpp
|
||||
ArchiveContentsWidget.cpp)
|
||||
|
||||
include_directories(../rwengine/include /usr/include/bullet)
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "IMGTableModel.hpp"
|
||||
#include "IMGArchiveModel.hpp"
|
||||
|
||||
QVariant IMGTableModel::data(const QModelIndex& index, int role) const
|
||||
QVariant IMGArchiveModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole) {
|
||||
if(index.row() < archive.getAssetCount()) {
|
||||
@ -16,7 +16,7 @@ QVariant IMGTableModel::data(const QModelIndex& index, int role) const
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
QVariant IMGTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
QVariant IMGArchiveModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(role == Qt::DisplayRole && orientation == Qt::Horizontal) {
|
||||
if(section == 0) {
|
||||
@ -29,12 +29,12 @@ QVariant IMGTableModel::headerData(int section, Qt::Orientation orientation, int
|
||||
return QVariant::Invalid;
|
||||
}
|
||||
|
||||
int IMGTableModel::rowCount(const QModelIndex& parent) const
|
||||
int IMGArchiveModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
return archive.getAssetCount();
|
||||
}
|
||||
|
||||
int IMGTableModel::columnCount(const QModelIndex& parent) const
|
||||
int IMGArchiveModel::columnCount(const QModelIndex& parent) const
|
||||
{
|
||||
return 2;
|
||||
}
|
@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
#ifndef _IMGTABLEMODEL_HPP_
|
||||
#define _IMGTABLEMODEL_HPP_
|
||||
#ifndef _IMGARCHIVEMODEL_HPP_
|
||||
#define _IMGARCHIVEMODEL_HPP_
|
||||
#include <QAbstractItemModel>
|
||||
#include <loaders/LoaderIMG.hpp>
|
||||
|
||||
class IMGTableModel : public QAbstractTableModel
|
||||
class IMGArchiveModel : public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -12,8 +12,8 @@ class IMGTableModel : public QAbstractTableModel
|
||||
|
||||
public:
|
||||
|
||||
IMGTableModel(const LoaderIMG& archive, QObject* parent = 0)
|
||||
: QAbstractTableModel(parent), archive(archive)
|
||||
IMGArchiveModel(const LoaderIMG& archive, QObject* parent = 0)
|
||||
: QAbstractListModel(parent), archive(archive)
|
||||
{}
|
||||
|
||||
virtual int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
Loading…
Reference in New Issue
Block a user