Bug 460894 - Plasmoid with many text fields in settings only saves specific entries
Summary: Plasmoid with many text fields in settings only saves specific entries
Status: RESOLVED NOT A BUG
Alias: None
Product: kde
Classification: I don't know
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-10-23 11:36 UTC by jfitzw7
Modified: 2022-10-24 20:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jfitzw7 2022-10-23 11:36:29 UTC
SUMMARY
I have a basic Plasmoid that includes many (14!) text entry fields on its settings page. The plasmoid behaves erratically in terms of saving the contents of these fields.
The first, second, and every Odd numbered entry work completely fine. But every even numbered entry after the 2nd 
has the same problem: If I enter any text, none of it will be saved nor applied to the plasmoid after saving. Furthermore, the Apply button will remain grey the entire time too, and will only become clickable if I enter text into one of the working text fields instead.

In my code, every text field is written exactly the same way. I took to Reddit for advice and another user there confirmed that it didn't look like there was anything particularly wrong with the plasmoid itself, and was likely a KDE Sided bug.

The code for my Plasmoid in particular is located here: https://github.com/Jacksaur/SuburbanLauncher
I wish I could test this further, but I'm afraid I have absolutely zero actual code knowledge, and have just been throwing this project together from fragments I've found in other projects. I'm certain there's better ways my settings page could be laid out as well, but it's beyond me on how to accomplish that.

STEPS TO REPRODUCE
1. Install Plasmoid linked above (Or create one with 14 or more Text fields?)
2. Open plasmoid settings and add text to each text field
3. Apply or click OK and view plasmoid on desktop.

OBSERVED RESULT
First, Second, and every Odd numbered field will have saved its entry, and display on the Plasmoid properly. Every even numbered entry after the second will be blank again when the settings panel is opened. Even numbered fields will not allow the Apply button to be clicked when they are the only things being changed either.

EXPECTED RESULT
All entries should save, and the Apply button should update when any field is edited.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 22.04
KDE Plasma Version: 5.24.6
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3
Comment 1 Nate Graham 2022-10-24 20:20:40 UTC
When you have this problem, if you manually move focus to a different text field by clicking on it, or tabbing to it, does the text field whose focus you just moved away from get its text saved properly when you click OK or Apply?

I ask because I suspect your use of alias properties is the issue here because yo're falling back on the text fields' default behavior to only save when losing focus, and what you should do instead is use onTextChanged: handlers to manually set the values of the magic cfg_[whatever] variables.

Regardless, I'm afraid isn't the place to be asking for development assistance; a better place would be the #plasma Matrix room or the plasma-devel@kde.org mailing list.