Strip trailing whitespace in itemviews.
Using git ls-files -z | xargs -0 sed -i 's/ \+$//' in the relevant directories. Change-Id: I861ef9952fb32ed2db9ec8b67864ec7d0d61f0f2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>bb10
parent
731ba8ed08
commit
3de5a8e78b
|
|
@ -95,7 +95,7 @@ public:
|
|||
void itemsAboutToBeMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation);
|
||||
void itemsMoved(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
||||
bool allowMove(const QModelIndex &srcParent, int srcFirst, int srcLast, const QModelIndex &destinationParent, int destinationChild, Qt::Orientation orientation);
|
||||
|
||||
|
||||
inline QModelIndex createIndex(int row, int column, void *data = 0) const {
|
||||
return q_func()->createIndex(row, column, data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2935,7 +2935,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
return data;
|
||||
QByteArray encoded;
|
||||
QDataStream stream(&encoded, QIODevice::WriteOnly);
|
||||
|
||||
|
||||
QSet<QStandardItem*> itemsSet;
|
||||
QStack<QStandardItem*> stack;
|
||||
itemsSet.reserve(indexes.count());
|
||||
|
|
@ -2945,7 +2945,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
itemsSet << item;
|
||||
stack.push(item);
|
||||
}
|
||||
|
||||
|
||||
//remove duplicates childrens
|
||||
{
|
||||
QSet<QStandardItem *> seen;
|
||||
|
|
@ -2954,7 +2954,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
if (seen.contains(itm))
|
||||
continue;
|
||||
seen.insert(itm);
|
||||
|
||||
|
||||
const QVector<QStandardItem*> &childList = itm->d_func()->children;
|
||||
for (int i = 0; i < childList.count(); ++i) {
|
||||
QStandardItem *chi = childList.at(i);
|
||||
|
|
@ -2968,17 +2968,17 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
stack.reserve(itemsSet.count());
|
||||
foreach (QStandardItem *item, itemsSet) {
|
||||
stack.push(item);
|
||||
}
|
||||
|
||||
|
||||
//stream everything recursively
|
||||
while (!stack.isEmpty()) {
|
||||
QStandardItem *item = stack.pop();
|
||||
if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position
|
||||
stream << item->row() << item->column();
|
||||
stream << item->row() << item->column();
|
||||
}
|
||||
if(item) {
|
||||
stream << *item << item->columnCount() << item->d_ptr->children.count();
|
||||
|
|
@ -2996,7 +2996,7 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const
|
|||
|
||||
/* \internal
|
||||
Used by QStandardItemModel::dropMimeData
|
||||
stream out an item and his children
|
||||
stream out an item and his children
|
||||
*/
|
||||
void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStandardItem *item)
|
||||
{
|
||||
|
|
@ -3004,9 +3004,9 @@ void QStandardItemModelPrivate::decodeDataRecursive(QDataStream &stream, QStanda
|
|||
stream >> *item;
|
||||
stream >> colCount >> childCount;
|
||||
item->setColumnCount(colCount);
|
||||
|
||||
|
||||
int childPos = childCount;
|
||||
|
||||
|
||||
while(childPos > 0) {
|
||||
childPos--;
|
||||
QStandardItem *child = createItem();
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE
|
|||
\class QFileIconProvider
|
||||
|
||||
\inmodule QtWidgets
|
||||
|
||||
|
||||
\brief The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes.
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -560,7 +560,7 @@ void QExpandingLineEdit::updateMinimumWidth()
|
|||
|
||||
QStyleOptionFrameV2 opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
|
||||
int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0).
|
||||
expandedTo(QApplication::globalStrut()), this).width();
|
||||
setMinimumWidth(minWidth);
|
||||
|
|
|
|||
|
|
@ -538,9 +538,9 @@ void QStyledItemDelegate::updateEditorGeometry(QWidget *editor,
|
|||
|
||||
QStyleOptionViewItem opt = option;
|
||||
initStyleOption(&opt, index);
|
||||
// let the editor take up all available space
|
||||
// let the editor take up all available space
|
||||
//if the editor is not a QLineEdit
|
||||
//or it is in a QTableView
|
||||
//or it is in a QTableView
|
||||
#if !defined(QT_NO_TABLEVIEW) && !defined(QT_NO_LINEEDIT)
|
||||
if (qobject_cast<QExpandingLineEdit*>(editor) && !qobject_cast<const QTableView*>(widget))
|
||||
opt.showDecorationSelected = editor->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, editor);
|
||||
|
|
|
|||
|
|
@ -2198,7 +2198,7 @@ int QTableView::sizeHintForRow(int row) const
|
|||
option.rect.setX(columnViewportPosition(index.column()));
|
||||
option.rect.setWidth(columnWidth(index.column()));
|
||||
}
|
||||
|
||||
|
||||
QWidget *editor = d->editorForIndex(index).widget.data();
|
||||
if (editor && d->persistent.contains(editor)) {
|
||||
hint = qMax(hint, editor->sizeHint().height());
|
||||
|
|
@ -2206,7 +2206,7 @@ int QTableView::sizeHintForRow(int row) const
|
|||
int max = editor->maximumSize().height();
|
||||
hint = qBound(min, hint, max);
|
||||
}
|
||||
|
||||
|
||||
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).height());
|
||||
}
|
||||
|
||||
|
|
@ -2251,7 +2251,7 @@ int QTableView::sizeHintForColumn(int column) const
|
|||
if (d->verticalHeader->isSectionHidden(logicalRow))
|
||||
continue;
|
||||
index = d->model->index(logicalRow, column, d->root);
|
||||
|
||||
|
||||
QWidget *editor = d->editorForIndex(index).widget.data();
|
||||
if (editor && d->persistent.contains(editor)) {
|
||||
hint = qMax(hint, editor->sizeHint().width());
|
||||
|
|
@ -2259,7 +2259,7 @@ int QTableView::sizeHintForColumn(int column) const
|
|||
int max = editor->maximumSize().width();
|
||||
hint = qBound(min, hint, max);
|
||||
}
|
||||
|
||||
|
||||
hint = qMax(hint, itemDelegate(index)->sizeHint(option, index).width());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1716,7 +1716,7 @@ void QTreeView::drawRow(QPainter *painter, const QStyleOptionViewItem &option,
|
|||
// we have to split the focus rect into two rects
|
||||
if (allColumnsShowFocus && !option.showDecorationSelected
|
||||
&& header->sectionsMoved() && (header->visualIndex(0) != 0)) {
|
||||
QRect sectionRect(0, y, header->sectionPosition(0), height);
|
||||
QRect sectionRect(0, y, header->sectionPosition(0), height);
|
||||
o.rect = style()->visualRect(layoutDirection(), d->viewport->rect(), sectionRect);
|
||||
style()->drawPrimitive(QStyle::PE_FrameFocusRect, &o, painter);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1477,7 +1477,7 @@ QTreeWidgetItem::QTreeWidgetItem(QTreeWidgetItem *parent, QTreeWidgetItem *after
|
|||
|
||||
/*!
|
||||
Destroys this tree widget item.
|
||||
|
||||
|
||||
The item will be removed from \l{QTreeWidget}s to which it has
|
||||
been added. This makes it safe to delete an item at any time.
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
|
|||
\class QTreeWidgetItemIterator
|
||||
\ingroup model-view
|
||||
\inmodule QtWidgets
|
||||
|
||||
|
||||
\brief The QTreeWidgetItemIterator class provides a way to iterate over the
|
||||
items in a QTreeWidget instance.
|
||||
|
||||
|
|
|
|||
|
|
@ -150,59 +150,59 @@ void tst_QStandardItem::getSetData()
|
|||
QString text = QString("text %0").arg(i);
|
||||
item.setText(text);
|
||||
QCOMPARE(item.text(), text);
|
||||
|
||||
|
||||
QPixmap pixmap(32, 32);
|
||||
pixmap.fill((i == 1) ? Qt::red : Qt::green);
|
||||
QIcon icon(pixmap);
|
||||
item.setIcon(icon);
|
||||
QCOMPARE(item.icon(), icon);
|
||||
|
||||
|
||||
QString toolTip = QString("toolTip %0").arg(i);
|
||||
item.setToolTip(toolTip);
|
||||
QCOMPARE(item.toolTip(), toolTip);
|
||||
|
||||
|
||||
QString statusTip = QString("statusTip %0").arg(i);
|
||||
item.setStatusTip(statusTip);
|
||||
QCOMPARE(item.statusTip(), statusTip);
|
||||
|
||||
|
||||
QString whatsThis = QString("whatsThis %0").arg(i);
|
||||
item.setWhatsThis(whatsThis);
|
||||
QCOMPARE(item.whatsThis(), whatsThis);
|
||||
|
||||
|
||||
QSize sizeHint(64*i, 48*i);
|
||||
item.setSizeHint(sizeHint);
|
||||
QCOMPARE(item.sizeHint(), sizeHint);
|
||||
|
||||
|
||||
QFont font;
|
||||
item.setFont(font);
|
||||
QCOMPARE(item.font(), font);
|
||||
|
||||
|
||||
Qt::Alignment textAlignment((i == 1)
|
||||
? Qt::AlignLeft|Qt::AlignVCenter
|
||||
: Qt::AlignRight);
|
||||
item.setTextAlignment(textAlignment);
|
||||
QCOMPARE(item.textAlignment(), textAlignment);
|
||||
|
||||
|
||||
QColor backgroundColor((i == 1) ? Qt::blue : Qt::yellow);
|
||||
item.setBackground(backgroundColor);
|
||||
QCOMPARE(item.background().color(), backgroundColor);
|
||||
|
||||
|
||||
QColor textColor((i == i) ? Qt::green : Qt::cyan);
|
||||
item.setForeground(textColor);
|
||||
QCOMPARE(item.foreground().color(), textColor);
|
||||
|
||||
|
||||
Qt::CheckState checkState((i == 1) ? Qt::PartiallyChecked : Qt::Checked);
|
||||
item.setCheckState(checkState);
|
||||
QCOMPARE(item.checkState(), checkState);
|
||||
|
||||
|
||||
QString accessibleText = QString("accessibleText %0").arg(i);
|
||||
item.setAccessibleText(accessibleText);
|
||||
QCOMPARE(item.accessibleText(), accessibleText);
|
||||
|
||||
|
||||
QString accessibleDescription = QString("accessibleDescription %0").arg(i);
|
||||
item.setAccessibleDescription(accessibleDescription);
|
||||
QCOMPARE(item.accessibleDescription(), accessibleDescription);
|
||||
|
||||
|
||||
QCOMPARE(item.text(), text);
|
||||
QCOMPARE(item.icon(), icon);
|
||||
QCOMPARE(item.toolTip(), toolTip);
|
||||
|
|
@ -216,7 +216,7 @@ void tst_QStandardItem::getSetData()
|
|||
QCOMPARE(item.checkState(), checkState);
|
||||
QCOMPARE(item.accessibleText(), accessibleText);
|
||||
QCOMPARE(item.accessibleDescription(), accessibleDescription);
|
||||
|
||||
|
||||
QCOMPARE(qvariant_cast<QString>(item.data(Qt::DisplayRole)), text);
|
||||
QCOMPARE(qvariant_cast<QIcon>(item.data(Qt::DecorationRole)), icon);
|
||||
QCOMPARE(qvariant_cast<QString>(item.data(Qt::ToolTipRole)), toolTip);
|
||||
|
|
@ -250,7 +250,7 @@ void tst_QStandardItem::getSetData()
|
|||
item.setData(QVariant(), Qt::CheckStateRole);
|
||||
item.setData(QVariant(), Qt::AccessibleTextRole);
|
||||
item.setData(QVariant(), Qt::AccessibleDescriptionRole);
|
||||
|
||||
|
||||
QCOMPARE(item.data(Qt::DisplayRole), QVariant());
|
||||
QCOMPARE(item.data(Qt::DecorationRole), QVariant());
|
||||
QCOMPARE(item.data(Qt::ToolTipRole), QVariant());
|
||||
|
|
@ -296,7 +296,7 @@ void tst_QStandardItem::getSetFlags()
|
|||
QVERIFY(item.isDropEnabled());
|
||||
QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
|
||||
#endif
|
||||
|
||||
|
||||
QVERIFY(item.isEnabled());
|
||||
item.setEnabled(false);
|
||||
QVERIFY(!item.isEnabled());
|
||||
|
|
@ -332,7 +332,7 @@ void tst_QStandardItem::getSetFlags()
|
|||
item.setCheckState(Qt::Checked);
|
||||
item.setCheckable(true);
|
||||
QCOMPARE(item.checkState(), Qt::Checked);
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QStandardItem::getSetRowAndColumnCount()
|
||||
{
|
||||
|
|
@ -427,7 +427,7 @@ void tst_QStandardItem::parent()
|
|||
QCOMPARE(child->parent(), static_cast<QStandardItem*>(0));
|
||||
item.setChild(0, 0, child);
|
||||
QCOMPARE(child->parent(), &item);
|
||||
|
||||
|
||||
QStandardItem *childOfChild = new QStandardItem;
|
||||
child->setChild(0, 0, childOfChild);
|
||||
QCOMPARE(childOfChild->parent(), child);
|
||||
|
|
@ -897,7 +897,7 @@ void tst_QStandardItem::takeRow()
|
|||
void tst_QStandardItem::streamItem()
|
||||
{
|
||||
QStandardItem item;
|
||||
|
||||
|
||||
item.setText(QLatin1String("text"));
|
||||
item.setToolTip(QLatin1String("toolTip"));
|
||||
item.setStatusTip(QLatin1String("statusTip"));
|
||||
|
|
@ -1006,7 +1006,7 @@ void tst_QStandardItem::sortChildren()
|
|||
two->appendRow(new QStandardItem(QLatin1String("e")));
|
||||
item->appendRow(one);
|
||||
item->appendRow(two);
|
||||
|
||||
|
||||
QSignalSpy layoutAboutToBeChangedSpy(
|
||||
model, SIGNAL(layoutAboutToBeChanged()));
|
||||
QSignalSpy layoutChangedSpy(
|
||||
|
|
@ -1021,7 +1021,7 @@ void tst_QStandardItem::sortChildren()
|
|||
QCOMPARE(two->child(0)->text(), QLatin1String("f"));
|
||||
QCOMPARE(two->child(1)->text(), QLatin1String("d"));
|
||||
QCOMPARE(two->child(2)->text(), QLatin1String("e"));
|
||||
|
||||
|
||||
two->sortChildren(0, Qt::AscendingOrder);
|
||||
// verify sorted
|
||||
QCOMPARE(two->child(0)->text(), QLatin1String("d"));
|
||||
|
|
@ -1031,7 +1031,7 @@ void tst_QStandardItem::sortChildren()
|
|||
QCOMPARE(one->child(0)->text(), QLatin1String("c"));
|
||||
QCOMPARE(one->child(1)->text(), QLatin1String("b"));
|
||||
QCOMPARE(one->child(2)->text(), QLatin1String("a"));
|
||||
|
||||
|
||||
item->sortChildren(0, Qt::AscendingOrder);
|
||||
// verify everything sorted
|
||||
QCOMPARE(one->child(0)->text(), QLatin1String("a"));
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ CONFIG += parallel_test
|
|||
QT += widgets widgets-private
|
||||
QT += gui-private core-private testlib
|
||||
|
||||
SOURCES += tst_qcolumnview.cpp
|
||||
SOURCES += tst_qcolumnview.cpp
|
||||
TARGET = tst_qcolumnview
|
||||
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
|
||||
|
|
|
|||
|
|
@ -4065,9 +4065,9 @@ void tst_QTableView::taskQTBUG_8777_scrollToSpans()
|
|||
}
|
||||
|
||||
void tst_QTableView::taskQTBUG_10169_sizeHintForRow()
|
||||
{
|
||||
QtTestTableView tableView;
|
||||
QStandardItemModel model(1, 3);
|
||||
{
|
||||
QtTestTableView tableView;
|
||||
QStandardItemModel model(1, 3);
|
||||
model.setData(model.index(0, 0), "Word wrapping text goes here.");
|
||||
tableView.setModel(&model);
|
||||
tableView.verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ void tst_QTableWidget::getSetCheck()
|
|||
// QCOMPARE(INT_MAX, obj1.rowCount());
|
||||
obj1.setRowCount(100);
|
||||
QCOMPARE(100, obj1.rowCount());
|
||||
|
||||
|
||||
|
||||
// int QTableWidget::columnCount()
|
||||
// void QTableWidget::setColumnCount(int)
|
||||
|
|
@ -584,7 +584,7 @@ void tst_QTableWidget::selectedItems()
|
|||
}
|
||||
if (hidden)
|
||||
continue;
|
||||
|
||||
|
||||
for (int column = 0; column<testWidget->columnCount(); ++column) {
|
||||
foreach (int hiddenColumn, hiddenColumns){
|
||||
if(hiddenColumn == column){
|
||||
|
|
@ -594,7 +594,7 @@ void tst_QTableWidget::selectedItems()
|
|||
}
|
||||
if (hidden)
|
||||
continue;
|
||||
|
||||
|
||||
QTableWidgetItem *item = testWidget->item(row, column);
|
||||
if (item && testWidget->isItemSelected(item))
|
||||
QVERIFY(selectedItems.contains(item));
|
||||
|
|
@ -1321,7 +1321,7 @@ void tst_QTableWidget::setItemWithSorting()
|
|||
|
||||
QAbstractItemModel *model = w.model();
|
||||
QList<QPersistentModelIndex> persistent;
|
||||
|
||||
|
||||
int ti = 0;
|
||||
for (int r = 0; r < rowCount; ++r) {
|
||||
for (int c = 0; c < columnCount; ++c) {
|
||||
|
|
@ -1330,10 +1330,10 @@ void tst_QTableWidget::setItemWithSorting()
|
|||
}
|
||||
persistent << model->index(r, sortColumn);
|
||||
}
|
||||
|
||||
|
||||
w.sortItems(sortColumn, static_cast<Qt::SortOrder>(sortOrder));
|
||||
w.setSortingEnabled(true);
|
||||
|
||||
|
||||
QSignalSpy dataChangedSpy(model, SIGNAL(dataChanged(QModelIndex,QModelIndex)));
|
||||
QSignalSpy layoutChangedSpy(model, SIGNAL(layoutChanged()));
|
||||
|
||||
|
|
@ -1354,7 +1354,7 @@ void tst_QTableWidget::setItemWithSorting()
|
|||
QCOMPARE(w.item(r, c)->text(), str);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (int k = 0; k < persistent.count(); ++k) {
|
||||
QCOMPARE(persistent.at(k).row(), expectedRows.at(k));
|
||||
int i = (persistent.at(k).row() * columnCount) + sortColumn;
|
||||
|
|
|
|||
Loading…
Reference in New Issue