⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qcursor_qws.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtGui module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include <qcursor.h>#include <private/qcursor_p.h>#include <qbitmap.h>#include <qwsdisplay_qws.h>#ifndef QT_NO_CURSORstatic int nextCursorId = Qt::BitmapCursor;/*****************************************************************************  Internal QCursorData class *****************************************************************************/QCursorData::QCursorData(Qt::CursorShape s)    : cshape(s), bm(0), bmm(0), hx(0), hy(0), id(s){    ref = 1;}QCursorData::~QCursorData(){    delete bm;    delete bmm;    QPaintDevice::qwsDisplay()->destroyCursor(id);}/*****************************************************************************  Global cursors *****************************************************************************/extern QCursorData *qt_cursorTable[Qt::LastCursor + 1]; // qcursor.cppint QCursor::handle() const{    return d->id;}QCursorData *QCursorData::setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY){    if (!QCursorData::initialized)        QCursorData::initialize();    if (bitmap.depth() != 1 || mask.depth() != 1 || bitmap.size() != mask.size()) {        qWarning("QCursor: Cannot create bitmap cursor; invalid bitmap(s)");        QCursorData *c = qt_cursorTable[0];        c->ref.ref();        return c;    }    QCursorData *d = new QCursorData;    d->bm  = new QBitmap(bitmap);    d->bmm = new QBitmap(mask);    d->cshape = Qt::BitmapCursor;    d->id = ++nextCursorId;    d->hx = hotX >= 0 ? hotX : bitmap.width() / 2;    d->hy = hotY >= 0 ? hotY : bitmap.height() / 2;    QPaintDevice::qwsDisplay()->defineCursor(d->id, *d->bm, *d->bmm, d->hx, d->hy);    return d;}void QCursorData::update(){}#endif //QT_NO_CURSORextern int *qt_last_x,*qt_last_y;QPoint QCursor::pos(){    // This doesn't know about hotspots yet so we disable it    //qt_accel_update_cursor();    if (qt_last_x)        return QPoint(*qt_last_x, *qt_last_y);    else        return QPoint();}void QCursor::setPos(int x, int y){    // Need to check, since some X servers generate null mouse move    // events, causing looping in applications which call setPos() on    // every mouse move event.    //    if (pos() == QPoint(x, y))        return;    QPaintDevice::qwsDisplay()->setCursorPosition(x, y);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -