Merge #16707: qt: Remove obsolete QModelIndex::child()

c53667764e qt: Remove obsolete QModelIndex::child() (Hennadii Stepanov)

Pull request description:

  The `QModelIndex::child()` member function is [obsolete](https://doc.qt.io/qt-5.12/qmodelindex-obsolete.html) since Qt 5.12.

  This PR removes it, does not change behavior and keeps compatibility with [Qt 5.5.1](https://github.com/bitcoin/bitcoin/pull/15393).

  Here is an excerpt from the master build log:
  ```
  qt/receivecoinsdialog.cpp: In member function ‘void ReceiveCoinsDialog::copyColumnToClipboard(int)’:
  qt/receivecoinsdialog.cpp:264:111: warning: ‘QModelIndex QModelIndex::child(int, int) const’ is deprecated: Use QAbstractItemModel::index [-Wdeprecated-declarations]
       GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString());
                                                                                                                 ^
  In file included from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qabstractitemview.h:45:0,
                   from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/qheaderview.h:44,
                   from /home/hebasto/Qt/5.13.0/gcc_64/include/QtWidgets/QHeaderView:1,
                   from ./qt/guiutil.h:12,
                   from ./qt/receivecoinsdialog.h:8,
                   from qt/receivecoinsdialog.cpp:7:
  /home/hebasto/Qt/5.13.0/gcc_64/include/QtCore/qabstractitemmodel.h:457:20: note: declared here
   inline QModelIndex QModelIndex::child(int arow, int acolumn) const
                      ^~~~~~~~~~~
  ```

ACKs for top commit:
  laanwj:
    Code review ACK c53667764e
  promag:
    ACK c53667764e, just read the change.
  jonasschnelli:
    utACK c53667764e

Tree-SHA512: 99fcb6ff60a6d47b925bda9f14006269eaad09ba4f7a41ac4975c6cf04bd906b58aed721cbfa0be7da8e6613d92e30d4be18b7e4d3960f026c7226558a4c3196
This commit is contained in:
Jonas Schnelli 2019-08-29 18:35:53 +02:00
commit bcf7004a89
No known key found for this signature in database
GPG key ID: 1EB776BB03C7922D
2 changed files with 2 additions and 2 deletions

View file

@ -261,7 +261,7 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column)
if (!firstIndex.isValid()) { if (!firstIndex.isValid()) {
return; return;
} }
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString()); GUIUtil::setClipboard(model->getRecentRequestsTableModel()->index(firstIndex.row(), column).data(Qt::EditRole).toString());
} }
// context menu // context menu

View file

@ -76,7 +76,7 @@ public:
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const;
bool setData(const QModelIndex &index, const QVariant &value, int role); bool setData(const QModelIndex &index, const QVariant &value, int role);
QVariant headerData(int section, Qt::Orientation orientation, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const;
/*@}*/ /*@}*/