[SOLVED] QtQuick Controls, TabView title color and Button text color



  • Hello QT-Project community,

    I am doing some testing with QtQuick controls.
    In my research I have question about:

    1. TabView, how to set solor on title property
    2. Button, how to set color on button text




  • Thank you for help Vincent.
    Thread is useful.



  • Edit your title and add [solved] to it :)



  • Here is sum for this thread:

    Button component can be edited using style property.

    Example:

    @import QtQuick.Controls.Styles 1.0

    Button {
    x: 100
    y: 100
    width: 50
    height: 20
    style: ButtonStyle {
    background: Rectangle {
    implicitWidth: 100
    implicitHeight: 25
    border.width: control.activeFocus ? 2 : 1
    border.color: "#888"
    radius: 10
    gradient: Gradient {
    GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
    GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
    }
    }
    label: Text {
    horizontalAlignment: Text.AlignHCenter
    verticalAlignment: Text.AlignVCenter
    text: "Ok"
    color: "#9e90a3"
    }
    }
    }@



  • Entirely correct. Also note that at least for button, you could also do it like this:

    @
    Button {
    width: 100
    Label {
    anchors.centerIn: parent
    text: "hello"
    color: "red"
    }
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.