Код: Выделить всё
#include
#include "MainWindow.h"
namespace ui {
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
child(this) {
this->resize(425, 450);
this->child.move(10, 10);
this->child.resize(400, 400);
}
MainWindow::~MainWindow() {}
void MainWindow::showEvent(QShowEvent* event) {
QWidget::showEvent(event);
qDebug() child.update();
this->child.update();
this->child.update();
this->child.update();
this->child.repaint();
this->child.repaint();
this->child.repaint();
this->child.repaint();
QApplication::processEvents();
}
} // namespace ui
Код: Выделить всё
#include
#include "Widget.h"
namespace ui {
Widget::Widget(QWidget *parent) :
QWidget(parent) { }
void Widget::paintEvent(QPaintEvent *event) {
qDebug() child.update() и this->child.repaint() вызывает MainWindow.cpp.
Если update() и repaint() фактически не обновляют и не перерисовывают виджет , что мне следует сделать вместо этого, чтобы принудительно перерисовать виджет?
Подробнее здесь: [url]https://stackoverflow.com/questions/78718623/how-do-i-force-a-qwidget-to-be-repainted[/url]