OSX下的QFileDialog会向控制台转储许多错误

时间:2012-05-13 17:18:41

标签: qt qfiledialog

尝试在OSX 10.6.8,Qt 4.7:

下使用QFileDialog
QFileDialog *dialog = new QFileDialog(0,tr("Load Band Recordings"),qbh,tr("Wave Files (*.wav)"));
dialog->setFileMode(QFileDialog::ExistingFiles);

if (dialog->exec())
{
QStringList fileNames;
    fileNames = dialog->selectedFiles();
    qs = fileNames[0];
}
else
{
    return(0);
}

它可以工作,但很多错误都被转储到控制台:

Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: Failed to create window context device
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGWindowContextCreate: failed to create context delegate.
2012-05-13 11:03:41.445 SdrDx[18982:903] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0x31197, window:0xffffffff
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextSaveGState: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextTranslateCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextScaleCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextAddRect: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: doClip: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextRestoreGState: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: Failed to create window context device
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGWindowContextCreate: failed to create context delegate.
2012-05-13 11:03:41.533 SdrDx[18982:903] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0x31197, window:0xffffffff
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextSaveGState: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextTranslateCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextScaleCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextAddRect: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: doClip: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextRestoreGState: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: Failed to create window context device
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGWindowContextCreate: failed to create context delegate.
2012-05-13 11:03:41.576 SdrDx[18982:903] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0x31197, window:0xffffffff
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextSaveGState: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextTranslateCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextScaleCTM: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: CGContextAddRect: invalid context 0x0
Sun May 13 11:03:41 machine-mac-pro.local SdrDx[18982] <Error>: doClip: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextRestoreGState: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: Failed to create window context device
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGWindowContextCreate: failed to create context delegate.
2012-05-13 11:03:41.616 SdrDx[18982:903] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0x31197, window:0xffffffff
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextSaveGState: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextTranslateCTM: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextScaleCTM: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextAddRect: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: doClip: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextRestoreGState: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: kCGErrorIllegalArgument: CGSDeviceCreate: Invalid window
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: Failed to create window context device
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGWindowContextCreate: failed to create context delegate.
2012-05-13 11:03:41.638 SdrDx[18982:903] _initWithWindowNumber: error creating graphics ctxt object for ctxt:0x31197, window:0xffffffff
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextSaveGState: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextTranslateCTM: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextScaleCTM: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextAddRect: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: doClip: invalid context 0x0
Sun May 13 11:03:41 -mac-pro.local SdrDx[18982] <Error>: CGContextRestoreGState: invalid context 0x0

文档说提供父窗口小部件;似乎并不重要。

任何人都知道如何正确使用OSX下的Qt 4.7 QFileDialog类,以便它不会呕吐错误到控制台?

顺便说一下,文件和目录对话框的静态版本和构造版本都是这样做的。我在Qt论坛上问过,但没有得到答复。希望有人在这里找到它。

0 个答案:

没有答案