[Solved]Change text cursor color in QTextEdit
-
!http://img546.imageshack.us/img546/296/mainwindowr.png(Text Edit with White Color and Text Cursor with White Color )!
-
Here is the code I used to change the colors:
@QPalette p = textEdit->palette();
p.setColor(QPalette::Base, QColor(0, 0, 0));
textEdit->setPalette(p);textEdit->setFrameShape(QFrame::NoFrame);
textEdit->setTextColor(QColor(255,255,255));
@
If I use a style sheet, is it possible to change the colors on the run too? The background color won't change but text color might. -
Thanks Riz and Aleksey, it works now, using this
@
textEdit->setStyleSheet(
"QTextEdit"
"{"
"color: white;"
"background-color: black;"
"}"
);@So the cursor color can be set by setting color: whatever in a stylesheet.. But apparently not with setTextColor() or any other function of textEdit.. weird, but I'm glad it works now.