Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Cut User Picture to Circle #133

Open
snoweuph opened this issue May 24, 2022 · 2 comments
Open

[Enhancement] Cut User Picture to Circle #133

snoweuph opened this issue May 24, 2022 · 2 comments

Comments

@snoweuph
Copy link

It would be Nice if the User Picture would be shown as a circle and not as it's full Squarnes

@Zren
Copy link
Owner

Zren commented May 24, 2022

I'm pretty sure it's already possible to clip it using a circle mask, but it's already a very tiny icon and clipping like 30% of the picture makes it pretty unrecognizable.

@Zren
Copy link
Owner

Zren commented May 24, 2022

No idea why adding this code to FlatButton.qml properly crops the icon as a circle when I add iconSize: config.flatButtonSize to FlatButton.qml. If I remove the iconSize override to make the icon larger, so that it's the normal small icon size, then it stops cropping displays a square.

// FlatButton.qml
				PlasmaCore.IconItem {
					id: icon
					source: control.iconName || control.iconSource || control.icon
					implicitWidth: control._iconSize
					implicitHeight: control._iconSize
					anchors.centerIn: parent
					colorGroup: PlasmaCore.Theme.ButtonColorGroup

					// Crop the avatar to fit in a circle, like the lock and login screens
					// but don't on software rendering where this won't render
					// layer.enabled: faceIcon.GraphicsInfo.api !== GraphicsInfo.Software
					layer.enabled: true
					layer.effect: QtGraphicalEffects.OpacityMask {
						// this Rectangle is a circle due to radius size
						maskSource: Rectangle {
							width: icon.width
							height: icon.height
							radius: height / 2
							visible: false
						}
					}
				}
// SidebarView.qml
			SidebarItem {
				iconName: kuser.hasFaceIcon ? kuser.faceIconUrl : 'user-identity'
				text: kuser.fullName
				submenu: userMenu
				iconSize: config.flatButtonSize

				SidebarContextMenu {
					id: userMenu

Zren added a commit that referenced this issue Jun 5, 2022
For some reason, the circle crop doesn't work when the icon is the
smaller size.
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

No branches or pull requests

2 participants