我正在开发 Qt GUI 应用程序。
我的问题是我将控制台用于另一个线程(它在其中写入了他的通信),主要问题是当我创建 QFileDialog(为了选择脚本文件)时,KDE 正在编写无用的信息(至少对我来说)。
有没有办法从我的 QFileDialog 中删除所有将任何内容写入控制台的可能性?是否有将主输出切换到另一个(无用的)目标的技巧?
我的代码(但我认为它不会真的帮助你):
void MyGUI::setPathWithFileExplorer()
{
QFileDialog dlg;
dlg.resize(320,240);
QString fileName = dlg.getOpenFileName(this, tr("Open script file"), "~/", tr("Script Files (*.js)"));
if(fileName != "")
ui->editScriptPath->setText(fileName);
}
输出:
kded(21003) Mollet::KioSlaveNotifier::onDirectoryEntered: "trash:/" kded(21003) Mollet::KioSlaveNotifier::onDirectoryLeft: "trash:/" kded(21003) Mollet::KioSlaveNotifier::onDirectoryEntered: "file://[PATH TO MY USER FOLDER]" kded(21003) Mollet::KioSlaveNotifier::onDirectoryLeft: "file://[PATH TO MY USER FOLDER]" kded(21003) Mollet::KioSlaveNotifier::onDirectoryEntered: "file://[PATH TO MY USER FOLDER]" kfilemodule(21676) KSambaSharePrivate::testparmParamValue: We got some errors while running testparm "Load smb config files from /etc/samba/smb.conf Loaded services file OK. WARNING: The setting 'security=ads' should NOT be combined with the 'password server' parameter. (by default Samba will discover the correct DC to contact automatically). WARNING: You have some share names that are longer than 12 characters. These may not be accessible to some older clients. (Eg. Windows9x, WindowsMe, and smbclient prior to Samba 3.0.) " QInotifyFileSystemWatcherEngine::addPaths: inotify_add_watch failed: Permission non accordée QFileSystemWatcher: failed to add paths: /var/lib/samba/usershares
最佳答案
我建议使用 kdebugdialog
,然后使用 Deselect All
。在这里您可以看到我机器上的内联屏幕截图。
否则,您始终可以使用 QFile
将您的输出记录到专用文件中,然后在单独的提示符或应用程序中监控它。
如果你往下看,如果你碰巧能够使用那个版本,你甚至可以看看 5.2 中添加的记录器功能。
关于c++ - KDE 在控制台中写入(太多),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21045356/