Results 1 to 2 of 2

Thread: QLineEdit shadow text disappear on first entry

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2007
    Posts
    11
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QLineEdit shadow text disappear on first entry

    Hi!

    I am trying to achieve a "shadow text" in QLineEdit: ie. a text that is displayed within widget only until a user enters a first character (please see attachment). After that foreground color should change to default/black and "shadow text" should be replaced by contents given by user.

    I've created a private slot "editTextChanged(QString)" in my QDialog-derived class that is connected to QLineEdit's textChanged() signal.

    I've tried to use isModified() but when I get the notification to editTextChanged() the isModified is already true.

    I cannot use setFocus() signal since this is the main widget of the window that gains focus immediately after showing the dialog.

    What would be the best way to achieve such functionality?
    Using QT4.4

    Thank you!
    -Marcin
    Attached Images Attached Images

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QLineEdit text() crash - Qt3
    By user_mail07 in forum Qt Programming
    Replies: 7
    Last Post: 10th June 2008, 09:42
  3. Pointer Question related to QLineEdit
    By ChrisReath in forum Qt Programming
    Replies: 1
    Last Post: 23rd May 2008, 15:13

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
  •  
Qt is a trademark of The Qt Company.