fixed compilation for Qt5.5 in OSX

This commit is contained in:
Luis Ángel San Martín
2015-07-18 10:54:14 +02:00
commit 3ed6d78f75
935 changed files with 81053 additions and 0 deletions

View File

@ -0,0 +1,72 @@
#include "yacreader_reading_lists_view.h"
#include "reading_list_item.h"
#include "reading_list_model.h"
YACReaderReadingListsView::YACReaderReadingListsView(QWidget *parent)
:YACReaderTreeView(parent)
{
setItemDelegate(new YACReaderReadingListsViewItemDeletegate(this));
setUniformRowHeights(false);
//enabling internal drag&drop
setDragDropMode(QAbstractItemView::DragDrop);
}
void YACReaderReadingListsView::dragEnterEvent(QDragEnterEvent *event)
{
YACReaderTreeView::dragEnterEvent(event);
/*QModelIndex destinationIndex = indexAt(event->pos());
if(model()->canDropMimeData(event->mimeData(), event->proposedAction(), destinationIndex.row(), destinationIndex.column(), destinationIndex.parent()))*/
event->acceptProposedAction();
}
void YACReaderReadingListsView::dragMoveEvent(QDragMoveEvent *event)
{
YACReaderTreeView::dragMoveEvent(event);
QModelIndex destinationIndex = indexAt(event->pos());
if(model()->canDropMimeData(event->mimeData(), event->proposedAction(), destinationIndex.row(), destinationIndex.column(), destinationIndex.parent()))
event->acceptProposedAction();
}
void YACReaderReadingListsView::dropEvent(QDropEvent *event)
{
YACReaderTreeView::dropEvent(event);
}
//----------------------------------------------------------------------
YACReaderReadingListsViewItemDeletegate::YACReaderReadingListsViewItemDeletegate(QObject *parent)
:QStyledItemDelegate(parent)
{
}
void YACReaderReadingListsViewItemDeletegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
ReadingListModel::TypeList typeList = (ReadingListModel::TypeList)index.data(ReadingListModel::TypeListsRole).toInt();
if(typeList == ReadingListModel::Separator)
{
return;
}
QStyledItemDelegate::paint(painter, option, index);
}
QSize YACReaderReadingListsViewItemDeletegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
ReadingListModel::TypeList typeList = (ReadingListModel::TypeList)index.data(ReadingListModel::TypeListsRole).toInt();
if(typeList == ReadingListModel::Separator)
{
QSize newSize = QStyledItemDelegate::sizeHint(option, index);
newSize.setHeight(7);
return newSize;
}
return QStyledItemDelegate::sizeHint(option, index);
}