Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Q QQC2 Desktop Style
  • 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 13
    • Merge requests 13
  • 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
  • QQC2 Desktop Style
  • Merge requests
  • !202

styleitem: Don't destroy and recreate the style on every instance creation

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Arjen Hiemstra requested to merge work/ahiemstra/guistyleitem into master Nov 21, 2022
  • Overview 7
  • Commits 2
  • Pipelines 5
  • Changes 2

Parsing config and creating a new style for every instance is an incredibly expensive operation that shouldn't be done every time an instance is created. Moreover, the current code makes little sense to me as it completely removes the reason for storing things in a static in the first place.

Instead, just initialise the static style once and use that static for consecutive instances. This reduces the time needed to create an instance of Button from over 7ms(!) to around 0.4ms. As an additional bonus, store the style instance in a shared_ptr so we don't need to memory manage it.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: work/ahiemstra/guistyleitem