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

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20190824-qmodelindex-child changing 2 files +2 −2
  1. hebasto commented at 9:39 AM on August 24, 2019: member

    The QModelIndex::child() member function is obsolete since Qt 5.12.

    This PR removes it, does not change behavior and keeps compatibility with Qt 5.5.1.

    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
                        ^~~~~~~~~~~
    
  2. fanquake added the label GUI on Aug 24, 2019
  3. DrahtBot commented at 10:14 AM on August 24, 2019: member

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #16710 (build: Enable -Wsuggest-override if available by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  4. in src/qt/recentrequeststablemodel.cpp:128 in 45c6f3c3d5 outdated
     124 | @@ -125,7 +125,7 @@ QString RecentRequestsTableModel::getAmountTitle()
     125 |      return (this->walletModel->getOptionsModel() != nullptr) ? tr("Requested") + " ("+BitcoinUnits::shortName(this->walletModel->getOptionsModel()->getDisplayUnit()) + ")" : "";
     126 |  }
     127 |  
     128 | -QModelIndex RecentRequestsTableModel::index(int row, int column, const QModelIndex &parent) const
    


    promag commented at 12:20 AM on August 25, 2019:

    nit, drop unnecessary change?


    hebasto commented at 5:34 AM on August 25, 2019:

    Done.

  5. in src/qt/receivecoinsdialog.cpp:266 in 45c6f3c3d5 outdated
     260 | @@ -261,7 +261,9 @@ void ReceiveCoinsDialog::copyColumnToClipboard(int column)
     261 |      if (!firstIndex.isValid()) {
     262 |          return;
     263 |      }
     264 | -    GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString());
     265 | +
     266 | +    const RecentRequestsTableModel* const submodel = model->getRecentRequestsTableModel();
     267 | +    GUIUtil::setClipboard(submodel->data(submodel->index(firstIndex.row(), column), Qt::EditRole).toString());
    


    promag commented at 12:26 AM on August 25, 2019:

    I think you could do

     GUIUtil::setClipboard(model->getRecentRequestsTableModel()->index(firstIndex.row(), column).data(Qt::EditRole).toString());
    

    hebasto commented at 5:34 AM on August 25, 2019:

    Done.

  6. promag commented at 12:27 AM on August 25, 2019: member

    Concept ACK.

  7. qt: Remove obsolete QModelIndex::child()
    The QModelIndex::child() member function is obsolete since Qt 5.12.
    c53667764e
  8. hebasto force-pushed on Aug 25, 2019
  9. hebasto commented at 5:35 AM on August 25, 2019: member

    @promag Thank you for your review. All your comments have been addressed.

  10. laanwj commented at 2:03 PM on August 29, 2019: member

    Code review ACK c53667764ea65c0f8661358759b0124f808ce587

  11. promag commented at 2:06 PM on August 29, 2019: member

    ACK c53667764ea65c0f8661358759b0124f808ce587, just read the change.

  12. jonasschnelli approved
  13. jonasschnelli commented at 4:35 PM on August 29, 2019: contributor

    utACK c53667764ea65c0f8661358759b0124f808ce587

  14. jonasschnelli referenced this in commit bcf7004a89 on Aug 29, 2019
  15. jonasschnelli merged this on Aug 29, 2019
  16. jonasschnelli closed this on Aug 29, 2019

  17. hebasto deleted the branch on Aug 29, 2019
  18. sidhujag referenced this in commit 718fc65a25 on Aug 29, 2019
  19. deadalnix referenced this in commit 5bd3474905 on Feb 29, 2020
  20. ftrader referenced this in commit 9149f81631 on Apr 16, 2020
  21. kittywhiskers referenced this in commit d1d75210e5 on Nov 3, 2021
  22. kittywhiskers referenced this in commit 1c77b0eb0a on Nov 11, 2021
  23. pravblockc referenced this in commit cd6c0440c8 on Nov 18, 2021
  24. DrahtBot locked this on Dec 16, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-15 15:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me