As it was not related to an ARGB widget and there is no answer, I start a new short thread to know if there is a solution to this problem.
I will take the shaped clock sample to explain. I've attached the modified code to this message.
Here is what I've had in the shapedclock.h :
protected:
private:
int step; // <==
protected:
void timerEvent(QTimerEvent *event); // <==
void mouseMoveEvent(QMouseEvent *event);
private:
QPoint dragPosition;
int step; // <==
QBasicTimer timer; // <==
To copy to clipboard, switch view to plain text mode
Here is what I've had in the shapedclock's constructor
setWindowTitle(tr("Shaped Analog Clock"));
step = 0; // <==
this->timer.start(200, this); // <==
setWindowTitle(tr("Shaped Analog Clock"));
step = 0; // <==
this->timer.start(200, this); // <==
To copy to clipboard, switch view to plain text mode
Here is the added timerEvent() method :
{
if(event->timerId() == timer.timerId())
{
++step;
resize(width() + step, height() + step);
update();
}
else
}
void ShapedClock::timerEvent(QTimerEvent *event)
{
if(event->timerId() == timer.timerId())
{
++step;
resize(width() + step, height() + step);
update();
}
else
QWidget::timerEvent(event);
}
To copy to clipboard, switch view to plain text mode
And finally, here is the added line in resizeEvent for moving the widget on screen :
{
move(x() - 5, y() - 5);
void ShapedClock::resizeEvent(QResizeEvent * /* event */)
{
move(x() - 5, y() - 5);
To copy to clipboard, switch view to plain text mode
And you will see clearly the clock shaking when resizing / moving.
As I told in my previous post, there is a simple way to deal with it. Defining a larger size QWidget and painting at the correct location. But for a very large widget that can grow by more than 3 times its size and can be shifted by more than 2 times its size, it consume much more memory and perhaps it won't be efficient to deal with a large QWidget even if it contains reserved transparency areas for growing / offseting ?
So, do you think there is a way to paint and move in a single step to avoid dealing with a very large QWidget just to solve this shaking motion ?
Thanks for your answer on this very tricky problem.
Bookmarks