Results 1 to 7 of 7

Thread: QlineEdit with constant text and editable text fields

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QlineEdit with constant text and editable text fields

    Thanks for the reply.

    The content text of this LineEdit will be used as file name after replacing placeholder <COUNTER> with values from 0..N.

    This above mentioned is only one use case. The actual functionality of my LineEdit will contain multiple placeholder fields like <DATE>, <TIME>, etc... which can be added to the LineEdit on the current cursor position.

    So its not an option to use multiple LineEdits.
    Make everything Simple yet Powerful

  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QlineEdit with constant text and editable text fields

    May you could explain your requirement, Insted of single usecase.
    Thanks :-)

  3. #3
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    120
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QlineEdit with constant text and editable text fields

    Hello,

    if youre use cases allow for a maximum length of the editable sections of the line edit content, you could try using line edit input mask. See http://doc.qt.io/qt-5.4/qlineedit.html#inputMask-prop

    Best regards
    ars

  4. #4
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QlineEdit with constant text and editable text fields

    Usecase1: mode = Cyclic
    In this case by default there will be only <COUNTER> in LineEdit[automatically added] and this should be always at the end of the LineEdit and which should not be edited. But the user can insert new characters before <COUNTER>[All entries in the pop up list cannot be used by the user[shows warning on selection]

    Usecase2: mode = Limited
    In this use case user can add any place holder[<CONTER>, <DATE>, <TIME>, etc...] from the pop up list and all this can be editable[no restrictions] and user can insert new characters anywhere in the LineEdit.
    LineEdit_Sample2.png
    Make everything Simple yet Powerful

  5. #5
    Join Date
    Nov 2011
    Location
    Bangalore
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: QlineEdit with constant text and editable text fields

    Thnaks for the inputs.
    Now I have found a way to make my <COUNTER> non editable using the mask

    Qt Code:
    1. lineEdit->setInputMask("xxxx\<\C\O\U\N\T\E\R\>");
    To copy to clipboard, switch view to plain text mode 

    Now thw problem is I am able to enter only 4 characters before <COUNTER> but i want to allow the user to enter maximum of 91 charcters.

    What should I modify on the reg expression to achieve this?
    Make everything Simple yet Powerful

Similar Threads

  1. Replies: 1
    Last Post: 11th March 2014, 11:20
  2. Contoured text in editable QGraphicsTextItem
    By stampede in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2011, 23:22
  3. Qt Designer Different positions of text fields with same layout
    By Computer Hater in forum Qt Tools
    Replies: 2
    Last Post: 10th July 2011, 21:41
  4. Replies: 1
    Last Post: 30th November 2007, 10:03
  5. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.