本文整理汇总了C++中qErrnoWarning函数的典型用法代码示例。如果您正苦于以下问题:C++ qErrnoWarning函数的具体用法?C++ qErrnoWarning怎么用?C++ qErrnoWarning使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qErrnoWarning函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wl_display_connect
void QWaylandEventThread::waylandDisplayConnect()
{
m_display = wl_display_connect(NULL);
if (m_display == NULL) {
qErrnoWarning(errno, "Failed to create display");
::exit(1);
}
m_displayLock->unlock();
m_fileDescriptor = wl_display_get_fd(m_display);
m_readNotifier = new QSocketNotifier(m_fileDescriptor, QSocketNotifier::Read, this);
connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(readWaylandEvents()));
}
示例2: qErrnoWarning
bool GatoSocket::transmit(const QByteArray &pkt)
{
int written = ::write(fd, pkt.constData(), pkt.size());
if (written < 0) {
qErrnoWarning("Could not write to L2 socket");
close();
return false;
} else if (written < pkt.size()) {
qWarning("Could not write full packet to L2 socket");
return true;
} else {
return true;
}
}
示例3: while
void KeePassXmlStreamReader::parseFile(){
while(xmlReader.readNextStartElement()){
if(xmlReader.name() == "database"){
qDebug("Found database tag. Assuming KeePassX file format. Continuing with KeePassX specific parsing...");
parseDatabase();
}else if(xmlReader.name() == "PwmanXmlList"){
qDebug("Found PwmanXmlList tag. Assuming pwman3 file format. Continuing with pwman3 specific parsing...");
parsePwmanList();
}
else{
qErrnoWarning("No Database found!");
}
}
qDebug("Leaving parseFile...");
}
示例4: createDummyGLContext
// Create a dummy GL context (see QOpenGLTemporaryContext).
static inline HGLRC createDummyGLContext(HDC dc)
{
if (!dc)
return 0;
PIXELFORMATDESCRIPTOR pixelFormDescriptor;
initPixelFormatDescriptor(&pixelFormDescriptor);
pixelFormDescriptor.dwFlags = PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_GENERIC_FORMAT;
pixelFormDescriptor.iPixelType = PFD_TYPE_RGBA;
const int pixelFormat = ChoosePixelFormat(dc, &pixelFormDescriptor);
if (!pixelFormat) {
qErrnoWarning("%s: ChoosePixelFormat failed.", __FUNCTION__);
return 0;
}
if (!SetPixelFormat(dc, pixelFormat, &pixelFormDescriptor)) {
qErrnoWarning("%s: SetPixelFormat failed.", __FUNCTION__);
return 0;
}
HGLRC rc = wglCreateContext(dc);
if (!rc) {
qErrnoWarning("%s: wglCreateContext failed.", __FUNCTION__);
return 0;
}
return rc;
}
示例5: qDebug
void Nodeftp::add_ftp_user(QString email)
{
qDebug() << "Nodeftp::add_user : " << email;
// check auth
QString token, directory;
if (ncs_auth(email, token, directory))
{
// create user's directory
QString userdirectory = m_directory + "/ftp/" + directory;
if (!QDir(userdirectory).exists()) QDir().mkdir(userdirectory);
CFtpServer::CUserEntry *pUser = FtpServer->AddUser( email.toAscii(), token.toAscii(), userdirectory.toAscii() );
if( pUser )
{
printf( "-User successfully created ! :)\r\n" );
pUser->SetMaxNumberOfClient( 5 ); // 0 Unlimited
/* pUser->SetPrivileges( CFtpServer::READFILE | CFtpServer::WRITEFILE |
CFtpServer::LIST | CFtpServer::DELETEFILE | CFtpServer::CREATEDIR |
CFtpServer::DELETEDIR );
*/
pUser->SetPrivileges(CFtpServer::WRITEFILE | CFtpServer::READFILE | CFtpServer::LIST);
#ifdef CFTPSERVER_ENABLE_EXTRACMD // See "CFtpServer/config.h". not defined by default
pUser->SetExtraCommand( CFtpServer::ExtraCmd_EXEC );
// Security Warning ! Only here for example.
// the last command allow the user to call the 'system()' C function!
#endif
}
else qErrnoWarning( "-Unable to create pUser" );
}
else qErrnoWarning( "-Failed to create user" );
}
示例6: exec
/*!
Executes the service.
When the exec() function is called, it will parse the \l
{serviceSpecificArguments} {service specific arguments} passed in
\c argv, perform the required actions, and exit.
If none of the arguments is recognized as service specific, exec()
will first call the createApplication() function, then executeApplication() and
finally the start() function. In the end, exec()
returns while the service continues in its own process waiting for
commands from the service controller.
\sa QtServiceController
*/
int QtService::exec(const std::map<QString, QVariant> &args)
{
d_ptr->args = args;
int ec = d_ptr->run();
if (ec == -1)
qErrnoWarning("The service could not be executed.");
return ec;
#if defined(Q_OS_UNIX)
if (::getenv("QtService_RUN")) {
// Means we're the detached, real service process.
int ec = d_ptr->run(true, d_ptr->args);
if (ec == -1)
qErrnoWarning("The service failed to run.");
return ec;
}
#endif
if (!d_ptr->start()) {
fprintf(stderr, "The service %s could not start\n Run with argument -h for help.\n", serviceName().toLatin1().constData());
return -4;
}
return 0;
}
示例7: eventfd_read
void EventDispatcherEPollPrivate::wake_up_handler()
{
eventfd_t value;
int res;
do {
res = eventfd_read(m_event_fd, &value);
} while (Q_UNLIKELY(-1 == res && EINTR == errno));
if (Q_UNLIKELY(-1 == res)) {
qErrnoWarning("%s: eventfd_read() failed", Q_FUNC_INFO);
}
if (Q_UNLIKELY(!m_wakeups.testAndSetRelease(1, 0))) {
qCritical("%s: internal error, testAndSetRelease(1, 0) failed!", Q_FUNC_INFO);
}
}
示例8: free
QFontEngineWin::~QFontEngineWin()
{
if (designAdvances)
free(designAdvances);
if (widthCache)
free(widthCache);
// make sure we aren't by accident still selected
SelectObject(shared_dc(), (HFONT)GetStockObject(SYSTEM_FONT));
if (!stockFont) {
if (!DeleteObject(hfont))
qErrnoWarning("QFontEngineWin: failed to delete non-stock font...");
}
}
示例9: mouseChanged
/*! \internal
This function is called whenever there is activity on the mouse device.
By default, it reads up to 10 mouse move packets and calls mouseChanged()
for each of them.
*/
void QQnxMouseHandler::socketActivated()
{
// _mouse_packet is a QNX structure. devi-hid is nice enough to translate
// the raw byte data from mouse devices into generic format for us.
_mouse_packet packet;
int iteration = 0;
// read mouse events in batches of 10. Since we're getting quite a lot
// of mouse events, it's better to do them in batches than to return to the
// event loop every time.
do {
int bytesRead = QT_READ(mouseFD, &packet, sizeof(packet));
if (bytesRead == -1) {
// EAGAIN means that there are no more mouse events to read
if (errno != EAGAIN)
qErrnoWarning(errno, "QQnxMouseHandler: Unable to read from socket");
return;
}
// bytes read should always be equal to the size of a packet.
Q_ASSERT(bytesRead == sizeof(packet));
// translate the coordinates from the QNX data structure to Qt coordinates
// note the swapped y axis
QPoint pos = mousePos;
pos += QPoint(packet.dx, -packet.dy);
// QNX only tells us relative mouse movements, not absolute ones, so limit the
// cursor position manually to the screen
limitToScreen(pos);
// translate the QNX mouse button bitmask to Qt buttons
int buttons = Qt::NoButton;
if (packet.hdr.buttons & _POINTER_BUTTON_LEFT)
buttons |= Qt::LeftButton;
if (packet.hdr.buttons & _POINTER_BUTTON_MIDDLE)
buttons |= Qt::MidButton;
if (packet.hdr.buttons & _POINTER_BUTTON_RIGHT)
buttons |= Qt::RightButton;
// call mouseChanged() - this does all the magic to actually move the on-screen
// mouse cursor.
mouseChanged(pos, buttons, 0);
} while (++iteration < 11);
}
示例10: if
QString EnvVarHelper::getOwnLibPath(QString ownPath) {
QString ownLibPath;
#ifdef LINUX_DESKTOP
if (QFile::exists(ownPath + "/../lib")) {
ownLibPath = ownPath + "/../lib";
} else if (QFile::exists(ownPath + "/lib")) {
ownLibPath = ownPath + "/lib";
} else if (QFile::exists("lib")) {
ownLibPath = "lib";
} else {
qErrnoWarning("Couldn't find own lib directory.");
}
#endif
return ownLibPath;
}
示例11: clipboardData
void QClipboard::setMimeData(QMimeData *src, Mode mode)
{
if (mode != Clipboard)
return;
QClipboardData *d = clipboardData();
if (!(d->iData && d->iData->mimeData() == src)) {
d->releaseIData();
d->iData = new QOleDataObject(src);
}
if (OleSetClipboard(d->iData) != S_OK) {
d->releaseIData();
qErrnoWarning("QClipboard::setMimeData: Failed to set data on clipboard");
return;
}
}
示例12: p
QPixmap kMancalaRenderer::renderPixmap(QString name, const QSize size) {
QPixmap p(size);
p.fill(Qt::transparent);
QPainter painter(&p);
if ( !elementExists(name)) {
qErrnoWarning("Element doesn't exist");
return QPixmap();
}
qDebug() << "rendering Pixmap" << name;
render(&painter, name, QRectF(0,0,size.width(), size.height()));
painter.end();
qDebug() << "rendering Pixmap done" << name;
return p;
}
示例13: qCDebug
void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness)
{
#ifndef Q_OS_WINCE
qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness;
if (QWindowsContext::shcoredll.isValid()) {
const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness);
if (FAILED(hr))
qWarning() << "SetProcessDpiAwareness failed:" << QWindowsContext::comErrorString(hr);
} else {
if (dpiAwareness != QtWindows::ProcessDpiUnaware && QWindowsContext::user32dll.setProcessDPIAware) {
if (!QWindowsContext::user32dll.setProcessDPIAware())
qErrnoWarning("SetProcessDPIAware() failed");
}
}
#else // !Q_OS_WINCE
Q_UNUSED(dpiAwareness)
#endif
}
示例14: perror
void QFontEngineQPF::remapFontData()
{
off_t newFileSize = ::lseek(fd, 0, SEEK_END);
if (newFileSize == (off_t)-1) {
#ifdef DEBUG_FONTENGINE
perror("QFontEngineQPF::remapFontData: lseek failed");
#endif
fontData = 0;
return;
}
#ifndef QT_NO_MREMAP
fontData = static_cast<uchar *>(::mremap(const_cast<uchar *>(fontData), dataSize, newFileSize, MREMAP_MAYMOVE));
if (!fontData || fontData == (const uchar *)MAP_FAILED) {
# if defined(DEBUG_FONTENGINE)
perror("QFontEngineQPF::remapFontData(): mremap failed");
# endif
fontData = 0;
}
if (!fontData)
#endif // QT_NO_MREMAP
{
int status = ::munmap((void *)fontData, dataSize);
if (status != 0)
qErrnoWarning(status, "QFontEngineQPF::remapFomrData: munmap failed!");
fontData = (const uchar *)::mmap(0, newFileSize, PROT_READ | (renderingFontEngine ? PROT_WRITE : 0),
MAP_SHARED, fd, 0);
if (!fontData || fontData == (const uchar *)MAP_FAILED) {
# if defined(DEBUG_FONTENGINE)
perror("mmap failed");
# endif
fontData = 0;
return;
}
}
dataSize = newFileSize;
glyphDataSize = newFileSize - glyphDataOffset;
#if defined(DEBUG_FONTENGINE)
qDebug() << "remapped the font file to" << newFileSize << "bytes";
#endif
}
示例15: clipboardData
void QClipboard::clear(Mode mode)
{
if (mode != Clipboard) return;
QClipboardData *d = clipboardData();
d->releaseIData();
if (OleSetClipboard(0) != S_OK) {
qErrnoWarning("QClipboard::clear: Failed to clear data on clipboard");
return;
}
#if defined(Q_OS_WINCE)
// As WinCE does not support notifications we send the signal here
// We will get no event when the clipboard changes outside...
emit dataChanged();
emit changed(Clipboard);
#endif
}