More reformat.

This commit is contained in:
Petr Mrázek 2014-01-31 22:58:57 +01:00
parent 3fb7a0faf0
commit 179451d591
4 changed files with 16 additions and 17 deletions

View File

@ -6,8 +6,7 @@
#include "GroupView.h" #include "GroupView.h"
Group::Group(const QString &text, GroupView *view) Group::Group(const QString &text, GroupView *view) : view(view), text(text), collapsed(false)
: view(view), text(text), collapsed(false)
{ {
} }
Group::Group(const Group *other) Group::Group(const Group *other)

View File

@ -262,8 +262,7 @@ int GroupView::categoryInternalRowTop(const QModelIndex &index) const
return result; return result;
} }
int GroupView::itemHeightForCategoryRow(const Group *category, int GroupView::itemHeightForCategoryRow(const Group *category, const int internalRow) const
const int internalRow) const
{ {
for (auto &i : category->items()) for (auto &i : category->items())
{ {
@ -473,7 +472,8 @@ void GroupView::paintEvent(QPaintEvent *event)
QStyleOptionViewItemV4 option(viewOptions()); QStyleOptionViewItemV4 option(viewOptions());
option.rect = visualRect(index); option.rect = visualRect(index);
option.widget = this; option.widget = this;
option.features |= QStyleOptionViewItemV2::WrapText; // FIXME: what is the meaning of this anyway? option.features |=
QStyleOptionViewItemV2::WrapText; // FIXME: what is the meaning of this anyway?
if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index)) if (flags & Qt::ItemIsSelectable && selectionModel()->isSelected(index))
{ {
option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected option.state |= selectionModel()->isSelected(index) ? QStyle::State_Selected
@ -524,7 +524,8 @@ void GroupView::resizeEvent(QResizeEvent *event)
// if (m_categoryEditor) // if (m_categoryEditor)
// { // {
// m_categoryEditor->resize(qMax(contentWidth() / 2, m_editedCategory->textRect.width()), // m_categoryEditor->resize(qMax(contentWidth() / 2,
//m_editedCategory->textRect.width()),
// m_categoryEditor->height()); // m_categoryEditor->height());
// } // }
@ -746,8 +747,8 @@ QPixmap GroupView::renderToPixmap(const QModelIndexList &indices, QRect *r) cons
return pixmap; return pixmap;
} }
QList<QPair<QRect, QModelIndex>> QList<QPair<QRect, QModelIndex>> GroupView::draggablePaintPairs(const QModelIndexList &indices,
GroupView::draggablePaintPairs(const QModelIndexList &indices, QRect *r) const QRect *r) const
{ {
Q_ASSERT(r); Q_ASSERT(r);
QRect &rect = *r; QRect &rect = *r;
@ -791,7 +792,7 @@ QPair<Group *, int> GroupView::rowDropPos(const QPoint &pos)
Group *category = 0; Group *category = 0;
{ {
int y = 0; int y = 0;
foreach(Group * cat, m_categories) for (auto cat : m_categories)
{ {
if (pos.y() > y && pos.y() < (y + cat->headerHeight())) if (pos.y() > y && pos.y() < (y + cat->headerHeight()))
{ {

View File

@ -92,8 +92,7 @@ private:
QPair<int, int> categoryInternalPosition(const QModelIndex &index) const; QPair<int, int> categoryInternalPosition(const QModelIndex &index) const;
int categoryInternalRowTop(const QModelIndex &index) const; int categoryInternalRowTop(const QModelIndex &index) const;
int itemHeightForCategoryRow(const Group *category, int itemHeightForCategoryRow(const Group *category, const int internalRow) const;
const int internalRow) const;
QPixmap renderToPixmap(const QModelIndexList &indices, QRect *r) const; QPixmap renderToPixmap(const QModelIndexList &indices, QRect *r) const;
QList<QPair<QRect, QModelIndex>> draggablePaintPairs(const QModelIndexList &indices, QList<QPair<QRect, QModelIndex>> draggablePaintPairs(const QModelIndexList &indices,

2
main.h
View File

@ -30,7 +30,7 @@ public
slots: slots:
void timeout() void timeout()
{ {
foreach(QStandardItem * item, m_items) for (auto item : m_items)
{ {
int value = item->data(CategorizedViewRoles::ProgressValueRole).toInt(); int value = item->data(CategorizedViewRoles::ProgressValueRole).toInt();
value += qrand() % 3; value += qrand() % 3;