File indexing completed on 2026-10-04 12:51:16
0001 /*************************************************************************** 0002 * Copyright (C) 2022 by Renaud Guezennec * 0003 * http://www.rolisteam.org/contact * 0004 * * 0005 * This software is free software; you can redistribute it and/or modify * 0006 * it under the terms of the GNU General Public License as published by * 0007 * the Free Software Foundation; either version 2 of the License, or * 0008 * (at your option) any later version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, * 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0013 * GNU General Public License for more details. * 0014 * * 0015 * You should have received a copy of the GNU General Public License * 0016 * along with this program; if not, write to the * 0017 * Free Software Foundation, Inc., * 0018 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 0019 ***************************************************************************/ 0020 #include "mindmap/data/minditem.h" 0021 0022 #include <QDebug> 0023 #include <QRectF> 0024 #include <QUuid> 0025 0026 #include "mindmap/data/linkcontroller.h" 0027 0028 namespace mindmap 0029 { 0030 MindItem::MindItem(Type type, QObject* parent) 0031 : QObject{parent}, m_type(type), m_id(QUuid::createUuid().toString(QUuid::WithoutBraces)) 0032 { 0033 } 0034 bool MindItem::isVisible() const 0035 { 0036 return m_visible; 0037 } 0038 void MindItem::setVisible(bool op) 0039 { 0040 if(op == m_visible) 0041 return; 0042 m_visible= op; 0043 emit visibleChanged(m_visible); 0044 } 0045 0046 QString MindItem::text() const 0047 { 0048 return m_text; 0049 } 0050 0051 void MindItem::setText(QString text) 0052 { 0053 // qDebug() << "text" << text << m_text; 0054 if(m_text == text) 0055 return; 0056 0057 m_text= text; 0058 emit textChanged(m_text); 0059 } 0060 0061 QString MindItem::id() const 0062 { 0063 return m_id; 0064 } 0065 void MindItem::setSelected(bool isSelected) 0066 { 0067 if(m_selected == isSelected) 0068 return; 0069 m_selected= isSelected; 0070 emit selectedChanged(); 0071 } 0072 0073 void MindItem::setId(const QString& id) 0074 { 0075 if(id == m_id) 0076 return; 0077 m_id= id; 0078 emit idChanged(); 0079 } 0080 bool MindItem::selected() const 0081 { 0082 return m_selected; 0083 } 0084 0085 MindItem::Type MindItem::type() const 0086 { 0087 return m_type; 0088 } 0089 } // namespace mindmap