Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Custom TextFieldStyle for iOS application

Custom TextFieldStyle for iOS application

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 2 Posters 805 Views
  • 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.
  • benlauB Offline
    benlauB Offline
    benlau
    Qt Champions 2016
    wrote on last edited by
    #1

    Hi,

    I would like to modify the style of TextField in an iOS application. Here is the code:

                TextField {
                    style: TextFieldStyle {
                            background: Item {
                            }
                    }
                }
    

    That will clear the border of the text field. However, it will also unset the selection handle . It won't show the popup of "paste | select | selection all". That is not what I need.

    I have checked the source code of Qt. The parameter for selection handle is defined in QtQuick.Controls.Styles.IOS.TextFieldStyle , but they are private. I can not declare a TextFieldStyle to inherit iOS.TextFieldStyle.

    So my question is , what is the preferred way to modify the style of a control component for iOS platform? e.g copy the private header to my program?

    Thanks.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jseeQt
      wrote on last edited by
      #2

      Hi benlau,

      Unfortunatly, I don't think that there is a prefered way modify a style of a specific platform.
      What you could do (but it's really a hack) is something like this:
      Add
      import "qrc:/QtQuick/Controls/Styles/iOS" (or)
      import "file:/QtQuick/Controls/Styles/iOS"
      Remove the
      import QtQuick.Controls.Style 1.0
      This will import the iOS style objects and you can modify it like in your code above.

      1 Reply Last reply
      0
      • benlauB Offline
        benlauB Offline
        benlau
        Qt Champions 2016
        wrote on last edited by
        #3

        hi jseeQt,

        Thank for your reply. Too bad , it don't have any preferred/standard method.. I don't mind for a hack solution. However, my code is not executed in iOS only. It also run on desktop / Linux for preview and automated test.

        The desktop build won't bundle those qml files into qrc. That means the import path of desktop and iOS will be different. I still need a way to detect the location of qml plugin , inherit the TextFieldStyle and modify it.

        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