ExWidget.js 864 B

123456789101112131415161718192021222324252627282930313233343536
  1. include("scripts/EAction.js");
  2. include("MyWidget.js");
  3. /**
  4. * \ingroup ecma_misc_examples_qtexamples
  5. * \class ExWidget
  6. * This action creates a Qt widget with a GUI loaded from an UI file.
  7. */
  8. function ExWidget(guiAction) {
  9. EAction.call(this, guiAction);
  10. }
  11. ExWidget.prototype = new EAction();
  12. ExWidget.prototype.beginEvent = function() {
  13. EAction.prototype.beginEvent.call(this);
  14. var w = new MyWidget();
  15. w.show();
  16. this.terminate();
  17. };
  18. /**
  19. * Adds a menu for this action to Examples/Math Examples/ExWidget.
  20. */
  21. ExWidget.init = function(basePath) {
  22. var action = new RGuiAction(qsTr("&Widget"), RMainWindowQt.getMainWindow());
  23. action.setRequiresDocument(false);
  24. action.setScriptFile(basePath + "/ExWidget.js");
  25. action.setGroupSortOrder(79600);
  26. action.setSortOrder(250);
  27. action.setWidgetNames(["QtExamplesMenu"]);
  28. };