O'Reilly logo

Learn Qt 5 by Nicholas Sherriff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Editing clients

With an existing client now located and loaded from the database, we need a mechanism to be able to view and edit the data. Let’s prepare by first creating the context commands we will use in the edit view. Repeat the steps we took for the Find Client View and in CommandController, add a new list of commands named editClientViewContextCommands, along with an accessor method and Q_PROPERTY.

Create a new slot to be called when the user saves their changes on the edit view:

void CommandController::onEditClientSaveExecuted()
{
    qDebug() << "You executed the Save command!";
}

Add a new save command to the list that calls the slot when executed:

Command* editClientSaveCommand = new Command( commandController, QChar( 0xf0c7 ), "Save" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required