redirect std::cout to QTextEdit

前端 未结 2 1197
日久生厌
日久生厌 2021-01-19 23:49

Is it possible (and more importantly -how-) to redirect an output stream to a QTextBox. So that if I write std::cout << \"test\" anywhere in the applicati

2条回答
  •  甜味超标
    2021-01-20 00:16

    You could reset cout to your own ostream implementation which would emit signals which you hook onto the append slot. You sub-problems/exercises are therefore:

    1. redirect cout
    2. redirect cout to your own ostream implementation or one that you can extend
    3. emit signals to QTextBox

    These sub-topics are available on SO, as far as I know

提交回复
热议问题