1
這是我.mm文件Qt中的Mac OS X鏈接器錯誤; CoreGraphics在與CGWindowListCreate
#include "windowmanagerutils.h"
#ifdef Q_OS_MAC
#import </System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Headers/CGWindow.h>
QRect WindowManagerUtils::getWindowRect(WId windowId)
{
CFArrayRef windows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
return QRect();
}
QRect WindowManagerUtils::getClientRect(WId windowId)
{
return QRect();
}
QString WindowManagerUtils::getWindowText(WId windowId)
{
return QString();
}
WId WindowManagerUtils::rootWindow()
{
QApplication::desktop()->winId();
}
WId WindowManagerUtils::windowFromPoint(const QPoint &p, WId parent, bool(*filterFunction)(WId))
{
return NULL;
}
void WindowManagerUtils::setTopMostCarbon(const QWidget *const window, bool topMost)
{
if (!window)
{
return;
}
// Find a Cocoa equivalent for this Carbon function
// [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
// OSStatus ret = HIViewSetZOrder(this->winId(), kHIViewZOrderAbove, NULL);
}
#endif
鏈接器告訴我 「_CGWindowListCreate」 是不確定的。我必須鏈接哪些圖書館? Apple的文檔對告訴包含或鏈接的內容並不是很有幫助,就像MSDN一樣。我也不能只是做#import <CGWindow.h>
,我不得不指定它的絕對路徑...任何方式呢?
我修正了這個錯字。感謝您的發現。 – 2010-05-27 11:23:05
感謝您的幫助,我通過在我的.pro文件中放置了'mac:LIBS + = -framework ApplicationServices'和我的.mm文件中的#import',從而能夠鏈接到ApplicationServices。 –
2010-05-27 11:28:36