Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Style error from QT's qml file.

QML Style error from QT's qml file.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Praveen kk
    wrote on last edited by Praveen kk
    #1

    I have a customized TextField and I am customizing this by using TextFieldStyle. Please see the below code snippet.

    In My UIStyles.qml****
    property Component textFieldStyle : TextFieldStyle {
    background: Rectangle {
    color: control.enabled ? control.activeColor
    : control.deactiveColor
    }
    }

    ***TextField.qml ***
    TextField {
    id: textField
    style:Style.textFieldStyle
    }

    When i run my application which uses this custom textFiled. I am getting following errors in my "Application Output" window

    Errors**
    file:///opt/Qt5.5.1/5.5/gcc/qml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml:142: TypeError: Cannot read property of null
    file:///opt/Qt5.5.1/5.5/gcc/qml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml:142: TypeError: Cannot read property of null
    file:///opt/Qt5.5.1/5.5/gcc/qml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml:142: TypeError: Cannot read property of null
    file:///opt/Qt5.5.1/5.5/gcc/qml/QtQuick/Controls/Styles/Base/TextFieldStyle.qml:142: TypeError: Cannot read property of null

    The error is generating from Qt's QML file. Why this happening. ? is am doing anything wrong ? Anybody give me a solution to avoid this. ?

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on last edited by
      #2

      You are referencing "Style.textFieldStyle", where is "Style" defined?

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Praveen kk
        wrote on last edited by
        #3

        @xargs1 : That's fine, I just provided a sample code snippet. Basically i have a qmldir file which has singletone module for UIStyles.qml ["singletone Style 1.0 UIStyles.qml"].

        Actually the styles are working fine, but the error is getting logged simple, that's my issue.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved