Files
86Box/src/qt/qt_models_common.cpp

32 lines
806 B
C++
Raw Normal View History

2022-02-07 15:00:02 +06:00
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Common storage devices module.
*
*
*
* Authors: Joakim L. Gilje <jgilje@jgilje.net>
*
* Copyright 2021 Joakim L. Gilje
*/
2021-11-25 10:20:56 +01:00
#include "qt_models_common.hpp"
#include <QAbstractItemModel>
int Models::AddEntry(QAbstractItemModel *model, const QString& displayRole, int userRole)
{
int row = model->rowCount();
model->insertRow(row);
auto idx = model->index(row, 0);
model->setData(idx, displayRole, Qt::DisplayRole);
model->setData(idx, userRole, Qt::UserRole);
return row;
}