This is how it looks like,if I comment out the code:
ui.myText->installEventFilter(this);
ui.myText->installEventFilter(this);
To copy to clipboard, switch view to plain text mode

This is how it looks like,if I install the event filter:

and the implenmentation of evetFilter is just:
bool MyWindow
::eventFilter(QObject* target,
QEvent* event
){return true;
}
bool MyWindow::eventFilter(QObject* target,QEvent* event){return true;}
To copy to clipboard, switch view to plain text mode
It's not just QTextEdit,I also test the other QWidget.All behaves the same:if I install eventfilter,then it's stylesheet is gone.
I apply the style sheet by calling:
QFile stylesheet
("myCSS.css");
stylesheet.
open(QFile::ReadOnly);
qApp->setStyleSheet(stylesheet.readAll());
stylesheet.close();
QFile stylesheet("myCSS.css");
stylesheet.open(QFile::ReadOnly);
qApp->setStyleSheet(stylesheet.readAll());
stylesheet.close();
To copy to clipboard, switch view to plain text mode
And I also set the stylesheet directly in the qt desiner,instead loading external file.
The problem still happens.
So,anyone has come cross this weird thing?Any solution?
Bookmarks