MCPcopy Create free account
hub / github.com/MrKepzie/Natron / selectUrl

Method selectUrl

Gui/SequenceFileDialog.cpp:2402–2435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2400}
2401
2402void
2403FavoriteView::selectUrl(const QUrl &url)
2404{
2405 disconnect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
2406 this, SLOT(clicked(QModelIndex)) );
2407
2408 selectionModel()->clear();
2409
2410 QString urlPath = url.toLocalFile();
2411 // On windows url.path() will return something starting with a /
2412#ifdef __NATRON_WIN32__
2413 if ( urlPath.startsWith( QLatin1Char('/') ) ) {
2414 urlPath.remove(0, 1);
2415 }
2416#endif
2417
2418 for (int i = 0; i < model()->rowCount(); ++i) {
2419 QString otherUrlPath = model()->index(i, 0).data(UrlModel::UrlRole).toUrl().toLocalFile();
2420 // On windows url.path() will return something starting with a /
2421#ifdef __NATRON_WIN32__
2422 if ( otherUrlPath.startsWith( QLatin1Char('/') ) ) {
2423 otherUrlPath.remove(0, 1);
2424 }
2425#endif
2426
2427 if (otherUrlPath == urlPath) {
2428 selectionModel()->select(model()->index(i, 0), QItemSelectionModel::Select);
2429 break;
2430 }
2431 }
2432
2433 connect( selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
2434 this, SLOT(clicked(QModelIndex)) );
2435}
2436
2437void
2438FavoriteView::removeEntry()

Callers 1

pathChangedMethod · 0.80

Calls 6

removeMethod · 0.80
clearMethod · 0.45
rowCountMethod · 0.45
dataMethod · 0.45
indexMethod · 0.45
selectMethod · 0.45

Tested by

no test coverage detected