@@ -328,6 +328,12 @@ set_menu_items_hidden (lay::MainWindow *mw, const std::map<std::string, bool> &h
328328 mw->dispatcher ()->config_set (lay::cfg_menu_items_hidden, lay::pack_menu_items_hidden (hv));
329329}
330330
331+ static void
332+ clear_message (lay::MainWindow *mw, int priority)
333+ {
334+ mw->message (std::string (), 0 , priority);
335+ }
336+
331337Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "MainWindow",
332338
333339 // Dispatcher interface and convenience functions
@@ -475,15 +481,36 @@ Class<lay::MainWindow> decl_MainWindow (QT_EXTERNAL_BASE (QMainWindow) "lay", "M
475481 "\n "
476482 "This method has been added in version 0.24."
477483 ) +
478- gsi::method ("message", &lay::MainWindow::message, gsi::arg ("message"), gsi::arg ("time", -1, "infinite"),
484+ gsi::method_ext ("clear_message", &clear_message, gsi::arg ("priority", -1, "all priorities"),
485+ "@brief Clears the message\n "
486+ "When calling this method with a priority, it will clear the message in the given priority slot, thus "
487+ "unhiding the messages with lower priority. This is equivalent to calling \\ message with an empty string.\n "
488+ "\n "
489+ "When calling without a priority, all messages in all priority slots will be cleared.\n "
490+ "\n "
491+ "This method has been added in version 0.30.6."
492+ ) +
493+ gsi::method ("message", &lay::MainWindow::message, gsi::arg ("message"), gsi::arg ("time", -1, "infinite"), gsi::arg ("priority", 0),
479494 "@brief Displays a message in the status bar\n "
480495 "\n "
481496 "@param message The message to display\n "
482497 "@param time The time how long to display the message in ms. A negative value means ' infinitely' .\n "
498+ "@param priority The priority of the message. Higher-priority messages have precendence over lower-priority ones.\n "
483499 "\n "
484500 "This given message is shown in the status bar for the given time.\n "
501+ "If a priority is given, higher-priority messages have precedence over lower-priority ones.\n "
502+ "Placing an empty message clears a message with a given priority and unhides messages with lower "
503+ "priority. Standard messages like selection descriptions have priority 0, which is the lowest priority.\n "
504+ "\n "
505+ "Messages generated during modal actions (e.g. ' Click on first point' ) by convention should have priority 10 "
506+ "and should be tied to the active state of a plugin. This ensures there is only one such message.\n "
507+ "Higher-priority messages must be cleared (set to empty string) explicitly to unhide lower-priority messages "
508+ "when the indicated action is finished.\n "
509+ "\n "
510+ "\\ clear_message is a convenience method that will clear messages.\n "
485511 "\n "
486- "This method has been added in version 0.18. The ' time' parameter was made optional in version 0.28.10."
512+ "This method has been added in version 0.18. The ' time' parameter was made optional in version 0.28.10.\n "
513+ "The ' priority' argument has been added in version 0.30.6."
487514 ) +
488515 gsi::method ("resize", (void (lay::MainWindow::*)(int, int)) &lay::MainWindow::resize, gsi::arg ("width"), gsi::arg ("height"),
489516 "@brief Resizes the window\n "
0 commit comments