ctkMenuButtonPlugin.cpp 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. All rights reserved.
  5. Distributed under a BSD License. See LICENSE.txt file.
  6. This software is distributed "AS IS" WITHOUT ANY WARRANTY; without even
  7. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the above copyright notice for more information.
  9. =========================================================================*/
  10. // Qt includes
  11. #include <QMenu>
  12. // CTK includes
  13. #include "ctkMenuButtonPlugin.h"
  14. #include "ctkMenuButton.h"
  15. // --------------------------------------------------------------------------
  16. ctkMenuButtonPlugin::ctkMenuButtonPlugin(QObject *_parent)
  17. : QObject(_parent)
  18. {
  19. }
  20. // --------------------------------------------------------------------------
  21. QWidget *ctkMenuButtonPlugin::createWidget(QWidget *_parent)
  22. {
  23. ctkMenuButton* _widget = new ctkMenuButton(_parent);
  24. QMenu* dummyMenu = new QMenu(_widget);
  25. dummyMenu->addAction("foo");
  26. dummyMenu->addAction("bar");
  27. dummyMenu->addAction("barbarbarbarbarbarbarbarbarbar");
  28. _widget->setMenu(dummyMenu);
  29. return _widget;
  30. }
  31. // --------------------------------------------------------------------------
  32. QString ctkMenuButtonPlugin::domXml() const
  33. {
  34. return "<widget class=\"ctkMenuButton\" name=\"CTKMenuButton\">\n"
  35. " <property name=\"text\">"
  36. " <string>MenuButton</string>"
  37. " </property>"
  38. "</widget>\n";
  39. }
  40. // --------------------------------------------------------------------------
  41. QIcon ctkMenuButtonPlugin::icon() const
  42. {
  43. return QIcon(":/Icons/combobox.png");
  44. }
  45. // --------------------------------------------------------------------------
  46. QString ctkMenuButtonPlugin::includeFile() const
  47. {
  48. return "ctkMenuButton.h";
  49. }
  50. // --------------------------------------------------------------------------
  51. bool ctkMenuButtonPlugin::isContainer() const
  52. {
  53. return false;
  54. }
  55. // --------------------------------------------------------------------------
  56. QString ctkMenuButtonPlugin::name() const
  57. {
  58. return "ctkMenuButton";
  59. }