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

📄 qdnd.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************** 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 "qplatformdefs.h"#ifndef QT_NO_DRAGANDDROP#include "qbitmap.h"#include "qdrag.h"#include "qpixmap.h"#include "qevent.h"#include "qfile.h"#include "qtextcodec.h"#include "qapplication.h"#include "qpoint.h"#include "qwidget.h"#include "qbuffer.h"#include "qimage.h"#include "qregexp.h"#include "qdir.h"#include "qdnd_p.h"#include "qimagereader.h"#include "qimagewriter.h"#include "qdebug.h"#include <ctype.h>// These pixmaps approximate the images in the Windows User Interface Guidelines.// XPMstatic const char * const move_xpm[] = {"11 20 3 1",".        c None",#if defined(Q_WS_WIN)"a        c #000000","X        c #FFFFFF", // Windows cursor is traditionally white#else"a        c #FFFFFF","X        c #000000", // X11 cursor is traditionally black#endif"aa.........","aXa........","aXXa.......","aXXXa......","aXXXXa.....","aXXXXXa....","aXXXXXXa...","aXXXXXXXa..","aXXXXXXXXa.","aXXXXXXXXXa","aXXXXXXaaaa","aXXXaXXa...","aXXaaXXa...","aXa..aXXa..","aa...aXXa..","a.....aXXa.","......aXXa.",".......aXXa",".......aXXa","........aa."};#ifdef Q_WS_WIN/* XPM */static const char * const ignore_xpm[] = {"24 30 3 1",".        c None","a        c #000000","X        c #FFFFFF","aa......................","aXa.....................","aXXa....................","aXXXa...................","aXXXXa..................","aXXXXXa.................","aXXXXXXa................","aXXXXXXXa...............","aXXXXXXXXa..............","aXXXXXXXXXa.............","aXXXXXXaaaa.............","aXXXaXXa................","aXXaaXXa................","aXa..aXXa...............","aa...aXXa...............","a.....aXXa..............","......aXXa.....XXXX.....",".......aXXa..XXaaaaXX...",".......aXXa.XaaaaaaaaX..","........aa.XaaaXXXXaaaX.","...........XaaaaX..XaaX.","..........XaaXaaaX..XaaX","..........XaaXXaaaX.XaaX","..........XaaX.XaaaXXaaX","..........XaaX..XaaaXaaX","...........XaaX..XaaaaX.","...........XaaaXXXXaaaX.","............XaaaaaaaaX..",".............XXaaaaXX...","...............XXXX....."};#endif/* XPM */static const char * const copy_xpm[] = {"24 30 3 1",".        c None","a        c #000000","X        c #FFFFFF",#if defined(Q_WS_WIN) // Windows cursor is traditionally white"aa......................","aXa.....................","aXXa....................","aXXXa...................","aXXXXa..................","aXXXXXa.................","aXXXXXXa................","aXXXXXXXa...............","aXXXXXXXXa..............","aXXXXXXXXXa.............","aXXXXXXaaaa.............","aXXXaXXa................","aXXaaXXa................","aXa..aXXa...............","aa...aXXa...............","a.....aXXa..............","......aXXa..............",".......aXXa.............",".......aXXa.............","........aa...aaaaaaaaaaa",#else"XX......................","XaX.....................","XaaX....................","XaaaX...................","XaaaaX..................","XaaaaaX.................","XaaaaaaX................","XaaaaaaaX...............","XaaaaaaaaX..............","XaaaaaaaaaX.............","XaaaaaaXXXX.............","XaaaXaaX................","XaaXXaaX................","XaX..XaaX...............","XX...XaaX...............","X.....XaaX..............","......XaaX..............",".......XaaX.............",".......XaaX.............","........XX...aaaaaaaaaaa",#endif".............aXXXXXXXXXa",".............aXXXXXXXXXa",".............aXXXXaXXXXa",".............aXXXXaXXXXa",".............aXXaaaaaXXa",".............aXXXXaXXXXa",".............aXXXXaXXXXa",".............aXXXXXXXXXa",".............aXXXXXXXXXa",".............aaaaaaaaaaa"};/* XPM */static const char * const link_xpm[] = {"24 30 3 1",".        c None","a        c #000000","X        c #FFFFFF",#if defined(Q_WS_WIN) // Windows cursor is traditionally white"aa......................","aXa.....................","aXXa....................","aXXXa...................","aXXXXa..................","aXXXXXa.................","aXXXXXXa................","aXXXXXXXa...............","aXXXXXXXXa..............","aXXXXXXXXXa.............","aXXXXXXaaaa.............","aXXXaXXa................","aXXaaXXa................","aXa..aXXa...............","aa...aXXa...............","a.....aXXa..............","......aXXa..............",".......aXXa.............",".......aXXa.............","........aa...aaaaaaaaaaa",#else"XX......................","XaX.....................","XaaX....................","XaaaX...................","XaaaaX..................","XaaaaaX.................","XaaaaaaX................","XaaaaaaaX...............","XaaaaaaaaX..............","XaaaaaaaaaX.............","XaaaaaaXXXX.............","XaaaXaaX................","XaaXXaaX................","XaX..XaaX...............","XX...XaaX...............","X.....XaaX..............","......XaaX..............",".......XaaX.............",".......XaaX.............","........XX...aaaaaaaaaaa",#endif".............aXXXXXXXXXa",".............aXXXaaaaXXa",".............aXXXXaaaXXa",".............aXXXaaaaXXa",".............aXXaaaXaXXa",".............aXXaaXXXXXa",".............aXXaXXXXXXa",".............aXXXaXXXXXa",".............aXXXXXXXXXa",".............aaaaaaaaaaa"};#ifndef QT_NO_DRAGANDDROP//#define QDND_DEBUG#ifdef QDND_DEBUGQString dragActionsToString(Qt::DropActions actions){    QString str;    if (actions == Qt::IgnoreAction) {        if (!str.isEmpty())            str += " | ";        str += "IgnoreAction";    }    if (actions & Qt::LinkAction) {        if (!str.isEmpty())            str += " | ";        str += "LinkAction";    }    if (actions & Qt::CopyAction) {        if (!str.isEmpty())            str += " | ";        str += "CopyAction";    }    if (actions & Qt::MoveAction) {        if (!str.isEmpty())            str += " | ";        str += "MoveAction";    }    if ((actions & Qt::TargetMoveAction) == Qt::TargetMoveAction ) {        if (!str.isEmpty())            str += " | ";        str += "TargetMoveAction";    }    return str;}QString KeyboardModifiersToString(Qt::KeyboardModifiers moderfies){    QString str;    if (moderfies & Qt::ControlModifier) {        if (!str.isEmpty())            str += " | ";        str += Qt::ControlModifier;    }    if (moderfies & Qt::AltModifier) {        if (!str.isEmpty())            str += " | ";        str += Qt::AltModifier;    }    if (moderfies & Qt::ShiftModifier) {        if (!str.isEmpty())            str += " | ";        str += Qt::ShiftModifier;    }    return str;}#endif// the universe's only drag managerQDragManager *QDragManager::instance = 0;QDragManager::QDragManager()    : QObject(qApp){    Q_ASSERT(!instance);#ifdef Q_WS_WIN    n_cursor = 4;#else     n_cursor = 3;#endif#ifdef Q_WS_QWS    currentActionForOverrideCursor = Qt::IgnoreAction;#endif    pm_cursor = new QPixmap[n_cursor];    pm_cursor[0] = QPixmap((const char **)move_xpm);    pm_cursor[1] = QPixmap((const char **)copy_xpm);    pm_cursor[2] = QPixmap((const char **)link_xpm);#ifdef Q_WS_WIN    pm_cursor[3] = QPixmap((const char **)ignore_xpm);#endif    object = 0;    beingCancelled = false;    restoreCursor = false;    willDrop = false;    eventLoop = 0;    dropData = new QDropData();

⌨️ 快捷键说明

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