color_preview_plugin.cpp 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_preview_plugin.hpp"
  23. #include "QtColorWidgets/color_preview.hpp"
  24. #include <QtPlugin>
  25. ColorPreview_Plugin::ColorPreview_Plugin(QObject *parent)
  26. : QObject(parent), initialized(false)
  27. {
  28. }
  29. void ColorPreview_Plugin::initialize(QDesignerFormEditorInterface *)
  30. {
  31. if (initialized)
  32. return;
  33. initialized = true;
  34. }
  35. bool ColorPreview_Plugin::isInitialized() const
  36. {
  37. return initialized;
  38. }
  39. QWidget *ColorPreview_Plugin::createWidget(QWidget *parent)
  40. {
  41. return new color_widgets::ColorPreview(parent);
  42. }
  43. QString ColorPreview_Plugin::name() const
  44. {
  45. return "color_widgets::ColorPreview";
  46. }
  47. QString ColorPreview_Plugin::group() const
  48. {
  49. return "Color Widgets";
  50. }
  51. QIcon ColorPreview_Plugin::icon() const
  52. {
  53. return QIcon();
  54. }
  55. QString ColorPreview_Plugin::toolTip() const
  56. {
  57. return "Display a color";
  58. }
  59. QString ColorPreview_Plugin::whatsThis() const
  60. {
  61. return toolTip();
  62. }
  63. bool ColorPreview_Plugin::isContainer() const
  64. {
  65. return false;
  66. }
  67. QString ColorPreview_Plugin::domXml() const
  68. {
  69. return "<ui language=\"c++\">\n"
  70. " <widget class=\"color_widgets::ColorPreview\" name=\"colorPreview\">\n"
  71. " </widget>\n"
  72. "</ui>\n";
  73. }
  74. QString ColorPreview_Plugin::includeFile() const
  75. {
  76. return "QtColorWidgets/color_preview.hpp";
  77. }
  78. //Q_EXPORT_PLUGIN2(color_widgets, ColorPreview_Plugin);