mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
55 lines
1.4 KiB
C++
55 lines
1.4 KiB
C++
/* Copyright (C) 2015
|
|
* swift project Community / Contributors
|
|
*
|
|
* This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level
|
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
|
* contained in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef BLACKGUI_DROPBASE_H
|
|
#define BLACKGUI_DROPBASE_H
|
|
|
|
#include "blackgui/blackguiexport.h"
|
|
#include "blackmisc/variant.h"
|
|
#include <QLabel>
|
|
#include <QMimeData>
|
|
|
|
namespace BlackGui
|
|
{
|
|
/*!
|
|
* Utilities for dropping swift value objects
|
|
*/
|
|
class BLACKGUI_EXPORT CDropBase
|
|
{
|
|
public:
|
|
//! Accepted ids
|
|
void setAcceptedMetaTypeIds(const QList<int> &ids);
|
|
|
|
//! Accepted ids
|
|
void addAcceptedMetaTypeId(int id);
|
|
|
|
//! Drop allowed
|
|
virtual bool isDropAllowed() const;
|
|
|
|
//! Drop allowed
|
|
virtual void allowDrop(bool allowed);
|
|
|
|
//! Accept drop?
|
|
bool acceptDrop(const QMimeData *mime) const;
|
|
|
|
//! Mime data to CVariant (normally encapsulating a value object)
|
|
BlackMisc::CVariant toCVariant(const QMimeData *mime) const;
|
|
|
|
protected:
|
|
CDropBase();
|
|
|
|
private:
|
|
bool m_allowDrop = true; //!< dropping allowed?
|
|
QList<int> m_acceptedMetaTypes; //!< accepted meta types
|
|
};
|
|
|
|
} // ns
|
|
|
|
#endif // guard
|