Python Forum
[PyQt] QLineEdit Caret (Text Cursor) Transparency
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] QLineEdit Caret (Text Cursor) Transparency
#1
I noticed that if I set the background color of a QLineEdit, the caret (text cursor) becomes invisible. Setting the foreground color does nothing for the caret. So, this:
setStyleSheet("QLineEdit{background-color: Gray; color: Black}")
just sets the background color and the text color, the caret is invisible/transparent. I haven't tested yet, but I'm pretty sure I can work around this with setTextColor(), so it's not the end of the world, I'd just like to do it via a style sheet. I am on PyQt6 v6.4.0.

Any ideas how to set caret and text color via a style sheet?
Reply


Messages In This Thread
QLineEdit Caret (Text Cursor) Transparency - by malonn - Nov-02-2022, 07:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Take the variable of a cursor class delcencen 2 1,199 Feb-13-2023, 05:19 AM
Last Post: deanhystad
  How to accept only float number in QLineEdit input ism 5 28,476 Jul-06-2021, 05:23 PM
Last Post: deanhystad
  Simple printing the text for a QLineEdit thewolf 16 7,884 Mar-06-2021, 11:37 PM
Last Post: deanhystad
  PyQt5: How to retrieve a QLineEdit by its name ? arbiel 4 7,919 Oct-21-2020, 02:35 PM
Last Post: arbiel
  Two QlineEdit box, which interrelated GMCobraz 1 2,430 Aug-14-2020, 07:15 PM
Last Post: deanhystad
  [PyQt] Dynamically add and remove QLineEdit's GMCobraz 3 7,176 Jun-23-2020, 07:01 PM
Last Post: Yoriz
  prompt for input in qlineedit GMCobraz 3 3,233 Jun-22-2020, 01:51 PM
Last Post: GMCobraz
  [PyQt] display content from left to right in QComboBox or QLineEdit mart79 2 2,324 May-30-2020, 04:38 PM
Last Post: Axel_Erfurt
  How to loop through all QLineEdit widgets on a form JayCee 6 6,712 Apr-03-2020, 12:15 AM
Last Post: JayCee
  [Tkinter] Finding out what's under the cursor sabresong 3 2,735 Mar-28-2020, 02:52 PM
Last Post: sabresong

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020