summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp5
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.cpp1
-rw-r--r--src/corelib/itemmodels/qsortfilterproxymodel.h4
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp4
-rw-r--r--src/corelib/thread/qthread_p.h3
-rw-r--r--src/corelib/thread/qthread_win.cpp35
6 files changed, 47 insertions, 5 deletions
diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
index 28c66628b7..b5d8320bce 100644
--- a/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
+++ b/src/corelib/doc/snippets/code/src_corelib_tools_qregularexpression.cpp
@@ -353,7 +353,10 @@ while (i.hasNext()) {
{
//! [31]
QString wildcard = QRegularExpression::wildcardToRegularExpression("*.jpeg");
-// wilcard == ".*\.jpeg"
+// Will match files with names like:
+// foo.jpeg
+// f_o_o.jpeg
+// föö.jpeg
//! [31]
}
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
index 5d1a916df0..2ae4e4d5ee 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp
@@ -2731,6 +2731,7 @@ void QSortFilterProxyModel::setFilterRegExp(const QString &pattern)
Q_D(QSortFilterProxyModel);
d->filter_about_to_be_changed();
QRegExp rx(pattern);
+ rx.setCaseSensitivity(d->filter_data.caseSensitivity());
d->filter_data.setRegExp(rx);
d->filter_changed();
}
diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.h b/src/corelib/itemmodels/qsortfilterproxymodel.h
index 1304a95d13..0be8b88672 100644
--- a/src/corelib/itemmodels/qsortfilterproxymodel.h
+++ b/src/corelib/itemmodels/qsortfilterproxymodel.h
@@ -88,11 +88,9 @@ public:
QItemSelection mapSelectionFromSource(const QItemSelection &sourceSelection) const override;
QRegExp filterRegExp() const;
- void setFilterRegExp(const QRegExp &regExp);
#if QT_CONFIG(regularexpression)
QRegularExpression filterRegularExpression() const;
- void setFilterRegularExpression(const QRegularExpression &regularExpression);
#endif
int filterKeyColumn() const;
@@ -124,8 +122,10 @@ public:
public Q_SLOTS:
void setFilterRegExp(const QString &pattern);
+ void setFilterRegExp(const QRegExp &regExp);
#if QT_CONFIG(regularexpression)
void setFilterRegularExpression(const QString &pattern);
+ void setFilterRegularExpression(const QRegularExpression &regularExpression);
#endif
void setFilterWildcard(const QString &pattern);
void setFilterFixedString(const QString &pattern);
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 1350a7aa94..463e30e1c3 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -482,6 +482,10 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
qFatal("FATAL: The application binary appears to be running setuid, this is a security hole.");
# endif // Q_OS_UNIX
+#ifdef Q_OS_WINRT
+ QThreadData::setMainThread();
+#endif
+
QThread *cur = QThread::currentThread(); // note: this may end up setting theMainThread!
if (cur != theMainThread)
qWarning("WARNING: QApplication was not created in the main() thread.");
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 64e3f33191..7d9442ab79 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -243,6 +243,9 @@ public:
~QThreadData();
static Q_AUTOTEST_EXPORT QThreadData *current(bool createIfNecessary = true);
+#ifdef Q_OS_WINRT
+ static void setMainThread();
+#endif
static void clearCurrentThreadData();
static QThreadData *get2(QThread *thread)
{ Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; }
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index eebaf90d9b..e04d27d7b6 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -140,11 +140,15 @@ QThreadData *QThreadData::current(bool createIfNecessary)
threadData->isAdopted = true;
threadData->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
+#ifndef Q_OS_WINRT
if (!QCoreApplicationPrivate::theMainThread) {
QCoreApplicationPrivate::theMainThread = threadData->thread.load();
- // TODO: is there a way to reflect the branch's behavior using
- // WinRT API?
} else {
+#else
+ // for winrt the main thread is set explicitly in QCoreApplication's constructor as the
+ // native main thread (Xaml thread) is not Qt's main thread.
+ {
+#endif
HANDLE realHandle = INVALID_HANDLE_VALUE;
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
@@ -159,6 +163,33 @@ QThreadData *QThreadData::current(bool createIfNecessary)
return threadData;
}
+#ifdef Q_OS_WINRT
+void QThreadData::setMainThread()
+{
+ Q_ASSERT(!QCoreApplicationPrivate::theMainThread);
+ qt_create_tls();
+ QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index));
+ if (!threadData) {
+ threadData = new QThreadData;
+ // This needs to be called prior to new AdoptedThread() to
+ // avoid recursion.
+ TlsSetValue(qt_current_thread_data_tls_index, threadData);
+ QT_TRY {
+ threadData->thread = new QAdoptedThread(threadData);
+ } QT_CATCH(...) {
+ TlsSetValue(qt_current_thread_data_tls_index, 0);
+ threadData->deref();
+ threadData = 0;
+ QT_RETHROW;
+ }
+ threadData->deref();
+ threadData->isAdopted = true;
+ threadData->threadId.store(reinterpret_cast<Qt::HANDLE>(quintptr(GetCurrentThreadId())));
+ }
+ QCoreApplicationPrivate::theMainThread = threadData->thread.load();
+}
+#endif
+
void QAdoptedThread::init()
{
d_func()->handle = GetCurrentThread();