November 2018
Intermediate to advanced
1150 pages
24h 11m
English
Once a character's name is in the list, we will want our user to insert it into the list as a dialogue opener by just double-clicking on the character's name.
To retrieve a single item at a specified index from Characters, we can use the already implemented data method. In order to do so, we will first need a pointer to the scriptEditor widget:
// ccscripter/main.cpp...auto scriptEditor = w.ui->scriptEditor;...
Implementing the use case is then as simple as the following:
// ccscripter/main.cpp...if (charactersListView && scriptEditor) { QObject::connect(charactersListView, &QListView::doubleClicked, [characters, scriptEditor](QModelIndex index) { scriptEditor->append(QString("> %1: ").arg(characters->data(index).toString())); ...Read now
Unlock full access