The next step: editing and saving a document

First we add three more action-buttons to our app using the Qt Designer.


wlby --designer -a firstapp

As in the first tutorial we save and quit the designer and run our app by wlby command:

wlby -a firstapp

Open the Inspector by


As explained in the first tutorial we added the EditDocument Peer to load the requested document into the room. However its main purpose is the document editing logic which we will use now.

We add the new actionButtons into the "firstRoom" and again we add a triggered pillow to each actionButton.

  • EditButton: EditDocument.In.Edit
  • SaveButton: EditDocument.In.Save
  • CancelButton: EditDocument.In.Rollback

By switching off and on the overlay mode the overlays are updated and all widgets appear in the same room (color)... just to check.

Basically we´re done. We can use the edit, cancel and save button as we´re used to. But wouldn´t it be cool... if the buttons would be enabled or disabled due to the documents state? Therefor a enable pillow is thrown by the EnableDocument peer which we need to add into the "firstRoom". The state is promoted as payload (feathers) of the enable pillow. Following states can be adopted:

  • New
  • Edit
  • Undef
  • View
  • Dirty

These states are taken into consideration by the widgets enable-logic. The enable logic is located below the triggered pillow settings in the Wallaby Inspector.

The actionButtons should be enabled in the following states:

  • loadButton: View, Undef and Edit
  • editButton: View
  • saveButton: Dirty and New
  • cancelButton: Dirty and New

To emit the state while editing, the throwWhileEditing parameter of the plainTextEdit widget should be set to True.