// rdmacrocartmodel.cpp // // Data model for Rivendell services // // (C) Copyright 2021 Fred Gleason // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 as // published by the Free Software Foundation. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public // License along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // #include "rdapplication.h" #include "rdescape_string.h" #include "rdmacrocartmodel.h" RDMacroCartModel::RDMacroCartModel(unsigned cartnum,QObject *parent) : QAbstractTableModel(parent) { d_cart_number=cartnum; // // Column Attributes // unsigned left=Qt::AlignLeft|Qt::AlignVCenter; // unsigned center=Qt::AlignCenter; unsigned right=Qt::AlignRight|Qt::AlignVCenter; d_headers.push_back(tr("Line")); d_alignments.push_back(right); d_headers.push_back(tr("Command")); d_alignments.push_back(left); updateModel(); } RDMacroCartModel::~RDMacroCartModel() { } QPalette RDMacroCartModel::palette() { return d_palette; } void RDMacroCartModel::setPalette(const QPalette &pal) { d_palette=pal; } void RDMacroCartModel::setFont(const QFont &font) { d_font=font; d_bold_font=font; d_bold_font.setWeight(QFont::Bold); } int RDMacroCartModel::columnCount(const QModelIndex &parent) const { return d_headers.size(); } int RDMacroCartModel::rowCount(const QModelIndex &parent) const { return d_texts.size(); } QVariant RDMacroCartModel::headerData(int section,Qt::Orientation orient, int role) const { if((orient==Qt::Horizontal)&&(role==Qt::DisplayRole)) { return d_headers.at(section); } return QVariant(); } QVariant RDMacroCartModel::data(const QModelIndex &index,int role) const { QString str; int col=index.column(); int row=index.row(); if(row list; for(int i=0;i texts; for(int i=0;ifirst()) { QStringList f0=q->value(0).toString().split("!",QString::SkipEmptyParts); for(int i=0;i