Skip to content

Introduce ImageProvider class#42

Merged
hebasto merged 3 commits into
bitcoin-core:mainfrom
hebasto:211002-image
Oct 4, 2021
Merged

Introduce ImageProvider class#42
hebasto merged 3 commits into
bitcoin-core:mainfrom
hebasto:211002-image

Conversation

@hebasto
Copy link
Copy Markdown
Member

@hebasto hebasto commented Oct 2, 2021

The new ImageProvider class allows images in QML to be loaded using QPixmaps.

The last commit is a demo for our fellow designers.

For testing this PR one can run bitcoin-qt with different values of the -chain=... command-line option.

Copy link
Copy Markdown
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK. This is the correct way of exposing the dynamically generated icon based on the chain.

However, I wonder if we want to instead ship with an SVG for each chain?

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Oct 3, 2021

However, I wonder if we want to instead ship with an SVG for each chain?

Does using SVG make ImageProvider unneeded? How about caching?

@promag
Copy link
Copy Markdown
Contributor

promag commented Oct 3, 2021

Something like Image { source: "qrc:/mainnet.svg" } should work without custom image provider. What cache?

@promag
Copy link
Copy Markdown
Contributor

promag commented Oct 3, 2021

Let's discuss whether we want to use SVG. Qt support is detailed at https://doc.qt.io/qt-5/svgrendering.html.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Oct 3, 2021

Something like Image { source: "qrc:/mainnet.svg" } should work without custom image provider.

It should work for any image, even non-svg.

What cache?

https://doc.qt.io/qt-5.12/qquickimageprovider.html#image-caching

Copy link
Copy Markdown
Contributor

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Bosch-0 has an opinion on the usage of SVG, per Icon Policy Documentation:

"Both an icon source file, in Scalable Vector Graphics (SVG) format,
and an optimized production file, in Portable Network Graphics (PNG) format"

"SVGs are used as source files because they can scale while retaining image quality."

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Oct 4, 2021

@Bosch-0 has an opinion on the usage of SVG, per Icon Policy Documentation:

"Both an icon source file, in Scalable Vector Graphics (SVG) format,
and an optimized production file, in Portable Network Graphics (PNG) format"

"SVGs are used as source files because they can scale while retaining image quality."

Being based on OpenGL and hardware acceleration, the Qt Quick framework could have a native support for SVG images without any performance penalties. Unfortunately, I have no enough expertise in this area for now.

The only drawback is introducing a new Qt SVG module.

@hebasto
Copy link
Copy Markdown
Member Author

hebasto commented Oct 4, 2021

Rebased after the recent sync.

Copy link
Copy Markdown
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review ACK b7171c8, tested but in a different branch.

@hebasto hebasto merged commit efb65bd into bitcoin-core:main Oct 4, 2021
@hebasto hebasto deleted the 211002-image branch October 4, 2021 22:06
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 6, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 6, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 6, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 7, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 8, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
hebasto added a commit to hebasto/gui-qml that referenced this pull request Jun 9, 2025
johnny9 pushed a commit to johnny9/bitcoin-core-app that referenced this pull request Jul 4, 2025
93d0475 qml: Add a demo Image object (Hennadii Stepanov)
8c56aa5 qml: Integrate ImageProvider into qml/bitcoin.cpp (Hennadii Stepanov)
b3e7cda qml: Add imageprovider module (Hennadii Stepanov)

Pull request description:

  The new `ImageProvider` class allows images in QML to be loaded using `QPixmap`s.

  The last commit is a demo for our fellow designers.

  For testing this PR one can run `bitcoin-qt` with different values of the `-chain=...` command-line option.

ACKs for top commit:
  promag:
    Code review ACK 93d0475, tested but in a different branch.

Tree-SHA512: aa8f65f3b4557d54b134e36ce07df097caa87be45d7ff80f164f55cae5833ab0c2ec777ee79f3b9c0b2b821923bc8f36dc5c07e402f44e1b77282df52203cb36
tx-signer450 added a commit to tx-signer450/gui-qml that referenced this pull request Oct 20, 2025
93d04750e5e5551232c9ddb07216a942839c37c2 qml: Add a demo Image object (Hennadii Stepanov)
8c56aa5d1266510ce68e31fa971a59ef15ce1b04 qml: Integrate ImageProvider into qml/bitcoin.cpp (Hennadii Stepanov)
b3e7cda2ffda7df4279b31ac980b29579bfaa51d qml: Add imageprovider module (Hennadii Stepanov)

Pull request description:

  The new `ImageProvider` class allows images in QML to be loaded using `QPixmap`s.

  The last commit is a demo for our fellow designers.

  For testing this PR one can run `bitcoin-qt` with different values of the `-chain=...` command-line option.

ACKs for top commit:
  promag:
    Code review ACK 93d04750e5e5551232c9ddb07216a942839c37c2, tested but in a different branch.

Tree-SHA512: aa8f65f3b4557d54b134e36ce07df097caa87be45d7ff80f164f55cae5833ab0c2ec777ee79f3b9c0b2b821923bc8f36dc5c07e402f44e1b77282df52203cb36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants