color_wheel_plugin.cpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /**
  2. * \file
  3. *
  4. * \author Mattia Basaglia
  5. *
  6. * \copyright Copyright (C) 2013-2020 Mattia Basaglia
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Lesser General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #include "color_wheel_plugin.hpp"
  23. #include "QtColorWidgets/color_wheel.hpp"
  24. ColorWheel_Plugin::ColorWheel_Plugin(QObject *parent) :
  25. QObject(parent), initialized(false)
  26. {
  27. }
  28. void ColorWheel_Plugin::initialize(QDesignerFormEditorInterface *)
  29. {
  30. initialized = true;
  31. }
  32. bool ColorWheel_Plugin::isInitialized() const
  33. {
  34. return initialized;
  35. }
  36. QWidget *ColorWheel_Plugin::createWidget(QWidget *parent)
  37. {
  38. return new color_widgets::ColorWheel(parent);
  39. }
  40. QString ColorWheel_Plugin::name() const
  41. {
  42. return "color_widgets::ColorWheel";
  43. }
  44. QString ColorWheel_Plugin::group() const
  45. {
  46. return "Color Widgets";
  47. }
  48. QIcon ColorWheel_Plugin::icon() const
  49. {
  50. color_widgets::ColorWheel w;
  51. w.resize(64,64);
  52. w.setWheelWidth(8);
  53. QPixmap pix(64,64);
  54. w.render(&pix);
  55. return QIcon(pix);
  56. }
  57. QString ColorWheel_Plugin::toolTip() const
  58. {
  59. return "A widget that allows an intuitive selection of HSL parameters for a QColor";
  60. }
  61. QString ColorWheel_Plugin::whatsThis() const
  62. {
  63. return toolTip();
  64. }
  65. bool ColorWheel_Plugin::isContainer() const
  66. {
  67. return false;
  68. }
  69. QString ColorWheel_Plugin::domXml() const
  70. {
  71. return "<ui language=\"c++\">\n"
  72. " <widget class=\"color_widgets::ColorWheel\" name=\"colorWheel\">\n"
  73. " <property name=\"sizePolicy\">\n"
  74. " <sizepolicy hsizetype=\"Minimum\" vsizetype=\"Minimum\">\n"
  75. " <horstretch>0</horstretch>\n"
  76. " <verstretch>0</verstretch>\n"
  77. " </sizepolicy>\n"
  78. " </property>\n"
  79. " </widget>\n"
  80. "</ui>\n";
  81. }
  82. QString ColorWheel_Plugin::includeFile() const
  83. {
  84. return "QtColorWidgets/color_wheel.hpp";
  85. }