more precise logic for dropping
This commit is contained in:
parent
15b16aa4bf
commit
2bc172dd24
@ -44,6 +44,26 @@ FeedsProxyModel::~FeedsProxyModel() {
|
|||||||
qDebugNN << LOGSEC_FEEDMODEL << "Destroying FeedsProxyModel instance";
|
qDebugNN << LOGSEC_FEEDMODEL << "Destroying FeedsProxyModel instance";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool FeedsProxyModel::canDropMimeData(const QMimeData* data,
|
||||||
|
Qt::DropAction action,
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex& parent) const {
|
||||||
|
|
||||||
|
auto src_idx = row < 0 ? mapToSource(parent) : mapToSource(index(row, column, parent));
|
||||||
|
auto* src_item = m_sourceModel->itemForIndex(src_idx);
|
||||||
|
|
||||||
|
if (src_item != nullptr) {
|
||||||
|
auto can_drop = src_item->kind() == RootItem::Kind::ServiceRoot || src_item->kind() == RootItem::Kind::Category ||
|
||||||
|
src_item->kind() == RootItem::Kind::Feed;
|
||||||
|
|
||||||
|
return QSortFilterProxyModel::canDropMimeData(data, action, row, column, parent) && can_drop;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndexList FeedsProxyModel::match(const QModelIndex& start,
|
QModelIndexList FeedsProxyModel::match(const QModelIndex& start,
|
||||||
int role,
|
int role,
|
||||||
const QVariant& value,
|
const QVariant& value,
|
||||||
|
@ -17,6 +17,11 @@ class FeedsProxyModel : public QSortFilterProxyModel {
|
|||||||
explicit FeedsProxyModel(FeedsModel* source_model, QObject* parent = nullptr);
|
explicit FeedsProxyModel(FeedsModel* source_model, QObject* parent = nullptr);
|
||||||
virtual ~FeedsProxyModel();
|
virtual ~FeedsProxyModel();
|
||||||
|
|
||||||
|
virtual bool canDropMimeData(const QMimeData* data,
|
||||||
|
Qt::DropAction action,
|
||||||
|
int row,
|
||||||
|
int column,
|
||||||
|
const QModelIndex& parent) const;
|
||||||
virtual bool dropMimeData(const QMimeData* data,
|
virtual bool dropMimeData(const QMimeData* data,
|
||||||
Qt::DropAction action,
|
Qt::DropAction action,
|
||||||
int row,
|
int row,
|
||||||
|
@ -215,18 +215,18 @@
|
|||||||
#define APP_SKIN_USER_FOLDER "skins"
|
#define APP_SKIN_USER_FOLDER "skins"
|
||||||
#define APP_SKIN_DEFAULT "nudus-light"
|
#define APP_SKIN_DEFAULT "nudus-light"
|
||||||
#define APP_SKIN_METADATA_FILE "metadata.xml"
|
#define APP_SKIN_METADATA_FILE "metadata.xml"
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
#define APP_STYLE_DEFAULT "windowsvista"
|
|
||||||
#else
|
|
||||||
#define APP_STYLE_DEFAULT "Fusion"
|
#define APP_STYLE_DEFAULT "Fusion"
|
||||||
|
|
||||||
|
#if defined(Q_OS_UNIX) && !defined(Q_OS_MACOS) && !defined(FORCE_BUNDLE_ICONS)
|
||||||
|
#define APP_THEME_DEFAULT ""
|
||||||
|
#else
|
||||||
|
#define APP_THEME_DEFAULT "Breeze"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(FORCE_BUNDLE_ICONS)
|
#if defined(FORCE_BUNDLE_ICONS)
|
||||||
// Forcibly bundle icons.
|
// Forcibly bundle icons.
|
||||||
#define APP_THEME_DEFAULT "Breeze"
|
#define APP_THEME_DEFAULT "Breeze"
|
||||||
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
|
||||||
// DO NOT icons on Linux.
|
|
||||||
#define APP_THEME_DEFAULT ""
|
#define APP_THEME_DEFAULT ""
|
||||||
#else
|
#else
|
||||||
// Bundle icons otherwise.
|
// Bundle icons otherwise.
|
||||||
|
@ -45,7 +45,7 @@ void SkinFactory::loadCurrentSkin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SkinFactory::isStyleGoodForAlternativeStylePalette(const QString& style_name) const {
|
bool SkinFactory::isStyleGoodForAlternativeStylePalette(const QString& style_name) const {
|
||||||
static QRegularExpression re = QRegularExpression("^(fusion)|(qt[56]ct-style)$");
|
static QRegularExpression re = QRegularExpression("^(fusion|windows|qt[56]ct-style)$");
|
||||||
|
|
||||||
return re.match(style_name.toLower()).hasMatch();
|
return re.match(style_name.toLower()).hasMatch();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user