FridgeGrid is a tool intended to help planning cycle exact code for effects on old school hardware. Think of it as a combination of grid paper and fridge magnets in digital form with save and load functions. https://xayax.net/tools/fridgegrid/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DragWidget.hpp 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. * src/fridgegrid/DragWidget.hpp
  3. * written by Sven Oliver Moll
  4. *
  5. * distributed under the terms of the GNU General Public License (GPL)
  6. * available at http://www.gnu.org/licenses/gpl.html
  7. */
  8. #ifndef DRAGWIDGET_HPP
  9. #define DRAGWIDGET_HPP DRAGWIDGET_HPP
  10. /* base class */
  11. #include <QLabel>
  12. /* system headers */
  13. /* Qt headers */
  14. /* local library headers */
  15. /* local headers */
  16. #include "GridStyle.hpp"
  17. /* forward declaration of Qt classes */
  18. class QDomDocument;
  19. class QDomElement;
  20. class QDragEnterEvent;
  21. class QDropEvent;
  22. class QPaintEvent;
  23. class QTextEdit;
  24. /* forward declaration of local classes */
  25. /*!
  26. \brief \todo
  27. */
  28. class DragWidget : public QWidget
  29. {
  30. Q_OBJECT
  31. public:
  32. /*!
  33. \brief \todo
  34. \param parent
  35. */
  36. explicit DragWidget( QWidget *parent = 0 );
  37. /*!
  38. \brief \todo
  39. */
  40. virtual ~DragWidget();
  41. /*!
  42. \brief \todo
  43. \return QSize
  44. */
  45. QSize gridSize();
  46. QVariant getData();
  47. void setData( const QVariant &data );
  48. GridStyle gridStyle() const;
  49. void setGridStyle( const GridStyle &gridStyle );
  50. /*!
  51. \brief \todo
  52. \param textEdit
  53. */
  54. void setTextEdit( QTextEdit *textEdit );
  55. /*!
  56. \brief \todo
  57. \param pos
  58. \return QPoint
  59. */
  60. QPoint grid2pos( const QPoint &pos );
  61. /*!
  62. \brief \todo
  63. \param grid
  64. \return QPoint
  65. */
  66. QPoint pos2grid( const QPoint &grid );
  67. public slots:
  68. /*!
  69. \brief \todo
  70. */
  71. void save();
  72. /*!
  73. \brief \todo
  74. */
  75. void load( const QString &templateFileName = QString() );
  76. /*!
  77. \brief \todo
  78. */
  79. void exportPng();
  80. /*!
  81. \brief \todo
  82. \param d
  83. \param p
  84. */
  85. void newElement( const QByteArray &d = QByteArray(), const QPoint &p = QPoint() );
  86. protected:
  87. /*!
  88. \brief \todo
  89. \param event
  90. */
  91. void dragEnterEvent( QDragEnterEvent *event );
  92. /*!
  93. \brief \todo
  94. \param event
  95. */
  96. void dragMoveEvent( QDragMoveEvent *event );
  97. /*!
  98. \brief \todo
  99. \param event
  100. */
  101. void dropEvent( QDropEvent *event );
  102. /*!
  103. \brief \todo
  104. \param event
  105. */
  106. void mousePressEvent( QMouseEvent *event);
  107. /*!
  108. \brief \todo
  109. \param event
  110. */
  111. void mouseDoubleClickEvent( QMouseEvent *event );
  112. /*!
  113. \brief \todo
  114. \param event
  115. */
  116. void paintEvent( QPaintEvent *event );
  117. private:
  118. /*!
  119. \brief \todo
  120. \param w
  121. \param x
  122. \param y
  123. */
  124. void place( QWidget *w, int x, int y );
  125. /*!
  126. \brief \todo
  127. \param w
  128. \param p
  129. */
  130. void place( QWidget *w, const QPoint &p );
  131. /*!
  132. \brief \todo
  133. \param newSize
  134. */
  135. void updateLabelPos( const QSize &newSize );
  136. QTextEdit *mpTextEdit; /*!< \brief \todo TODO */
  137. GridStyle mGridStyle; /*!< \brief \todo TODO */
  138. };
  139. #endif