[Differential] [Commented On] D4751: Button and Context Menu to Mute, Set Default Sink/Source, Active Port

Chris Holland noreply at phabricator.kde.org
Fri Feb 24 15:49:21 UTC 2017


Zren added a comment.


  I'm using the default DPI of 96. `PlasmaExtras.Heading { level: 5 }` is what's controlling the RowLayout height.
  Level 5 is just the `theme.defaultFont.pointSize` https://github.com/KDE/plasma-framework/blob/master/src/declarativeimports/plasmaextracomponents/qml/Heading.qml#L64
  Which is pointSize=10 for me `qml: onPointSizeChanged 10`
  Which is calculated as pixelSize=13 `qml: onPixelSizeChanged 13` at 96 dpi
  In practice, the IconItem ends up 15px tall, since you use `Layout.maximumHeight: parent.height * 0.85`
  `PlasmaCore.IconItem.onMaximumHeightChanged Layout.maximumHeight=15.299999999999999 height=15.649999999999999`
  
  Using 100% height gives an 18px tall icon
  
  F2593761: 2017-02-24___10-31-56.png <https://phabricator.kde.org/F2593761>
  
  Using ToolButton like so had a height of 30px, which causes a lot of whitespace.
  
    PlasmaComponents.ToolButton {
        iconName: "application-menu"
        onClicked: contextMenu.show(x, y + height)
        onHeightChanged: console.log('onHeightChanged', height)
    }
  
  F2593753: 2017-02-24___10-30-35.png <https://phabricator.kde.org/F2593753>
  
  Using `Layout.maximumHeight: parent.height` on the ToolButton will make it 18px tall, but will also make the icon tiny by default (because it keeps the padding). We can bypass this by anchoring a child IconItem.
  
  We should probably look at ToolButtonStyle.qml <https://github.com/KDE/plasma-framework/blob/master/src/declarativeimports/plasmastyle/ToolButtonStyle.qml#L68> to make sure we apply all the right effects to the icon. All I see is that we need to set `action: parent.hovered` and the colorGroup.
  
    PlasmaComponents.ToolButton {
        Layout.maximumHeight: parent.height
        onClicked: contextMenu.show(x, y + height)
    
        PlasmaCore.IconItem {
            anchors.fill: parent
            source: "application-menu"
    
            // From ToolButtonStyle.qml
            active: parent.hovered
            colorGroup: parent.hovered || !parent.flat ? PlasmaCore.Theme.ButtonColorGroup : PlasmaCore.ColorScope.colorGroup
        }
    }
  
  F2593808: 2017-02-24___10-47-29.png <https://phabricator.kde.org/F2593808>

REPOSITORY
  R115 Plasma Audio Volume Applet

REVISION DETAIL
  https://phabricator.kde.org/D4751

EMAIL PREFERENCES
  https://phabricator.kde.org/settings/panel/emailpreferences/

To: subdiff, #plasma, drosca, Zren
Cc: broulik, plasma-devel, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170224/f0294de0/attachment-0001.html>


More information about the Plasma-devel mailing list