Improve HMenu/HMenuItem style
This commit is contained in:
		
							
								
								
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								TODO.md
									
									
									
									
									
								
							| @@ -17,6 +17,8 @@ | ||||
|   - When qml syntax highlighting supports ES6 string interpolation, use them | ||||
|  | ||||
| - Fixes | ||||
|   - Restore previous focus after right click | ||||
|  | ||||
|   - Reloading config files (cache) | ||||
|   - Run import in thread and AsyncClient.olm functions, they block async loop | ||||
|   - Handle import keys errors | ||||
|   | ||||
							
								
								
									
										66
									
								
								src/icons/light-thin/room-leave.svg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								src/icons/light-thin/room-leave.svg
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||||
| <svg | ||||
|    xmlns:dc="http://purl.org/dc/elements/1.1/" | ||||
|    xmlns:cc="http://creativecommons.org/ns#" | ||||
|    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||||
|    xmlns:svg="http://www.w3.org/2000/svg" | ||||
|    xmlns="http://www.w3.org/2000/svg" | ||||
|    xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||||
|    xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||||
|    width="24" | ||||
|    height="24" | ||||
|    fill-rule="evenodd" | ||||
|    clip-rule="evenodd" | ||||
|    version="1.1" | ||||
|    id="svg4" | ||||
|    sodipodi:docname="room-leave.svg" | ||||
|    inkscape:version=""> | ||||
|   <metadata | ||||
|      id="metadata10"> | ||||
|     <rdf:RDF> | ||||
|       <cc:Work | ||||
|          rdf:about=""> | ||||
|         <dc:format>image/svg+xml</dc:format> | ||||
|         <dc:type | ||||
|            rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||||
|       </cc:Work> | ||||
|     </rdf:RDF> | ||||
|   </metadata> | ||||
|   <defs | ||||
|      id="defs8" /> | ||||
|   <sodipodi:namedview | ||||
|      pagecolor="#ffffff" | ||||
|      bordercolor="#666666" | ||||
|      borderopacity="1" | ||||
|      objecttolerance="10" | ||||
|      gridtolerance="10" | ||||
|      guidetolerance="10" | ||||
|      inkscape:pageopacity="0" | ||||
|      inkscape:pageshadow="2" | ||||
|      inkscape:window-width="640" | ||||
|      inkscape:window-height="480" | ||||
|      id="namedview6" | ||||
|      showgrid="false" | ||||
|      showguides="true" | ||||
|      inkscape:guide-bbox="true" | ||||
|      inkscape:zoom="27.812867" | ||||
|      inkscape:cx="6.3905947" | ||||
|      inkscape:cy="12.751117" | ||||
|      inkscape:current-layer="svg4"> | ||||
|     <sodipodi:guide | ||||
|        position="5.0336415,16.862699" | ||||
|        orientation="0,1" | ||||
|        id="guide817" | ||||
|        inkscape:locked="false" /> | ||||
|     <sodipodi:guide | ||||
|        position="10.858284,7.0830527" | ||||
|        orientation="0,1" | ||||
|        id="guide819" | ||||
|        inkscape:locked="false" /> | ||||
|   </sodipodi:namedview> | ||||
|   <path | ||||
|      d="M 16,2 V 7.137301 H 14 V 4 H 2 v 16 h 12 v -3.083053 h 2 V 22 H 0 V 2 Z m 2,9 V 7 l 6,5 -6,5 V 13 H 8 v -2 z" | ||||
|      id="path2" | ||||
|      inkscape:connector-curvature="0" | ||||
|      sodipodi:nodetypes="ccccccccccccccccccccc" /> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.9 KiB | 
| @@ -2,4 +2,28 @@ import QtQuick 2.12 | ||||
| import QtQuick.Controls 2.12 | ||||
|  | ||||
| Menu { | ||||
|     id: menu | ||||
|     padding: theme.controls.menu.borderWidth | ||||
|  | ||||
|     implicitWidth: { | ||||
|         let result       = 0 | ||||
|         let leftPadding  = 0 | ||||
|         let rightPadding = 0 | ||||
|  | ||||
|         for (let i = 0; i < count; ++i) { | ||||
|             let item     = itemAt(i) | ||||
|             result       = Math.max(item.contentItem.implicitWidth, result) | ||||
|             leftPadding  = Math.max(item.leftPadding, leftPadding) | ||||
|             rightPadding = Math.max(item.rightPadding, rightPadding) | ||||
|         } | ||||
|         return Math.min( | ||||
|             result + leftPadding + rightPadding, theme.minimumSupportedWidth | ||||
|         ) | ||||
|     } | ||||
|  | ||||
|     background: HRectangle { | ||||
|         color: "transparent" | ||||
|         border.color: theme.controls.menu.border | ||||
|         border.width: theme.controls.menu.borderWidth | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -4,10 +4,10 @@ import QtQuick.Controls 2.12 | ||||
| MenuItem { | ||||
|     id: menuItem | ||||
|     spacing: theme.spacing | ||||
|     leftPadding: spacing / 1.5 | ||||
|     rightPadding: spacing / 1.5 | ||||
|     topPadding: spacing / 2 | ||||
|     bottomPadding: spacing / 2 | ||||
|     leftPadding: spacing | ||||
|     rightPadding: spacing | ||||
|     topPadding: spacing / 1.5 | ||||
|     bottomPadding: spacing / 1.5 | ||||
|  | ||||
|  | ||||
|     readonly property alias iconItem: contentItem.icon | ||||
| @@ -23,5 +23,6 @@ MenuItem { | ||||
|         id: contentItem | ||||
|         button: menuItem | ||||
|         buttonTheme: theme.controls.menuItem | ||||
|         label.horizontalAlignment: Label.AlignLeft | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -78,7 +78,8 @@ HTileDelegate { | ||||
|  | ||||
|     contextMenu: HMenu { | ||||
|         HMenuItem { | ||||
|             text: invited ? qsTr("&Decline invite") : qsTr("&Leave") | ||||
|             icon.name: invited ? "invite-decline" : "room-leave" | ||||
|             text: invited ? qsTr("Decline invite") : qsTr("Leave") | ||||
|             onTriggered: py.callClientCoro( | ||||
|                 model.user_id, "room_leave", [model.data.room_id] | ||||
|             ) | ||||
|   | ||||
| @@ -96,6 +96,10 @@ controls: | ||||
|         color pressedOverlay: hsluv(0, 0, 50, 0.6) | ||||
|         color checkedOverlay: colors.accentBackground | ||||
|  | ||||
|     menu: | ||||
|         color border: "black" | ||||
|         real borderWidth: 2 | ||||
|  | ||||
|     menuItem: | ||||
|         color background: controls.button.background | ||||
|         color text:       controls.button.text | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	