ubuntu textfield do telefone exibido diferente

0

Estou tentando criar um aplicativo QML para o telefone Ubuntu. Meu formulário parece ok na tela (desktop), mas quando eu coloco o aplicativo no telefone, a tela está desligada. As bordas em torno dos meus campos de teste não estão visíveis. Veja as imagens abaixo.

Como posso corrigir isso?

Obrigado pela sua ajuda.

    
por Joachim Van der Auwera 12.11.2015 / 09:57

1 resposta

1

O fundo de um campo de texto é invisível se este campo de texto for somente leitura. Para mim, eles são invisíveis tanto no telefone quanto na área de trabalho (15.04).

Arquivo de estilo de tema /usr/lib/x86_64-linux-gnu/qt5/qml/Ubuntu/Components/Themes/Ambiance/TextAreaStyle.qml (qtdeclarative5-ubuntu-ui-toolkit-plugin: amd64 1.2.1458 + 15.04.20150422-0ub) mostra que é intencional:

property Component background: UbuntuShape {
    property bool error: (styledItem.hasOwnProperty("errorHighlight") && styledItem.errorHighlight && !styledItem.acceptableInput)
    onErrorChanged: (error) ? visuals.errorColor : visuals.backgroundColor;
    color: visuals.backgroundColor;
    anchors.fill: parent
    visible: !styledItem.readOnly
}

A solução ideal (que não funciona ainda porque não há Ubuntu.Components.Styles nesta versão) é sobrepor o estilo:

import QtQuick 2.4
import Ubuntu.Components 1.2
import Ubuntu.Components.Styles 1.2

TextField {
    readOnly: true

    style: TextFieldStyle {
        background: UbuntuShape {
            color: Theme.palette.normal.field
            anchors.fill: parent
        }
    }
}

Por enquanto, só consigo pensar em um plano de fundo codificado como esse:

TextField {
    readOnly: true

    UbuntuShape {
        z: -1
        color: Theme.palette.normal.field
        anchors.fill: parent
    }
}
    
por Velkan 15.11.2015 / 22:18