c++ - KDE 在控制台中写入(太多)

标签 c++ qt kde-plasma qtgui qfiledialog

我正在开发 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。在这里您可以看到我机器上的内联屏幕截图。

enter image description here

否则,您始终可以使用 QFile 将您的输出记录到专用文件中,然后在单独的提示符或应用程序中监控它。

如果你往下看,如果你碰巧能够使用那个版本,你甚至可以看看 5.2 中添加的记录器功能。

关于c++ - KDE 在控制台中写入(太多),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21045356/

相关文章:

c++ - CRTP 的替代品

C++Builder:<memory> header 中的警告

c++ - QRunnable - 如何在没有竞赛的情况下实现 WaitForFinished?

qt - QCoreApplication退出不工作

java - 在哪里更改 Eclipse 用户界面中的列表项背景颜色?

c++ - ray tracer.exe : 0xC0000005: Access violation writing location 0x709DF990 中 0x010A85FB 处未处理的异常

c++ - 如何在 QNetworkReply::deleteLater() 中调试双重删除

qt - 无法 cmake kde-connect

java - 如何在 Fedora 16 上通过守护进程登录 X Window

c++ - 如何保持循环直到输入非整数