[Interest] How to change button color in QML?
He Minzhang
loongsking at gmail.com
Tue Nov 27 16:49:34 CET 2018
thanks a million.
获取 Outlook for Android<https://aka.ms/ghei36>
________________________________
From: Mitch Curtis <mitch.curtis at qt.io>
Sent: Monday, November 26, 2018 10:17:08 PM
To: Minzhang He; interest at qt-project.org
Subject: RE: [Interest] How to change button color in QML?
First step would be to remove the MouseArea completely. Then, use the "hovered" property that Button inherits from Control:
Material.foreground: btnOK.hovered ? Material.Red : Material.Grey
(Untested)
> -----Original Message-----
> From: Interest <interest-bounces at lists.qt-project.org> On Behalf Of
> Minzhang He
> Sent: Wednesday, 21 November 2018 2:46 AM
> To: interest at qt-project.org
> Subject: [Interest] How to change button color in QML?
>
> I just started using and like QtQuick.Controls 2.
>
> I want change button Material color in QML.
> this is my QML code:
> Button {
> id: btnOK
> x: 248
> y: 208
> text: qsTr("确认")
> Material.foreground: Material.primary
> Material.background: Material.Dark
> MouseArea{
> anchors.fill: parent
> hoverEnabled: true
> onEntered: {
> //this is want to change Material code:
> //btnOK.Material.foreground = ???
> //btnOK.Material.background = ???
> }
> }
> }
> Can you help me?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181127/faa2c203/attachment.html>
More information about the Interest
mailing list