Hi, everybody
Host OS: Linux x2004d 5.13.0-27-generic #29~20.04.1-Ubuntu SMP Fri Jan 14 00:32:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Target Hardware: IMX8 Ixora V1.2A
Target OS: Linux apalis-imx8-06543230 5.4.154-5.5.0+git.c65f1622951c #1 SMP PREEMPT Mon Jan 3 15:58:01 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
KIT(SDK-Toolchain):
/opt/tdx-xwayland-rt/5.5.0/sysroots/x86_64-tdxsdk-linux/usr/bin/qmake
/opt/tdx-xwayland-rt/5.5.0/sysroots/x86_64-tdxsdk-linux/usr/bin/aarch64-tdx-linux/aarch64-tdx-linux-g++
Example: /home/mihail/Qt/Examples/Qt-5.14.2/widgets/painting/gradients/
I changed:
ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
: QWidget(parent), m_shade_type(type), m_alpha_gradient(QLinearGradient(0, 0, 0, 0))
{
...
setAttribute(Qt::WA_OpaquePaintEvent, true); // Should not erase the previous one !
QTimer *timer = new QTimer();
connect(timer, &QTimer::timeout, this, &ShadeWidget::timerWork);
timer->start(100);
}
void ShadeWidget::timerWork()
{
update();
}
void ShadeWidget::paintEvent(QPaintEvent *)
{
QPainter p(this);
static int i = 0;
if(i > width()) i = 0;
p.setPen(Qt::red);
p.drawLine(i, 0, i, height() - 1); // **draw the added line by timer**
i++;
}
Problem: Old drawn lines are erased! Why? How to fix it?
Please help.