Fix QFileSelectorPrivate::addStatics()
It must clear the previously cached sharedData->staticSelectors, or else QFileSelectorPrivate::updateSelectors() does nothing and the newly added static selectors end up being ignored. Change-Id: If6997664629199be9f00de64c5dd01de2bf0a044 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
This commit is contained in:
parent
10742cf894
commit
5be4f95d95
@ -396,6 +396,7 @@ void QFileSelectorPrivate::addStatics(const QStringList &statics)
|
||||
{
|
||||
QMutexLocker locker(&sharedDataMutex);
|
||||
sharedData->preloadedStatics << statics;
|
||||
sharedData->staticSelectors.clear();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -55,6 +55,8 @@ private slots:
|
||||
|
||||
void urlConvenience_data();
|
||||
void urlConvenience();
|
||||
|
||||
void addStatics();
|
||||
};
|
||||
|
||||
void tst_QFileSelector::basicTest_data()
|
||||
@ -224,5 +226,14 @@ void tst_QFileSelector::urlConvenience()
|
||||
QCOMPARE(fs.select(testUrl), expectedUrl);
|
||||
}
|
||||
|
||||
void tst_QFileSelector::addStatics()
|
||||
{
|
||||
QFileSelector fs;
|
||||
QCOMPARE(fs.select(QStringLiteral(":/extras/test")), QStringLiteral(":/extras/test"));
|
||||
|
||||
QFileSelectorPrivate::addStatics(QStringList() << QStringLiteral("custom1"));
|
||||
QCOMPARE(fs.select(QStringLiteral(":/extras/test")), QStringLiteral(":/extras/+custom1/test"));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QFileSelector)
|
||||
#include "tst_qfileselector.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user