knowledgegraphwidgetitem.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #include "knowledgegraphwidgetitem.h"
  2. KnowledgeGraphWidgetItem::KnowledgeGraphWidgetItem(QObject* parent)
  3. : QObject(parent)
  4. {
  5. static QColor colors[12] = { QColor(229, 77, 66), QColor(243, 123, 29), QColor(251, 189, 8),
  6. QColor(141, 198, 63), QColor(57, 181, 74), QColor(28, 187, 180), QColor(0, 129, 255),
  7. QColor(103, 57, 182), QColor(156, 38, 176), QColor(224, 57, 151), QColor(165, 103, 63), QColor(135, 153, 163) };
  8. int i = qrand() % 12;
  9. m_color = colors[i];
  10. i = qrand() % 12;
  11. m_childColor = colors[i];
  12. m_parentItem = nullptr;
  13. }
  14. int KnowledgeGraphWidgetItem::id() const
  15. {
  16. return m_id;
  17. }
  18. void KnowledgeGraphWidgetItem::setId(int id)
  19. {
  20. m_id = id;
  21. }
  22. QString KnowledgeGraphWidgetItem::name() const
  23. {
  24. return m_name;
  25. }
  26. void KnowledgeGraphWidgetItem::setName(const QString& name)
  27. {
  28. m_name = name;
  29. }
  30. QString KnowledgeGraphWidgetItem::value() const
  31. {
  32. return m_value;
  33. }
  34. void KnowledgeGraphWidgetItem::setValue(const QString& value)
  35. {
  36. m_value = value;
  37. }
  38. KnowledgeGraphWidgetItem* KnowledgeGraphWidgetItem::parentItem() const
  39. {
  40. return m_parentItem;
  41. }
  42. void KnowledgeGraphWidgetItem::setParentItem(KnowledgeGraphWidgetItem* parentItem)
  43. {
  44. m_parentItem = parentItem;
  45. }
  46. int KnowledgeGraphWidgetItem::childsNum() const
  47. {
  48. return m_childsNum;
  49. }
  50. void KnowledgeGraphWidgetItem::setChildsNum(int childsNum)
  51. {
  52. m_childsNum = childsNum;
  53. }
  54. QColor KnowledgeGraphWidgetItem::color() const
  55. {
  56. return m_color;
  57. }
  58. void KnowledgeGraphWidgetItem::setColor(const QColor& color)
  59. {
  60. m_color = color;
  61. }
  62. QColor KnowledgeGraphWidgetItem::childColor() const
  63. {
  64. return m_childColor;
  65. }
  66. void KnowledgeGraphWidgetItem::setChildColor(const QColor& childColor)
  67. {
  68. m_childColor = childColor;
  69. }
  70. int KnowledgeGraphWidgetItem::index() const
  71. {
  72. return m_index;
  73. }
  74. void KnowledgeGraphWidgetItem::setIndex(int index)
  75. {
  76. m_index = index;
  77. }
  78. int KnowledgeGraphWidgetItem::startAngle() const
  79. {
  80. return m_startAngle;
  81. }
  82. void KnowledgeGraphWidgetItem::setStartAngle(int startAngle)
  83. {
  84. m_startAngle = startAngle;
  85. }
  86. bool KnowledgeGraphWidgetItem::hasCheck() const
  87. {
  88. return m_hasCheck;
  89. }
  90. void KnowledgeGraphWidgetItem::setHasCheck(bool hasCheck)
  91. {
  92. m_hasCheck = hasCheck;
  93. }