Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • K KDeclarative
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Bugzilla
    • Bugzilla
  • Merge requests 6
    • Merge requests 6
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FrameworksFrameworks
  • KDeclarative
  • Merge requests
  • !108

[KeySequenceItem] Fix code style, bump QML imports, make keySequence non-null

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged ivan tkachenko requested to merge work/ratijas/key-seq-item into master Jan 30, 2022
  • Overview 7
  • Commits 2
  • Pipelines 6
  • Changes 3

Part one: Fix code style and bump QML imports

Fixed whitespaces and formatting; renamed _helper id to just helper; replaced some == checks with strict ===, and replaced dynamic/indirect parent.keySequence lookup with root.keySequence access (because parent is a generic Item, which doesn't have keySequence property).

Among other things, according to MDN docs1 + and += are the preferred ways of string concatenation in JavaScript.

Part two: Make keySequence «non-null», «non-undefined» and «non-""»

This property should always be of type QKeySequence and nothing else.

Unfortunately though,

  1. QKeySequence is not exported in QML, and even if it were, being a QGadget makes it virtually impossible to use as a property type because of mind-blowing variety of internal errors from QML engine, such as:

    Invalid property assignment: unsupported type "QKeySequence*" TypeError: Property 'KeySequence' of object [null] is not a function TypeError: Type error Error: Cannot assign QKeySequence to QKeySequence*

  2. Qt factory methods of QKeySequence are not marked to be Q_INVOKABLE from QML side, I had to introduce one in helper class, so that we can always construct a valid object (gadget) with an empty sequence instead of messing with null / undefined / empty string values as before.


I was looking for the origins of the Jumpy Button Problem2, and even though it turned out this particular component has nothing to do with the bug itself, its code still had some ways to improve.

I don't really understand why is this KQuickControlsPrivate.TranslationContext ever needed, so I didn't even bother to rename its id.

Edited Jan 30, 2022 by ivan tkachenko
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: work/ratijas/key-seq-item