more precise logic for dropping

This commit is contained in:
Martin Rotter 2022-08-31 07:24:31 +02:00
parent 15b16aa4bf
commit 2bc172dd24
4 changed files with 31 additions and 6 deletions

View File

@ -44,6 +44,26 @@ FeedsProxyModel::~FeedsProxyModel() {
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,
int role,
const QVariant& value,

View File

@ -17,6 +17,11 @@ class FeedsProxyModel : public QSortFilterProxyModel {
explicit FeedsProxyModel(FeedsModel* source_model, QObject* parent = nullptr);
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,
Qt::DropAction action,
int row,

View File

@ -215,18 +215,18 @@
#define APP_SKIN_USER_FOLDER "skins"
#define APP_SKIN_DEFAULT "nudus-light"
#define APP_SKIN_METADATA_FILE "metadata.xml"
#if defined(Q_OS_WIN)
#define APP_STYLE_DEFAULT "windowsvista"
#else
#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
#if defined(FORCE_BUNDLE_ICONS)
// Forcibly bundle icons.
#define APP_THEME_DEFAULT "Breeze"
#elif defined(Q_OS_UNIX) && !defined(Q_OS_MACOS)
// DO NOT icons on Linux.
#define APP_THEME_DEFAULT ""
#else
// Bundle icons otherwise.

View File

@ -45,7 +45,7 @@ void SkinFactory::loadCurrentSkin() {
}
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();
}