MicroPythonBitmapTool/LegendData.cpp

52 wiersze
1.3 KiB
C++

//
// (c)2021 by Lucky Resistor. https://luckyresistor.me/
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// 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, see <https://www.gnu.org/licenses/>.
//
#include "LegendData.hpp"
#include "LegendEntry.hpp"
LegendDataPtr LegendData::create()
{
return LegendDataPtr(new LegendData());
}
LegendData::~LegendData()
{
qDeleteAll(_entryList);
}
void LegendData::addEntry(const QColor &color, const QString &text)
{
_entryList.append(new LegendEntry(color, text));
}
void LegendData::addEntry(const QColor &color1, const QColor &color2, const QString &text)
{
_entryList.append(new LegendEntry(color1, color2, text));
}
const QList<const LegendEntry*>& LegendData::entryList() const
{
return _entryList;
}