summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qlinecontrol_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets/qlinecontrol_p.h')
-rw-r--r--src/gui/widgets/qlinecontrol_p.h33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h
index 44bd7214be..d4c4154b3d 100644
--- a/src/gui/widgets/qlinecontrol_p.h
+++ b/src/gui/widgets/qlinecontrol_p.h
@@ -65,6 +65,7 @@
#include "QtCore/qpoint.h"
#include "QtGui/qcompleter.h"
#include "QtGui/qaccessible.h"
+#include "QtCore/qthread.h"
#include "qplatformdefs.h"
@@ -90,6 +91,10 @@ public:
#ifdef QT_GUI_PASSWORD_ECHO_DELAY
, m_passwordEchoTimer(0)
#endif
+#if defined(Q_WS_MAC)
+ , m_threadChecks(false)
+ , m_textLayoutThread(0)
+ #endif
{
init(txt);
}
@@ -332,11 +337,27 @@ public:
bool processEvent(QEvent *ev);
- QTextLayout *textLayout()
+ QTextLayout *textLayout() const
{
+#if defined(Q_WS_MAC)
+ if (m_threadChecks && QThread::currentThread() != m_textLayoutThread)
+ redoTextLayout();
+#endif
return &m_textLayout;
}
+#if defined(Q_WS_MAC)
+ void setThreadChecks(bool threadChecks)
+ {
+ m_threadChecks = threadChecks;
+ }
+
+ bool threadChecks() const
+ {
+ return m_threadChecks;
+ }
+#endif
+
private:
void init(const QString &txt);
void removeSelectedText();
@@ -433,8 +454,8 @@ private:
QString stripString(const QString &str) const;
int findInMask(int pos, bool forward, bool findSeparator, QChar searchChar = QChar()) const;
- // complex text layout
- QTextLayout m_textLayout;
+ // complex text layout (must be mutable so it can be reshaped at will)
+ mutable QTextLayout m_textLayout;
bool m_passwordEchoEditing;
QChar m_passwordCharacter;
@@ -451,6 +472,12 @@ private:
#endif
}
+ int redoTextLayout() const;
+#if defined(Q_WS_MAC)
+ bool m_threadChecks;
+ mutable QThread *m_textLayoutThread;
+#endif
+
Q_SIGNALS:
void cursorPositionChanged(int, int);
void selectionChanged();