Пример #1
0
QCursor XCursorThemeData::loadCursor (const QString &name, int size) const {
  if (size == -1) size = XcursorGetDefaultSize(QX11Info::display());
  // Load the cursor images
  XcursorImages *images = xcLoadImages(name, size);
  if (!images) images = xcLoadImages(findAlternative(name), size);
  // Fall back to a legacy cursor
  //if (!images) return LegacyTheme::loadCursor(name);
  if (!images) return false;
  // Create the cursor
  Cursor handle = XcursorImagesLoadCursor(QX11Info::display(), images);
  QCursor cursor = QCursor(Qt::HANDLE(handle)); // QCursor takes ownership of the handle
  XcursorImagesDestroy(images);
  //setCursorName(cursor, name);
  return cursor;
}
Пример #2
0
qulonglong XCursorTheme::loadCursor(const QString &name, int size) const
{
    if (size <= 0)
        size = autodetectCursorSize();

    // Load the cursor images
    XcursorImages *images = xcLoadImages(name, size);

    if (!images)
        images = xcLoadImages(findAlternative(name), size);

    if (!images)
        return None;

    // Create the cursor
    Cursor handle = XcursorImagesLoadCursor(QX11Info::display(), images);
    XcursorImagesDestroy(images);

    setCursorName(handle, name);
    return handle;
}