Results 1 to 3 of 3

Thread: How to Make some part of qLineEdit editable?

  1. #1
    Join Date
    Nov 2012
    Posts
    2
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows

    Question How to Make some part of qLineEdit editable?

    I am using QT 4.8.2 and i am trying to make some part of qLineEdit as editable.
    For eg:
    I want to make only the last octet of an IP address as editable, and keep all other three octet as readonly or not editable.

    Is there any solution achieve this feature in my application.
    Or is there any QT widget other than qLineEdit to implement the same in my application
    Please help me get one as soon as possible

    Thanks

  2. #2
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    207
    Thanks
    20
    Thanked 28 Times in 27 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to Make some part of qLineEdit editable?

    No, such a feature is not available out of the box. You can have multiple qlineedit's as a cheap solution. Or you need to subclass qlineedit and write the code yourself.
    Similar code is written already for QDateTimeEdit. You can go through its source code to get the ideas.

  3. #3
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: How to Make some part of qLineEdit editable?

    There no such widget is available. You either have to implement a custom QLineEdit, or connect to QLineEdit signal for textChanged(), and then validate it and update the text again. (Be careful about the recussuive textChanged signal being emited)
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

Similar Threads

  1. How to Make some part of qLineEdit editable?
    By jayesh.srs in forum Newbie
    Replies: 1
    Last Post: 8th November 2012, 12:08
  2. Replies: 2
    Last Post: 11th April 2012, 10:09
  3. Replies: 2
    Last Post: 20th July 2010, 15:35
  4. Replies: 1
    Last Post: 6th November 2009, 10:03
  5. How to make some part of text underlined in QLineEdit?
    By blonde in forum Qt Programming
    Replies: 1
    Last Post: 6th November 2009, 09:43

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.