#include <Wt/WInPlaceEdit>
Public Member Functions | |
WInPlaceEdit (const WString &text, WContainerWidget *parent=0) | |
Create an in-place edit with the given text. | |
const WString & | text () const |
The current saved text value. | |
void | setText (const WString &text) |
Set the current text. | |
WLineEdit * | lineEdit () const |
Access the line edit. | |
WPushButton * | saveButton () const |
Access the save button. | |
WPushButton * | cancelButton () const |
Access the cancel button. | |
Public Attributes | |
Signal< WString > | valueChanged |
Signal emitted when the value has been changed. |
The WInPlaceEdit provides a text that may be edited in place by the user by clicking on it. When clicked, the text turns into a line edit with a save and cancel button.
When the user saves the edit, the valueChanged signal is emitted.
Example:
// .. new WText("Name: ", app->root()); WInPlaceEdit *edit = new WInPlaceEdit("Bob Smith", app->root()); edit->setStyleClass("inplace"); // ... // the corresponding style sheet, e.g. using an inline stylesheet app->styleSheet().addRule("*.inplace span:hover", "background-color: gray"); // ...
This code will produce an edit that looks like:
WInPlaceEdit text mode
WInPlaceEdit edit mode