QDialog whit FramelessWindowHint shakes when moving



  • @

    SMessageBox::SMessageBox(QWidget *parent) : QDialog(parent, Qt::FramelessWindowHint), moving(false), offset(0, 0)
    {
    setupUi(this);
    setAttribute(Qt::WA_TranslucentBackground, true);

    setMouseTracking(false);
    

    }

    void SMessageBox::mouseMoveEvent(QMouseEvent *event)
    {
    QDialog::mouseMoveEvent(event);
    if (moving)
    {
    move(event->globalPos() - offset);
    //update(); //I tring this but its not help,
    //and i trying
    //setUpdatesEnebled(false);
    //move(event->globalPos() - offset);
    //setUpdatesEnebled(true);
    }
    }

    void SMessageBox::mousePressEvent(QMouseEvent *event)
    {
    QDialog::mousePressEvent(event);
    if ( event->button() == Qt::LeftButton )
    {
    offset = event->pos();
    moving = true;
    }
    }

    void SMessageBox::mouseReleaseEvent(QMouseEvent *event)
    {
    if(event->button() == Qt::LeftButton) moving = false;
    }
    @


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.