Changeset View
Standalone View
plugins/filetemplates/templateclassassistant.cpp
Show First 20 Lines • Show All 498 Lines • ▼ Show 20 Line(s) | 420 | { | |||
---|---|---|---|---|---|
499 | } | 499 | } | ||
500 | else if (d->templateOptionsPage && (currentPage() == d->templateOptionsPage)) | 500 | else if (d->templateOptionsPage && (currentPage() == d->templateOptionsPage)) | ||
501 | { | 501 | { | ||
502 | d->templateOptionsPageWidget->load(d->fileTemplate, d->renderer); | 502 | d->templateOptionsPageWidget->load(d->fileTemplate, d->renderer); | ||
503 | } | 503 | } | ||
504 | else if (currentPage() == d->outputPage) | 504 | else if (currentPage() == d->outputPage) | ||
505 | { | 505 | { | ||
506 | d->outputPageWidget->loadFileTemplate(d->fileTemplate, d->baseUrl, d->renderer); | 506 | d->outputPageWidget->loadFileTemplate(d->fileTemplate, d->baseUrl, d->renderer); | ||
507 | } | 507 | } | ||
arrowd: Can't we just do `currentPage()->setFocusToFirstEditWidget()` after all those `if`s? | |||||
Good point, I forgot to ask some questions I have about this:
kossebau: Good point, I forgot to ask some questions I have about this:
# The repeated explicit calls… | |||||
but, in general, isn't there a way to set the widget focus from designer and couldn't that be used instead of all this manual code? mwolff: 1. The pages are under our control, right? so it's not an optional feature? So adding an… | |||||
Re 1. Updated patch for a version with a custom interface. Might later perhaps make this a global kdevplatform interface and use it in other assistants as well, but for now kept the interface class in the plugin. Re in general. Not that I am aware of. At least not when it comes to focus setting on switching between widgets, and more, if for switching between pages other widgets are used, here the buttons, which also can have keyboard focus. KPageDialog/KAssistantDialog itself does not do any focus handling, leaves that all to implementors, for good and for bad. kossebau: Re 1. Updated patch for a version with a custom interface. Might later perhaps make this a… | |||||
508 | | ||||
509 | if (auto* pageFocus = dynamic_cast<KDevelop::IPageFocus*>(currentPage()->widget())) { | ||||
510 | pageFocus->setFocusToFirstEditWidget(); | ||||
511 | } | ||||
508 | } | 512 | } | ||
509 | 513 | | |||
510 | void TemplateClassAssistant::back() | 514 | void TemplateClassAssistant::back() | ||
511 | { | 515 | { | ||
512 | KAssistantDialog::back(); | 516 | KAssistantDialog::back(); | ||
513 | if (currentPage() == d->templateSelectionPage) | 517 | if (currentPage() == d->templateSelectionPage) | ||
514 | { | 518 | { | ||
515 | REMOVE_PAGE(classIdentifier) | 519 | REMOVE_PAGE(classIdentifier) | ||
▲ Show 20 Lines • Show All 78 Lines • Show Last 20 Lines |
Can't we just do currentPage()->setFocusToFirstEditWidget() after all those ifs?