[Interest] QGraphicsOpacityEffect on QTextField on Windows 7 -- strange behavior
Nick
eveningnick at gmail.com
Tue May 24 01:43:17 CEST 2016
Hello
I am attempting to add a fade-in/fade-out effect to a widget (that contains
other widgets, including buttons and text fields).
The problem is that while buttons fade perfectly, text fields do not -
instead of changing opacity of the text field, only the opacity of its
border changes.If the text has been selected before changing opacity, after
the opacity is reduced, the selection looks strange.
What can be the cause of this problem and how to make the fade effect on
all widgets, not only push buttons?
The problem can be easily reproduced, if you place a QTextField on form,
and add the following code to button handlers:
void MainWindow::on_pushButton_3_clicked()
{
QGraphicsOpacityEffect * effect = new
QGraphicsOpacityEffect(ui->plainTextEdit);
effect->setOpacity(0.1);
ui->plainTextEdit->setGraphicsEffect(effect);
}
After this code is run, you will see something like this:
http://i.imgur.com/bVBy2gP.png
void MainWindow::on_pushButton_4_clicked()
{
QGraphicsOpacityEffect * effect = new
QGraphicsOpacityEffect(ui->plainTextEdit);
effect->setOpacity(1.0);
ui->plainTextEdit->setGraphicsEffect(effect);
}
The text field looks like this, after this method is executed:
http://i.imgur.com/kd6QA8R.png
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160524/ec070959/attachment.html>
More information about the Interest
mailing list