Ncurses and Qt Interoperability

前端 未结 2 627
后悔当初
后悔当初 2020-11-28 15:45

Having a Qt and ncurses based application, what is the best way to refresh the screen every second, while waiting for user input? (e.g. show the clock and get user input).

2条回答
  •  清酒与你
    2020-11-28 16:11

    I found the answer to signal-slot mechanism not working inside while loop, is QCoreApplication::processEvents(); So, to receive the signals:

    while(1)
    {
        sleep(1);
        getch();
        processInput();
        QCoreApplication::processEvents();
    }
    

提交回复
热议问题