QCombobox causes updating problem
Unsolved
Mobile and Embedded
-
Hello everyone!
I am using Qt on ARM-64 embedded system,my qt version is v5.11.3,my problem is when I use a QCombobox in a graphicView and click it,everything seems ok. But when I want to close the graphicview,the page can not update itself.By the way, if I use update(),the page will refresh. I just wonder why.
Hope for reply!My code is
mainWindow.h #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QGraphicsView> #include <QGraphicsProxyWidget> #include "ui/custom_optionui.h" #include <QTimer> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); customOptionUi * subWin_1; QGraphicsView *view_1; private slots: void on_pushButton_2_clicked(); void view_close_1(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H``` mainWindow.cpp #include "mainwindow.h" #include "ui_mainwindow.h" #include "ui_optionui.h" #include "ui/custom_optionui.h" #include <QTimer> #include <QDebug> #include <QAbstractItemView> static void ui_rotate_1(MainWindow *mainWin, optionUi *subWin, int angle_z) { QGraphicsScene *scene = new QGraphicsScene; QGraphicsProxyWidget *graph = scene->addWidget(subWin); graph->setRotation(angle_z); mainWin->view_1 = new QGraphicsView(scene); mainWin->view_1->setGeometry(0, 0, 720, 1280); mainWin->view_1->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mainWin->view_1->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); mainWin->view_1->setAttribute(Qt::WA_TranslucentBackground,true); mainWin->view_1->setStyleSheet("background-color:transparent"); } MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); subWin_1 = new customOptionUi(); ui_rotate_1(this, subWin_1, 90); view_1->hide(); connect(timer,SIGNAL(timeout()),this,SLOT(timerout_code())); connect(subWin_1->ui->closeButton,SIGNAL(clicked()),this,SLOT(view_close_1())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_2_clicked() { view_1->show(); } void MainWindow::view_close_1() { view_1->close(); }
-
Hi,
What do you mean by "the page can not update" ?
-
What if you call hide rather than close ?
-
Can you use a more recent version of Qt to see if it's still happening ?