Skip to content

Commit bcf7004

Browse files
committed
Merge #16707: qt: Remove obsolete QModelIndex::child()
c536677 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](bitcoin/bitcoin#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 c536677 promag: ACK c536677, just read the change. jonasschnelli: utACK c536677 Tree-SHA512: 99fcb6ff60a6d47b925bda9f14006269eaad09ba4f7a41ac4975c6cf04bd906b58aed721cbfa0be7da8e6613d92e30d4be18b7e4d3960f026c7226558a4c3196
2 parents d8fc997 + c536677 commit bcf7004

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/qt/receivecoinsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column)
261261
if (!firstIndex.isValid()) {
262262
return;
263263
}
264-
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString());
264+
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->index(firstIndex.row(), column).data(Qt::EditRole).toString());
265265
}
266266

267267
// context menu

src/qt/recentrequeststablemodel.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class RecentRequestsTableModel: public QAbstractTableModel
7676
QVariant data(const QModelIndex &index, int role) const;
7777
bool setData(const QModelIndex &index, const QVariant &value, int role);
7878
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
79-
QModelIndex index(int row, int column, const QModelIndex &parent) const;
79+
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
8080
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
8181
Qt::ItemFlags flags(const QModelIndex &index) const;
8282
/*@}*/

0 commit comments

Comments
 (0)