QT控制台如何清晰的屏幕? [英] How clear screen in QT console?
本文介绍了QT控制台如何清晰的屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要清除QT控制台。什么是comand?
I need clear QT console. What is the comand?
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
cout<<"How delete this?";
//system("CLS")?
return a.exec();
}
推荐答案
p>
You can execute:
QProcess::execute("CLS");
这当然只适用于Windows。在Linux / Unix-ish系统上,你需要做:
This will of course only work on Windows. On Linux/Unix-ish systems, you'll need to do:
QProcess::execute("clear");
如果所有你需要做的是清除屏幕,这些都可以工作。但是,如果你想建立一个更复杂的基于文本的界面(某些行是固定的,或者如果你想绘制一些进度指示器等),你需要更复杂的东西。
If all you need to do is clear the screen, these things will work. However, if you're trying to build a more sophisticated text-based interface (where certain lines are fixed, or if you want to draw some progress indicators or the like), you'll need something more sophisticated.
- 在Linux上有ncurses: http: //www.gnu.org/software/ncurses/
- 在Windows上,有一个curses端口调用PDCurses: http://pdcurses.sourceforge.net/ 。这将让你运行与ncurses几乎相同的代码。如果您只专注于Windows,则可以查看Windows的控制台API: http://msdn.microsoft.com/en-us/library/ms682073%28VS.85%29.aspx
- On Linux there's ncurses: http://www.gnu.org/software/ncurses/
- On Windows, there's a curses port call PDCurses: http://pdcurses.sourceforge.net/. This will let you run nearly the same code as ncurses. If you're only focused on Windows, you can look at Windows' Console API: http://msdn.microsoft.com/en-us/library/ms682073%28VS.85%29.aspx
这篇关于QT控制台如何清晰的屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文