0

A qsplitter has been used in my application, and OpaqueResize is set to 'false',while dragging the splitter handle, the widget becoming smaller is repainted continuously, this is not right. What I thought is that the QWidgets on both sides of the splitter handle should not receive any signals about repaint or resize until mouseRelease.This issue troubles me several days, if anyone knows about how to deal with it, please give me a hand, thank you. Qt5.11.2 on Windows10 64-bits

MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    // left
    ui->widget_2->bgColor = QColor(255,0,0);
    ui->widget_2->tag     = 0;

    // right
    ui->widget_3->bgColor = QColor(0,0,255);
    ui->widget_3->tag     = 1;
}

MainWindow::~MainWindow()
{
    delete ui;
}

MyWidget::MyWidget(QWidget *parent) : QWidget(parent)
{
    bgColor = QColor(255,255,255);
    tag     = 0;
}

void MyWidget::paintEvent(QPaintEvent *event)
{
    QWidget::paintEvent( event );
    QPainter painter(this);
    QBrush brush( bgColor );
    painter.fillRect( event->rect(), brush );

    qDebug() << "paintEvent:tag="<<tag;
}
  • Please edit your question to include a [mcve]. Platform/OS info might also prove useful. – G.M. Nov 26 '18 at 18:40
  • I've edited my issue and show some codes, when I dragging splitter left, the widget_2 repaint continuously, and the widget_3 will repaint while dragging splitter right – CoderHunter Nov 27 '18 at 01:49

0 Answers0