QtBase  v6.3.1
tst_qstandarditem.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the test suite of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 
30 #include <QTest>
31 #include <QSignalSpy>
32 
33 #include <QStandardItem>
34 
35 class tst_QStandardItem : public QObject
36 {
37  Q_OBJECT
38 
39 private slots:
40  void ctor();
41  void textCtor();
42  void iconTextCtor();
43  void rowsColumnsCtor();
44  void getSetData();
45  void getSetFlags();
46  void getSetRowAndColumnCount();
47  void getSetChild_data();
48  void getSetChild();
49  void parent();
50  void insertColumn_data();
51  void insertColumn();
52  void insertRow_data();
53  void insertRow();
54  void insertRows_data();
55  void insertRows();
56  void appendColumn_data();
57  void appendColumn();
58  void appendRow_data();
59  void appendRow();
60  void takeChild();
61  void takeColumn_data();
62  void takeColumn();
63  void takeRow_data();
64  void takeRow();
65  void streamItem();
66  void deleteItem();
67  void clone();
68  void sortChildren();
69  void subclassing();
70  void lessThan();
71  void clearData();
72 };
73 
74 void tst_QStandardItem::clearData()
75 {
79  item.clearData();
83 }
84 
85 void tst_QStandardItem::ctor()
86 {
88  QVERIFY(!item.hasChildren());
89 }
90 
91 void tst_QStandardItem::textCtor()
92 {
93  QLatin1String text("text");
95  QCOMPARE(item.text(), text);
96  QVERIFY(!item.hasChildren());
97 }
98 
99 void tst_QStandardItem::iconTextCtor()
100 {
101  QPixmap pixmap(32, 32);
102  pixmap.fill(Qt::red);
103  QIcon icon(pixmap);
104  QLatin1String text("text");
106  QCOMPARE(item.icon(), icon);
107  QCOMPARE(item.text(), text);
108  QVERIFY(!item.hasChildren());
109 }
110 
111 void tst_QStandardItem::rowsColumnsCtor()
112 {
113  const int rows = 5;
114  const int columns = 12;
115  QStandardItem item(rows, columns);
116  QCOMPARE(item.rowCount(), rows);
117  QCOMPARE(item.columnCount(), columns);
118 }
119 
120 void tst_QStandardItem::getSetData()
121 {
123  for (int x = 0; x < 2; ++x) {
124  for (int i = 1; i <= 2; ++i) {
125  const QString iS = QString::number(i);
126  QString text = QLatin1String("text ") + iS;
127  item.setText(text);
128  QCOMPARE(item.text(), text);
129 
130  QPixmap pixmap(32, 32);
131  pixmap.fill((i == 1) ? Qt::red : Qt::green);
132  QIcon icon(pixmap);
133  item.setIcon(icon);
134  QCOMPARE(item.icon(), icon);
135 
136  QString toolTip = QLatin1String("toolTip ") + iS;
137  item.setToolTip(toolTip);
138  QCOMPARE(item.toolTip(), toolTip);
139 
140  QString statusTip = QLatin1String("statusTip ") + iS;
141  item.setStatusTip(statusTip);
142  QCOMPARE(item.statusTip(), statusTip);
143 
144  QString whatsThis = QLatin1String("whatsThis ") + iS;
145  item.setWhatsThis(whatsThis);
146  QCOMPARE(item.whatsThis(), whatsThis);
147 
148  QSize sizeHint(64*i, 48*i);
149  item.setSizeHint(sizeHint);
150  QCOMPARE(item.sizeHint(), sizeHint);
151 
152  QFont font;
153  item.setFont(font);
154  QCOMPARE(item.font(), font);
155 
156  Qt::Alignment textAlignment((i == 1)
158  : Qt::AlignRight);
159  item.setTextAlignment(textAlignment);
160  QCOMPARE(item.textAlignment(), textAlignment);
161 
163  item.setBackground(backgroundColor);
164  QCOMPARE(item.background().color(), backgroundColor);
165 
166  QColor textColor((i == 1) ? Qt::green : Qt::cyan);
167  item.setForeground(textColor);
168  QCOMPARE(item.foreground().color(), textColor);
169 
171  item.setCheckState(checkState);
172  QCOMPARE(item.checkState(), checkState);
173 
174  QString accessibleText = QLatin1String("accessibleText ") + iS;
175  item.setAccessibleText(accessibleText);
176  QCOMPARE(item.accessibleText(), accessibleText);
177 
178  QString accessibleDescription = QLatin1String("accessibleDescription ") + iS;
179  item.setAccessibleDescription(accessibleDescription);
180  QCOMPARE(item.accessibleDescription(), accessibleDescription);
181 
182  QCOMPARE(item.text(), text);
183  QCOMPARE(item.icon(), icon);
184  QCOMPARE(item.toolTip(), toolTip);
185  QCOMPARE(item.statusTip(), statusTip);
186  QCOMPARE(item.whatsThis(), whatsThis);
187  QCOMPARE(item.sizeHint(), sizeHint);
188  QCOMPARE(item.font(), font);
189  QCOMPARE(item.textAlignment(), textAlignment);
190  QCOMPARE(item.background().color(), backgroundColor);
191  QCOMPARE(item.foreground().color(), textColor);
192  QCOMPARE(item.checkState(), checkState);
193  QCOMPARE(item.accessibleText(), accessibleText);
194  QCOMPARE(item.accessibleDescription(), accessibleDescription);
195 
196  QCOMPARE(qvariant_cast<QString>(item.data(Qt::DisplayRole)), text);
197  QCOMPARE(qvariant_cast<QIcon>(item.data(Qt::DecorationRole)), icon);
198  QCOMPARE(qvariant_cast<QString>(item.data(Qt::ToolTipRole)), toolTip);
199  QCOMPARE(qvariant_cast<QString>(item.data(Qt::StatusTipRole)), statusTip);
200  QCOMPARE(qvariant_cast<QString>(item.data(Qt::WhatsThisRole)), whatsThis);
201  QCOMPARE(qvariant_cast<QSize>(item.data(Qt::SizeHintRole)), sizeHint);
202  QCOMPARE(qvariant_cast<QFont>(item.data(Qt::FontRole)), font);
203  QCOMPARE(qvariant_cast<int>(item.data(Qt::TextAlignmentRole)), int(textAlignment));
204  QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)), QBrush(backgroundColor));
205  QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::ForegroundRole)), QBrush(textColor));
206  QCOMPARE(qvariant_cast<int>(item.data(Qt::CheckStateRole)), int(checkState));
207  QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleTextRole)), accessibleText);
208  QCOMPARE(qvariant_cast<QString>(item.data(Qt::AccessibleDescriptionRole)), accessibleDescription);
209 
210  item.setBackground(pixmap);
211  QCOMPARE(item.background().texture(), pixmap);
212  QCOMPARE(qvariant_cast<QBrush>(item.data(Qt::BackgroundRole)).texture(), pixmap);
213  }
227 
241  }
242 }
243 
244 void tst_QStandardItem::getSetFlags()
245 {
247  item.setEnabled(true);
250  item.setEditable(true);
251  QVERIFY(item.isEditable());
253  item.setSelectable(true);
254  QVERIFY(item.isSelectable());
256  item.setCheckable(true);
257  QVERIFY(item.isCheckable());
258  QCOMPARE(item.checkState(), Qt::Unchecked);
260  item.setUserTristate(true);
261  QVERIFY(item.isUserTristate());
263  item.setAutoTristate(true);
264  QVERIFY(item.isAutoTristate());
266 #if QT_CONFIG(draganddrop)
267  item.setDragEnabled(true);
268  QVERIFY(item.isDragEnabled());
270  item.setDropEnabled(true);
271  QVERIFY(item.isDropEnabled());
273 #endif
274 
276  item.setEnabled(false);
277  QVERIFY(!item.isEnabled());
279  QVERIFY(item.isEditable());
280  item.setEditable(false);
281  QVERIFY(!item.isEditable());
283  QVERIFY(item.isSelectable());
284  item.setSelectable(false);
285  QVERIFY(!item.isSelectable());
287  QVERIFY(item.isCheckable());
288  item.setCheckable(false);
289  QVERIFY(!item.isCheckable());
291  item.setUserTristate(false);
292  QVERIFY(!item.isUserTristate());
294  item.setAutoTristate(false);
295  QVERIFY(!item.isAutoTristate());
297 #if QT_CONFIG(draganddrop)
298  QVERIFY(item.isDragEnabled());
299  item.setDragEnabled(false);
300  QVERIFY(!item.isDragEnabled());
302  QVERIFY(item.isDropEnabled());
303  item.setDropEnabled(false);
304  QVERIFY(!item.isDropEnabled());
306 #endif
307 
308  item.setCheckable(false);
309  item.setCheckState(Qt::Checked);
310  item.setCheckable(true);
311  QCOMPARE(item.checkState(), Qt::Checked);
312 }
313 
314 void tst_QStandardItem::getSetRowAndColumnCount()
315 {
317 
318  item.setRowCount(-1);
319  QCOMPARE(item.rowCount(), 0);
320 
321  item.setColumnCount(-1);
322  QCOMPARE(item.columnCount(), 0);
323 
324  item.setRowCount(1);
325  QCOMPARE(item.rowCount(), 1);
326  QCOMPARE(item.columnCount(), 0);
327 
328  item.setColumnCount(1);
329  QCOMPARE(item.columnCount(), 1);
330  QCOMPARE(item.rowCount(), 1);
331 
332  item.setColumnCount(10);
333  QCOMPARE(item.columnCount(), 10);
334  QCOMPARE(item.rowCount(), 1);
335 
336  item.setRowCount(20);
337  QCOMPARE(item.rowCount(), 20);
338  QCOMPARE(item.columnCount(), 10);
339 
340  item.setRowCount(-1);
341  QCOMPARE(item.rowCount(), 20);
342 
343  item.setColumnCount(-1);
344  QCOMPARE(item.columnCount(), 10);
345 
346  item.setColumnCount(0);
347  QCOMPARE(item.columnCount(), 0);
348  QCOMPARE(item.rowCount(), 20);
349 
350  item.setRowCount(0);
351  QCOMPARE(item.rowCount(), 0);
352 }
353 
354 void tst_QStandardItem::getSetChild_data()
355 {
356  QTest::addColumn<int>("rows");
357  QTest::addColumn<int>("columns");
358  QTest::addColumn<int>("row");
359  QTest::addColumn<int>("column");
360 
361  QTest::newRow("0x0 children, child at (-1,-1)") << 0 << 0 << -1 << -1;
362  QTest::newRow("0x0 children, child at (0,0)") << 0 << 0 << 0 << 0;
363 }
364 
365 void tst_QStandardItem::getSetChild()
366 {
367  QFETCH(int, rows);
368  QFETCH(int, columns);
369  QFETCH(int, row);
370  QFETCH(int, column);
371 
372  QStandardItem item(rows, columns);
373  bool shouldHaveChildren = (rows > 0) && (columns > 0);
374  QCOMPARE(item.hasChildren(), shouldHaveChildren);
375  QCOMPARE(item.child(row, column), nullptr);
376 
378  item.setChild(row, column, child);
379  if ((row >= 0) && (column >= 0)) {
380  QCOMPARE(item.rowCount(), qMax(rows, row + 1));
381  QCOMPARE(item.columnCount(), qMax(columns, column + 1));
382 
383  QCOMPARE(item.child(row, column), child);
384  QCOMPARE(child->row(), row);
385  QCOMPARE(child->column(), column);
386 
387  QStandardItem *anotherChild = new QStandardItem;
388  item.setChild(row, column, anotherChild);
389  QCOMPARE(item.child(row, column), anotherChild);
390  QCOMPARE(anotherChild->row(), row);
391  QCOMPARE(anotherChild->column(), column);
392  item.setChild(row, column, nullptr);
393  } else {
394  delete child;
395  }
396  QCOMPARE(item.child(row, column), nullptr);
397 }
398 
399 void tst_QStandardItem::parent()
400 {
401  {
404  QCOMPARE(child->parent(), nullptr);
405  item.setChild(0, 0, child);
406  QCOMPARE(child->parent(), &item);
407 
408  QStandardItem *childOfChild = new QStandardItem;
409  child->setChild(0, 0, childOfChild);
410  QCOMPARE(childOfChild->parent(), child);
411  }
412 
413  {
416  model.appendRow(item);
417  // parent of a top-level item should be 0
418  QCOMPARE(item->parent(), nullptr);
419  }
420 }
421 
422 void tst_QStandardItem::insertColumn_data()
423 {
424  QTest::addColumn<int>("rows");
425  QTest::addColumn<int>("columns");
426  QTest::addColumn<int>("column");
427  QTest::addColumn<int>("count");
428 
429  QTest::newRow("insert 0 at -1 in 0x0") << 0 << 0 << -1 << 0;
430  QTest::newRow("insert 0 at 0 in 0x0") << 0 << 0 << 0 << 0;
431  QTest::newRow("insert 0 at 0 in 1x0") << 1 << 0 << 0 << 0;
432  QTest::newRow("insert 0 at 0 in 0x1") << 0 << 1 << 0 << 0;
433  QTest::newRow("insert 0 at 0 in 1x1") << 1 << 1 << 0 << 0;
434  QTest::newRow("insert 1 at -1 in 0x0") << 0 << 0 << -1 << 1;
435  QTest::newRow("insert 1 at 0 in 0x0") << 0 << 0 << 0 << 1;
436  QTest::newRow("insert 1 at 0 in 1x0") << 1 << 0 << 0 << 1;
437  QTest::newRow("insert 1 at 0 in 0x1") << 0 << 1 << 0 << 1;
438  QTest::newRow("insert 1 at 0 in 1x1") << 1 << 1 << 0 << 1;
439  QTest::newRow("insert 1 at 1 in 1x1") << 1 << 1 << 1 << 1;
440  QTest::newRow("insert 1 at 0 in 2x1") << 2 << 1 << 0 << 1;
441  QTest::newRow("insert 1 at 1 in 2x1") << 2 << 1 << 1 << 1;
442  QTest::newRow("insert 1 at 0 in 1x2") << 1 << 2 << 0 << 1;
443  QTest::newRow("insert 1 at 1 in 1x2") << 1 << 2 << 1 << 1;
444  QTest::newRow("insert 1 at 0 in 8x4") << 8 << 4 << 0 << 1;
445  QTest::newRow("insert 1 at 1 in 8x4") << 8 << 4 << 1 << 1;
446  QTest::newRow("insert 1 at 2 in 8x4") << 8 << 4 << 2 << 1;
447  QTest::newRow("insert 1 at 3 in 8x4") << 8 << 4 << 3 << 1;
448  QTest::newRow("insert 1 at 4 in 8x4") << 8 << 4 << 4 << 1;
449  QTest::newRow("insert 4 at 0 in 8x4") << 8 << 4 << 0 << 4;
450  QTest::newRow("insert 4 at 4 in 8x4") << 8 << 4 << 4 << 4;
451  QTest::newRow("insert 6 at 0 in 8x4") << 8 << 4 << 0 << 6;
452  QTest::newRow("insert 6 at 4 in 8x4") << 8 << 4 << 4 << 6;
453 }
454 
455 void tst_QStandardItem::insertColumn()
456 {
457  QFETCH(int, rows);
458  QFETCH(int, columns);
459  QFETCH(int, column);
460  QFETCH(int, count);
461 
462  QStandardItem item(rows, columns);
463 
464  // make items for a new column
465  QList<QStandardItem*> columnItems;
466  for (int i = 0; i < count; ++i)
467  columnItems.append(new QStandardItem);
468 
469  item.insertColumn(column, columnItems);
470 
471  if (column >= 0) {
472  QCOMPARE(item.columnCount(), columns + 1);
473  QCOMPARE(item.rowCount(), qMax(rows, count));
474  // check to make sure items were inserted in correct place
475  for (int i = 0; i < count; ++i)
476  QCOMPARE(item.child(i, column), columnItems.at(i));
477  for (int i = count; i < item.rowCount(); ++i)
478  QCOMPARE(item.child(i, column), nullptr);
479  } else {
480  QCOMPARE(item.columnCount(), columns);
481  QCOMPARE(item.rowCount(), rows);
482  qDeleteAll(columnItems);
483  }
484 }
485 
486 void tst_QStandardItem::insertRow_data()
487 {
488  QTest::addColumn<int>("rows");
489  QTest::addColumn<int>("columns");
490  QTest::addColumn<int>("row");
491  QTest::addColumn<int>("count");
492 
493  QTest::newRow("insert 0 at -1 in 0x0") << 0 << 0 << -1 << 0;
494  QTest::newRow("insert 0 at 0 in 0x0") << 0 << 0 << 0 << 0;
495  QTest::newRow("insert 0 at 0 in 1x0") << 1 << 0 << 0 << 0;
496  QTest::newRow("insert 0 at 0 in 0x1") << 0 << 1 << 0 << 0;
497  QTest::newRow("insert 0 at 0 in 1x1") << 1 << 1 << 0 << 0;
498  QTest::newRow("insert 1 at -1 in 0x0") << 0 << 0 << -1 << 1;
499  QTest::newRow("insert 1 at 0 in 0x0") << 0 << 0 << 0 << 1;
500  QTest::newRow("insert 1 at 0 in 1x0") << 1 << 0 << 0 << 1;
501  QTest::newRow("insert 1 at 0 in 0x1") << 0 << 1 << 0 << 1;
502  QTest::newRow("insert 1 at 0 in 1x1") << 1 << 1 << 0 << 1;
503  QTest::newRow("insert 1 at 1 in 1x1") << 1 << 1 << 1 << 1;
504  QTest::newRow("insert 1 at 0 in 2x1") << 2 << 1 << 0 << 1;
505  QTest::newRow("insert 1 at 1 in 2x1") << 2 << 1 << 1 << 1;
506  QTest::newRow("insert 1 at 0 in 1x2") << 1 << 2 << 0 << 1;
507  QTest::newRow("insert 1 at 1 in 1x2") << 1 << 2 << 1 << 1;
508  QTest::newRow("insert 1 at 0 in 4x8") << 4 << 8 << 0 << 1;
509  QTest::newRow("insert 1 at 1 in 4x8") << 4 << 8 << 1 << 1;
510  QTest::newRow("insert 1 at 2 in 4x8") << 4 << 8 << 2 << 1;
511  QTest::newRow("insert 1 at 3 in 4x8") << 4 << 8 << 3 << 1;
512  QTest::newRow("insert 1 at 4 in 4x8") << 4 << 8 << 4 << 1;
513  QTest::newRow("insert 4 at 0 in 4x8") << 4 << 8 << 0 << 4;
514  QTest::newRow("insert 4 at 4 in 4x8") << 4 << 8 << 4 << 4;
515  QTest::newRow("insert 6 at 0 in 4x8") << 4 << 8 << 0 << 6;
516  QTest::newRow("insert 6 at 4 in 4x8") << 4 << 8 << 4 << 6;
517 }
518 
519 void tst_QStandardItem::insertRow()
520 {
521  QFETCH(int, rows);
522  QFETCH(int, columns);
523  QFETCH(int, row);
524  QFETCH(int, count);
525 
526  QStandardItem item(rows, columns);
527 
528  // make items for a new column
529  QList<QStandardItem*> rowItems;
530  for (int i = 0; i < count; ++i)
531  rowItems.append(new QStandardItem);
532 
533  item.insertRow(row, rowItems);
534 
535  if (row >= 0) {
536  QCOMPARE(item.columnCount(), qMax(columns, count));
537  QCOMPARE(item.rowCount(), rows + 1);
538  // check to make sure items were inserted in correct place
539  for (int i = 0; i < count; ++i)
540  QCOMPARE(item.child(row, i), rowItems.at(i));
541  for (int i = count; i < item.columnCount(); ++i)
542  QCOMPARE(item.child(row, i), nullptr);
543  } else {
544  QCOMPARE(item.columnCount(), columns);
545  QCOMPARE(item.rowCount(), rows);
546  qDeleteAll(rowItems);
547  }
548 }
549 
550 void tst_QStandardItem::insertRows_data()
551 {
552  QTest::addColumn<int>("rows");
553  QTest::addColumn<int>("columns");
554  QTest::addColumn<int>("insertAt");
555  QTest::addColumn<int>("insertCount");
556 
557  QTest::newRow("insert {0,1} at 0 in 0x0") << 0 << 0 << 0 << 2;
558 }
559 
560 void tst_QStandardItem::insertRows()
561 {
562  QFETCH(int, rows);
563  QFETCH(int, columns);
564  QFETCH(int, insertAt);
565  QFETCH(int, insertCount);
566 
567  QStandardItem item(rows, columns);
568 
570  for (int i = 0; i < insertCount; ++i)
571  items.append(new QStandardItem());
572  item.insertRows(insertAt, items);
573 
574  QCOMPARE(item.rowCount(), rows + insertCount);
575 }
576 
577 void tst_QStandardItem::appendColumn_data()
578 {
579  QTest::addColumn<int>("rows");
580  QTest::addColumn<int>("columns");
581  QTest::addColumn<int>("count");
582 
583  QTest::newRow("append 0 to 0x0") << 0 << 0 << 0;
584  QTest::newRow("append 1 to 0x0") << 0 << 0 << 1;
585  QTest::newRow("append 1 to 1x0") << 1 << 0 << 1;
586  QTest::newRow("append 1 to 0x1") << 0 << 1 << 1;
587  QTest::newRow("append 1 to 1x1") << 1 << 1 << 1;
588  QTest::newRow("append 1 to 2x0") << 2 << 0 << 1;
589  QTest::newRow("append 1 to 0x2") << 0 << 2 << 1;
590  QTest::newRow("append 1 to 2x1") << 2 << 1 << 1;
591  QTest::newRow("append 1 to 1x2") << 1 << 2 << 1;
592  QTest::newRow("append 1 to 2x2") << 2 << 2 << 1;
593  QTest::newRow("append 2 to 0x0") << 0 << 0 << 2;
594  QTest::newRow("append 2 to 1x0") << 1 << 0 << 2;
595  QTest::newRow("append 2 to 0x1") << 0 << 1 << 2;
596  QTest::newRow("append 2 to 1x1") << 1 << 1 << 2;
597  QTest::newRow("append 2 to 2x0") << 2 << 0 << 2;
598  QTest::newRow("append 2 to 0x2") << 0 << 2 << 2;
599  QTest::newRow("append 2 to 2x1") << 2 << 1 << 2;
600  QTest::newRow("append 2 to 1x2") << 1 << 2 << 2;
601  QTest::newRow("append 2 to 2x2") << 2 << 2 << 2;
602  QTest::newRow("append 3 to 2x1") << 2 << 1 << 3;
603  QTest::newRow("append 3 to 1x2") << 1 << 2 << 3;
604  QTest::newRow("append 3 to 2x2") << 2 << 2 << 3;
605  QTest::newRow("append 3 to 4x2") << 4 << 2 << 3;
606  QTest::newRow("append 3 to 2x4") << 2 << 4 << 3;
607  QTest::newRow("append 3 to 4x4") << 4 << 4 << 3;
608  QTest::newRow("append 7 to 4x2") << 4 << 2 << 7;
609  QTest::newRow("append 7 to 2x4") << 2 << 4 << 7;
610  QTest::newRow("append 7 to 4x4") << 4 << 4 << 7;
611 }
612 
613 void tst_QStandardItem::appendColumn()
614 {
615  QFETCH(int, rows);
616  QFETCH(int, columns);
617  QFETCH(int, count);
618 
619  QStandardItem item(rows, columns);
620  QList<QStandardItem*> originalChildren;
621  // initialize children
622  for (int i = 0; i < rows; ++i) {
623  for (int j = 0; j < columns; ++j) {
625  originalChildren.append(child);
626  item.setChild(i, j, child);
627  }
628  }
629 
630  // make items for a new column
631  QList<QStandardItem*> columnItems;
632  for (int i = 0; i < count; ++i)
633  columnItems.append(new QStandardItem);
634 
635  item.appendColumn(columnItems);
636 
637  QCOMPARE(item.columnCount(), columns + 1);
638  QCOMPARE(item.rowCount(), qMax(rows, count));
639  // check to make sure items were inserted in correct place
640  for (int i = 0; i < count; ++i)
641  QCOMPARE(item.child(i, columns), columnItems.at(i));
642  for (int i = count; i < item.rowCount(); ++i)
643  QCOMPARE(item.child(i, columns), nullptr);
644 
645  // make sure original children remained unchanged
646  for (int i = 0; i < rows; ++i) {
647  for (int j = 0; j < columns; ++j)
648  QCOMPARE(item.child(i, j), originalChildren.at(i*columns+j));
649  }
650 }
651 
652 void tst_QStandardItem::appendRow_data()
653 {
654  QTest::addColumn<int>("rows");
655  QTest::addColumn<int>("columns");
656  QTest::addColumn<int>("count");
657 
658  QTest::newRow("append 0 to 0x0") << 0 << 0 << 0;
659  QTest::newRow("append 1 to 0x0") << 0 << 0 << 1;
660  QTest::newRow("append 1 to 1x0") << 1 << 0 << 1;
661  QTest::newRow("append 1 to 0x1") << 0 << 1 << 1;
662  QTest::newRow("append 1 to 1x1") << 1 << 1 << 1;
663  QTest::newRow("append 1 to 2x0") << 2 << 0 << 1;
664  QTest::newRow("append 1 to 0x2") << 0 << 2 << 1;
665  QTest::newRow("append 1 to 2x1") << 2 << 1 << 1;
666  QTest::newRow("append 1 to 1x2") << 1 << 2 << 1;
667  QTest::newRow("append 1 to 2x2") << 2 << 2 << 1;
668  QTest::newRow("append 2 to 0x0") << 0 << 0 << 2;
669  QTest::newRow("append 2 to 1x0") << 1 << 0 << 2;
670  QTest::newRow("append 2 to 0x1") << 0 << 1 << 2;
671  QTest::newRow("append 2 to 1x1") << 1 << 1 << 2;
672  QTest::newRow("append 2 to 2x0") << 2 << 0 << 2;
673  QTest::newRow("append 2 to 0x2") << 0 << 2 << 2;
674  QTest::newRow("append 2 to 2x1") << 2 << 1 << 2;
675  QTest::newRow("append 2 to 1x2") << 1 << 2 << 2;
676  QTest::newRow("append 2 to 2x2") << 2 << 2 << 2;
677  QTest::newRow("append 3 to 2x1") << 2 << 1 << 3;
678  QTest::newRow("append 3 to 1x2") << 1 << 2 << 3;
679  QTest::newRow("append 3 to 2x2") << 2 << 2 << 3;
680  QTest::newRow("append 3 to 4x2") << 4 << 2 << 3;
681  QTest::newRow("append 3 to 2x4") << 2 << 4 << 3;
682  QTest::newRow("append 3 to 4x4") << 4 << 4 << 3;
683  QTest::newRow("append 7 to 4x2") << 4 << 2 << 7;
684  QTest::newRow("append 7 to 2x4") << 2 << 4 << 7;
685  QTest::newRow("append 7 to 4x4") << 4 << 4 << 7;
686 }
687 
688 void tst_QStandardItem::appendRow()
689 {
690  QFETCH(int, rows);
691  QFETCH(int, columns);
692  QFETCH(int, count);
693 
694  QStandardItem item(rows, columns);
695  QList<QStandardItem*> originalChildren;
696  // initialize children
697  for (int i = 0; i < rows; ++i) {
698  for (int j = 0; j < columns; ++j) {
700  originalChildren.append(child);
701  item.setChild(i, j, child);
702  }
703  }
704 
705  // make items for a new row
706  QList<QStandardItem*> rowItems;
707  for (int i = 0; i < count; ++i)
708  rowItems.append(new QStandardItem);
709 
710  item.appendRow(rowItems);
711 
712  QCOMPARE(item.rowCount(), rows + 1);
713  QCOMPARE(item.columnCount(), qMax(columns, count));
714  // check to make sure items were inserted in correct place
715  for (int i = 0; i < count; ++i)
716  QCOMPARE(item.child(rows, i), rowItems.at(i));
717  for (int i = count; i < item.columnCount(); ++i)
718  QCOMPARE(item.child(rows, i), nullptr);
719 
720  // make sure original children remained unchanged
721  for (int i = 0; i < rows; ++i) {
722  for (int j = 0; j < columns; ++j)
723  QCOMPARE(item.child(i, j), originalChildren.at(i*columns+j));
724  }
725 }
726 
727 void tst_QStandardItem::takeChild()
728 {
729  QList<QStandardItem*> itemList;
730  for (int i = 0; i < 10; ++i)
731  itemList.append(new QStandardItem);
733  item.appendColumn(itemList);
734 
735  for (int i = 0; i < item.rowCount(); ++i) {
736  QCOMPARE(item.takeChild(i), itemList.at(i));
737  QCOMPARE(item.takeChild(0, 0), nullptr);
738  for (int j = i + 1; j < item.rowCount(); ++j)
739  QCOMPARE(item.child(j), itemList.at(j));
740  }
741  qDeleteAll(itemList);
742 }
743 
744 void tst_QStandardItem::takeColumn_data()
745 {
746  QTest::addColumn<int>("rows");
747  QTest::addColumn<int>("columns");
748  QTest::addColumn<int>("column");
749  QTest::addColumn<bool>("expectSuccess");
750 
751  QTest::newRow("take -1 from 0x0") << 0 << 0 << -1 << false;
752  QTest::newRow("take 0 from 0x0") << 0 << 0 << 0 << false;
753  QTest::newRow("take 0 from 1x0") << 1 << 0 << 0 << false;
754  QTest::newRow("take 0 from 0x1") << 0 << 1 << 0 << true;
755  QTest::newRow("take 1 from 0x1") << 0 << 1 << 1 << false;
756  QTest::newRow("take 0 from 1x1") << 1 << 1 << 0 << true;
757  QTest::newRow("take 1 from 1x1") << 0 << 1 << 1 << false;
758  QTest::newRow("take 0 from 4x1") << 4 << 1 << 0 << true;
759  QTest::newRow("take 1 from 4x1") << 4 << 1 << 1 << false;
760  QTest::newRow("take 0 from 4x8") << 4 << 8 << 0 << true;
761  QTest::newRow("take 7 from 4x8") << 4 << 8 << 7 << true;
762  QTest::newRow("take 8 from 4x8") << 4 << 8 << 8 << false;
763 }
764 
765 void tst_QStandardItem::takeColumn()
766 {
767  QFETCH(int, rows);
768  QFETCH(int, columns);
769  QFETCH(int, column);
770  QFETCH(bool, expectSuccess);
771 
772  QStandardItem item(rows, columns);
773  QList<QStandardItem*> originalChildren;
774  // initialize children
775  for (int i = 0; i < rows; ++i) {
776  for (int j = 0; j < columns; ++j) {
778  originalChildren.append(child);
779  item.setChild(i, j, child);
780  }
781  }
782 
783  QList<QStandardItem *> taken = item.takeColumn(column);
784  if (expectSuccess) {
785  QCOMPARE(taken.count(), item.rowCount());
786  QCOMPARE(item.columnCount(), columns - 1);
787  int index = column;
788  for (int i = 0; i < taken.count(); ++i) {
789  QCOMPARE(taken.at(i), originalChildren.takeAt(index));
790  index += item.columnCount();
791  }
792  index = 0;
793  for (int i = 0; i < item.rowCount(); ++i) {
794  for (int j = 0; j < item.columnCount(); ++j) {
795  QCOMPARE(item.child(i, j), originalChildren.at(index));
796  ++index;
797  }
798  }
799  } else {
800  QVERIFY(taken.isEmpty());
801  }
802  qDeleteAll(taken);
803 }
804 
805 void tst_QStandardItem::takeRow_data()
806 {
807  QTest::addColumn<int>("rows");
808  QTest::addColumn<int>("columns");
809  QTest::addColumn<int>("row");
810  QTest::addColumn<bool>("expectSuccess");
811 
812  QTest::newRow("take -1 from 0x0") << 0 << 0 << -1 << false;
813  QTest::newRow("take 0 from 0x0") << 0 << 0 << 0 << false;
814  QTest::newRow("take 0 from 1x0") << 1 << 0 << 0 << true;
815  QTest::newRow("take 0 from 0x1") << 0 << 1 << 0 << false;
816  QTest::newRow("take 1 from 0x1") << 0 << 1 << 1 << false;
817  QTest::newRow("take 0 from 1x1") << 1 << 1 << 0 << true;
818  QTest::newRow("take 1 from 1x1") << 0 << 1 << 1 << false;
819  QTest::newRow("take 0 from 1x4") << 1 << 4 << 0 << true;
820  QTest::newRow("take 1 from 1x4") << 1 << 4 << 1 << false;
821  QTest::newRow("take 0 from 8x4") << 8 << 4 << 0 << true;
822  QTest::newRow("take 7 from 8x4") << 8 << 4 << 7 << true;
823  QTest::newRow("take 8 from 8x4") << 8 << 4 << 8 << false;
824 }
825 
826 void tst_QStandardItem::takeRow()
827 {
828  QFETCH(int, rows);
829  QFETCH(int, columns);
830  QFETCH(int, row);
831  QFETCH(bool, expectSuccess);
832 
833  QStandardItem item(rows, columns);
834  QList<QStandardItem*> originalChildren;
835  // initialize children
836  for (int i = 0; i < rows; ++i) {
837  for (int j = 0; j < columns; ++j) {
839  originalChildren.append(child);
840  item.setChild(i, j, child);
841  }
842  }
843 
844  QList<QStandardItem *> taken = item.takeRow(row);
845  if (expectSuccess) {
846  QCOMPARE(taken.count(), item.columnCount());
847  QCOMPARE(item.rowCount(), rows - 1);
848  int index = row * columns;
849  for (int i = 0; i < taken.count(); ++i) {
850  QCOMPARE(taken.at(i), originalChildren.takeAt(index));
851  }
852  index = 0;
853  for (int i = 0; i < item.rowCount(); ++i) {
854  for (int j = 0; j < item.columnCount(); ++j) {
855  QCOMPARE(item.child(i, j), originalChildren.at(index));
856  ++index;
857  }
858  }
859  } else {
860  QVERIFY(taken.isEmpty());
861  }
862  qDeleteAll(taken);
863 }
864 
865 void tst_QStandardItem::streamItem()
866 {
868 
869  item.setText(QLatin1String("text"));
870  item.setToolTip(QLatin1String("toolTip"));
871  item.setStatusTip(QLatin1String("statusTip"));
872  item.setWhatsThis(QLatin1String("whatsThis"));
873  item.setSizeHint(QSize(64, 48));
874  item.setFont(QFont());
875  item.setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
876  item.setBackground(QColor(Qt::blue));
877  item.setForeground(QColor(Qt::green));
878  item.setCheckState(Qt::PartiallyChecked);
879  item.setAccessibleText(QLatin1String("accessibleText"));
880  item.setAccessibleDescription(QLatin1String("accessibleDescription"));
881 
882  QByteArray ba;
883  {
885  ds << item;
886  }
887  {
888  QStandardItem streamedItem;
890  ds >> streamedItem;
891  QCOMPARE(streamedItem.text(), item.text());
892  QCOMPARE(streamedItem.toolTip(), item.toolTip());
893  QCOMPARE(streamedItem.statusTip(), item.statusTip());
894  QCOMPARE(streamedItem.whatsThis(), item.whatsThis());
895  QCOMPARE(streamedItem.sizeHint(), item.sizeHint());
896  QCOMPARE(streamedItem.font(), item.font());
897  QCOMPARE(streamedItem.textAlignment(), item.textAlignment());
898  QCOMPARE(streamedItem.background(), item.background());
899  QCOMPARE(streamedItem.foreground(), item.foreground());
900  QCOMPARE(streamedItem.checkState(), item.checkState());
901  QCOMPARE(streamedItem.accessibleText(), item.accessibleText());
902  QCOMPARE(streamedItem.accessibleDescription(), item.accessibleDescription());
903  QCOMPARE(streamedItem.flags(), item.flags());
904  }
905 }
906 
907 void tst_QStandardItem::deleteItem()
908 {
910  // initialize items
911  for (int i = 0; i < model.rowCount(); ++i) {
912  for (int j = 0; j < model.columnCount(); ++j) {
914  model.setItem(i, j, item);
915  }
916  }
917  // delete items
918  for (int i = 0; i < model.rowCount(); ++i) {
919  for (int j = 0; j < model.columnCount(); ++j) {
920  QStandardItem *item = model.item(i, j);
921  delete item;
922  QCOMPARE(model.item(i, j), nullptr);
923  }
924  }
925 }
926 
927 void tst_QStandardItem::clone()
928 {
930  item.setText(QLatin1String("text"));
931  item.setToolTip(QLatin1String("toolTip"));
932  item.setStatusTip(QLatin1String("statusTip"));
933  item.setWhatsThis(QLatin1String("whatsThis"));
934  item.setSizeHint(QSize(64, 48));
935  item.setFont(QFont());
936  item.setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
937  item.setBackground(QColor(Qt::blue));
938  item.setForeground(QColor(Qt::green));
939  item.setCheckState(Qt::PartiallyChecked);
940  item.setAccessibleText(QLatin1String("accessibleText"));
941  item.setAccessibleDescription(QLatin1String("accessibleDescription"));
943 
944  QStandardItem *clone = item.clone();
945  QCOMPARE(clone->text(), item.text());
946  QCOMPARE(clone->toolTip(), item.toolTip());
947  QCOMPARE(clone->statusTip(), item.statusTip());
948  QCOMPARE(clone->whatsThis(), item.whatsThis());
949  QCOMPARE(clone->sizeHint(), item.sizeHint());
950  QCOMPARE(clone->font(), item.font());
951  QCOMPARE(clone->textAlignment(), item.textAlignment());
952  QCOMPARE(clone->background(), item.background());
953  QCOMPARE(clone->foreground(), item.foreground());
954  QCOMPARE(clone->checkState(), item.checkState());
955  QCOMPARE(clone->accessibleText(), item.accessibleText());
956  QCOMPARE(clone->accessibleDescription(), item.accessibleDescription());
957  QCOMPARE(clone->flags(), item.flags());
958  QVERIFY(!(*clone < item));
959  delete clone;
960 }
961 
962 void tst_QStandardItem::sortChildren()
963 {
964  for (int x = 0; x < 2; ++x) {
966  QStandardItem *item = (x == 0) ? new QStandardItem : model->invisibleRootItem();
967  QStandardItem *one = new QStandardItem;
968  one->appendRow(new QStandardItem(QLatin1String("a")));
969  one->appendRow(new QStandardItem(QLatin1String("b")));
970  one->appendRow(new QStandardItem(QLatin1String("c")));
971  QStandardItem *two = new QStandardItem;
972  two->appendRow(new QStandardItem(QLatin1String("f")));
973  two->appendRow(new QStandardItem(QLatin1String("d")));
974  two->appendRow(new QStandardItem(QLatin1String("e")));
975  item->appendRow(one);
976  item->appendRow(two);
977 
978  QSignalSpy layoutAboutToBeChangedSpy(
980  QSignalSpy layoutChangedSpy(
982 
984  // verify sorted
985  QCOMPARE(one->child(0)->text(), QLatin1String("c"));
986  QCOMPARE(one->child(1)->text(), QLatin1String("b"));
987  QCOMPARE(one->child(2)->text(), QLatin1String("a"));
988  // verify siblings unaffected
989  QCOMPARE(two->child(0)->text(), QLatin1String("f"));
990  QCOMPARE(two->child(1)->text(), QLatin1String("d"));
991  QCOMPARE(two->child(2)->text(), QLatin1String("e"));
992 
994  // verify sorted
995  QCOMPARE(two->child(0)->text(), QLatin1String("d"));
996  QCOMPARE(two->child(1)->text(), QLatin1String("e"));
997  QCOMPARE(two->child(2)->text(), QLatin1String("f"));
998  // verify siblings unaffected
999  QCOMPARE(one->child(0)->text(), QLatin1String("c"));
1000  QCOMPARE(one->child(1)->text(), QLatin1String("b"));
1001  QCOMPARE(one->child(2)->text(), QLatin1String("a"));
1002 
1003  item->sortChildren(0, Qt::AscendingOrder);
1004  // verify everything sorted
1005  QCOMPARE(one->child(0)->text(), QLatin1String("a"));
1006  QCOMPARE(one->child(1)->text(), QLatin1String("b"));
1007  QCOMPARE(one->child(2)->text(), QLatin1String("c"));
1008  QCOMPARE(two->child(0)->text(), QLatin1String("d"));
1009  QCOMPARE(two->child(1)->text(), QLatin1String("e"));
1010  QCOMPARE(two->child(2)->text(), QLatin1String("f"));
1011 
1012  QCOMPARE(layoutAboutToBeChangedSpy.count(), (x == 0) ? 0 : 3);
1013  QCOMPARE(layoutChangedSpy.count(), (x == 0) ? 0 : 3);
1014 
1015  if (x == 0)
1016  delete item;
1017  delete model;
1018  }
1019 }
1020 
1021 class CustomItem : public QStandardItem
1022 {
1023 public:
1025 
1026  int type() const override { return QStandardItem::UserType + 1; }
1027 
1028  bool operator<(const QStandardItem &other) const override {
1029  return text().length() < other.text().length();
1030  }
1031 
1032  using QStandardItem::clone;
1034 };
1035 
1037 
1038 void tst_QStandardItem::subclassing()
1039 {
1040  qMetaTypeId<QStandardItem*>();
1041 
1042  CustomItem *item = new CustomItem;
1043  QCOMPARE(item->type(), int(QStandardItem::UserType + 1));
1044 
1045  item->setText(QString::fromLatin1("foo"));
1046  QCOMPARE(item->text(), QString::fromLatin1("foo"));
1047 
1048  item->emitDataChanged(); // does nothing
1049 
1051  model.appendRow(item);
1052 
1054  item->emitDataChanged();
1055  QCOMPARE(itemChangedSpy.count(), 1);
1056  QCOMPARE(itemChangedSpy.at(0).count(), 1);
1057  QCOMPARE(qvariant_cast<QStandardItem*>(itemChangedSpy.at(0).at(0)), item);
1058 
1059  CustomItem *child0 = new CustomItem("cc");
1060  CustomItem *child1 = new CustomItem("bbb");
1061  CustomItem *child2 = new CustomItem("a");
1062  item->appendRow(child0);
1063  item->appendRow(child1);
1064  item->appendRow(child2);
1065  item->sortChildren(0);
1066  QCOMPARE(item->child(0), child2);
1067  QCOMPARE(item->child(1), child0);
1068  QCOMPARE(item->child(2), child1);
1069 }
1070 
1071 void tst_QStandardItem::lessThan()
1072 {
1073  QStandardItem stringA("A");
1074  QStandardItem stringB("B");
1075  QStandardItem invalid1;
1076  QStandardItem invalid2;
1077  QVERIFY(stringA < stringB);
1078  QVERIFY(!(stringB < stringA));
1079  // Items with invalid data go to the end.
1080  QVERIFY(stringA < invalid1);
1081  QVERIFY(!(invalid1 < stringA));
1082  QVERIFY(!(invalid1 < invalid2));
1083 }
1084 
1086 #include "tst_qstandarditem.moc"
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
bool operator<(const QStandardItem &other) const override
int type() const override
void layoutAboutToBeChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
void layoutChanged(const QList< QPersistentModelIndex > &parents=QList< QPersistentModelIndex >(), QAbstractItemModel::LayoutChangeHint hint=QAbstractItemModel::NoLayoutChangeHint)
The QBrush class defines the fill pattern of shapes drawn by QPainter.
Definition: qbrush.h:66
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition: qcolor.h:67
The QDataStream class provides serialization of binary data to a QIODevice.
Definition: qdatastream.h:66
The QFont class specifies a query for a font used for drawing text.
Definition: qfont.h:56
void setData(int key, const QVariant &value)
bool isEnabled() const
void setFlags(GraphicsItemFlags flags)
void setEnabled(bool enabled)
QVariant data(int key) const
virtual int type() const
GraphicsItemFlags flags() const
The QIcon class provides scalable icons in different modes and states.
Definition: qicon.h:56
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal.
Definition: qstring.h:84
bool isEmpty() const noexcept
Definition: qlist.h:418
T takeAt(qsizetype i)
Definition: qlist.h:607
const_reference at(qsizetype i) const noexcept
Definition: qlist.h:457
qsizetype count() const noexcept
Definition: qlist.h:415
void append(parameter_type t)
Definition: qlist.h:469
The QObject class is the base class of all Qt objects.
Definition: qobject.h:125
The QPixmap class is an off-screen image representation that can be used as a paint device.
Definition: qpixmap.h:63
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:55
int rowCount(const QModelIndex &parent=QModelIndex()) const override
int columnCount(const QModelIndex &parent=QModelIndex()) const override
The QStandardItem class provides an item for use with the QStandardItemModel class.
QStandardItem * child(int row, int column=0) const
Qt::ItemFlags flags() const
QString statusTip() const
QString accessibleDescription() const
void sortChildren(int column, Qt::SortOrder order=Qt::AscendingOrder)
QBrush background() const
QStandardItem * parent() const
QSize sizeHint() const
QString text() const
QFont font() const
Qt::CheckState checkState() const
QString accessibleText() const
Qt::Alignment textAlignment() const
QString toolTip() const
QBrush foreground() const
void appendRow(const QList< QStandardItem * > &items)
virtual QStandardItem * clone() const
The QStandardItemModel class provides a generic model for storing custom data.\inmodule QtGui.
void itemChanged(QStandardItem *item)
The QString class provides a Unicode character string.
Definition: qstring.h:388
static QString fromLatin1(QByteArrayView ba)
Definition: qstring.cpp:5488
static QString number(int, int base=10)
Definition: qstring.cpp:7538
qsizetype length() const
Definition: qstring.h:415
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:95
qDeleteAll(list.begin(), list.end())
QCOMPARE(spy.count(), 1)
union Alignment_ Alignment
QColor backgroundColor(const QPalette &pal, const QWidget *widget)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Definition: qtestcase.cpp:2658
CheckState
Definition: qnamespace.h:1495
@ Unchecked
Definition: qnamespace.h:1496
@ Checked
Definition: qnamespace.h:1498
@ PartiallyChecked
Definition: qnamespace.h:1497
@ AlignRight
Definition: qnamespace.h:171
@ AlignVCenter
Definition: qnamespace.h:180
@ AlignLeft
Definition: qnamespace.h:169
@ cyan
Definition: qnamespace.h:69
@ blue
Definition: qnamespace.h:68
@ yellow
Definition: qnamespace.h:71
@ green
Definition: qnamespace.h:67
@ red
Definition: qnamespace.h:66
@ AccessibleDescriptionRole
Definition: qnamespace.h:1516
@ AccessibleTextRole
Definition: qnamespace.h:1515
@ WhatsThisRole
Definition: qnamespace.h:1507
@ FontRole
Definition: qnamespace.h:1509
@ TextAlignmentRole
Definition: qnamespace.h:1510
@ ForegroundRole
Definition: qnamespace.h:1512
@ UserRole
Definition: qnamespace.h:1527
@ DecorationRole
Definition: qnamespace.h:1503
@ BackgroundRole
Definition: qnamespace.h:1511
@ EditRole
Definition: qnamespace.h:1504
@ CheckStateRole
Definition: qnamespace.h:1513
@ StatusTipRole
Definition: qnamespace.h:1506
@ ToolTipRole
Definition: qnamespace.h:1505
@ DisplayRole
Definition: qnamespace.h:1502
@ SizeHintRole
Definition: qnamespace.h:1518
@ DescendingOrder
Definition: qnamespace.h:148
@ AscendingOrder
Definition: qnamespace.h:147
@ ItemIsEditable
Definition: qnamespace.h:1533
@ ItemIsDragEnabled
Definition: qnamespace.h:1534
@ ItemIsUserTristate
Definition: qnamespace.h:1540
@ ItemIsUserCheckable
Definition: qnamespace.h:1536
@ ItemIsSelectable
Definition: qnamespace.h:1532
@ ItemIsEnabled
Definition: qnamespace.h:1537
@ ItemIsDropEnabled
Definition: qnamespace.h:1535
@ ItemIsAutoTristate
Definition: qnamespace.h:1538
@ text
#define Q_DECLARE_METATYPE(TYPE)
Definition: qmetatype.h:1417
GLint GLint GLint GLint GLint x
[0]
GLuint index
[2]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei void GLsizei void * column
Definition: qopenglext.h:2747
GLenum GLenum GLsizei void * row
Definition: qopenglext.h:2747
#define QStringLiteral(str)
#define QTEST_MAIN(TestObject)
Definition: qtest.h:664
#define QFETCH(Type, name)
Definition: qtestcase.h:230
#define QVERIFY(statement)
Definition: qtestcase.h:64
#define Q_OBJECT
Definition: qtmetamacros.h:158
#define slots
Definition: qtmetamacros.h:76
QSqlQueryModel * model
[16]
QIcon icon
[15]
QByteArray ba
[0]
QSharedPointer< T > other(t)
[5]
QGraphicsItem * item
QList< QTreeWidgetItem * > items
QLayoutItem * child
[0]
widget render & pixmap