MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / setModel

Method setModel

src/qt/transactionview.cpp:199–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void TransactionView::setModel(WalletModel *_model)
200{
201 this->model = _model;
202 if(_model)
203 {
204 transactionProxyModel = new TransactionFilterProxy(this);
205 transactionProxyModel->setSourceModel(_model->getTransactionTableModel());
206 transactionProxyModel->setDynamicSortFilter(true);
207 transactionProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
208 transactionProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
209 transactionProxyModel->setSortRole(Qt::EditRole);
210 transactionView->setModel(transactionProxyModel);
211 transactionView->sortByColumn(TransactionTableModel::Date, Qt::DescendingOrder);
212
213 if (_model->getOptionsModel())
214 {
215 // Add third party transaction URLs to context menu
216 QStringList listUrls = _model->getOptionsModel()->getThirdPartyTxUrls().split("|", Qt::SkipEmptyParts);
217 bool actions_created = false;
218 for (int i = 0; i < listUrls.size(); ++i)
219 {
220 QString url = listUrls[i].trimmed();
221 QString host = QUrl(url, QUrl::StrictMode).host();
222 if (!host.isEmpty())
223 {
224 if (!actions_created) {
225 contextMenu->addSeparator();
226 actions_created = true;
227 }
228 /*: Transactions table context menu action to show the
229 selected transaction in a third-party block explorer.
230 %1 is a stand-in argument for the URL of the explorer. */
231 contextMenu->addAction(tr("Show in %1").arg(host), [this, url] { openThirdPartyTxUrl(url); });
232 }
233 }
234 }
235 }
236}
237
238void TransactionView::changeEvent(QEvent* e)
239{

Callers 2

exportClickedMethod · 0.45
editLabelMethod · 0.45

Calls 5

getThirdPartyTxUrlsMethod · 0.80
QUrlClass · 0.70
getOptionsModelMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected