workaround for Qt bug in contentsChange signal params, see https://bugreports.qt.io/browse/QTBUG-49062

This commit is contained in:
John Preston 2015-10-27 19:48:41 -04:00
parent 8f6be1c6ac
commit ad21781c7c
2 changed files with 28 additions and 12 deletions

12
MSVC.md
View File

@ -16,7 +16,7 @@ or download in ZIP and extract to **D:\TBuild\**, rename **tdesktop-master** to
####OpenSSL
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder), go to **D:\\TBuild\\Libraries** and run
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\\TBuild\\Libraries** and run
git clone https://github.com/openssl/openssl.git
cd openssl
@ -89,7 +89,7 @@ or download in ZIP and extract to **D:\TBuild\Libraries\**, rename **libexif-0.6
####OpenAL Soft, slightly patched
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder), go to **D:\\TBuild\\Libraries** and run
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\\TBuild\\Libraries** and run
git clone git://repo.or.cz/openal-soft.git
git checkout 90349b38
@ -98,7 +98,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Fi
#####Building library
* Install [CMake](http://www.cmake.org/)
* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder), go to **D:\TBuild\Libraries\openal-soft\build\** and run
* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\TBuild\Libraries\openal-soft\build\** and run
cmake -G "Visual Studio 14 2015" -D LIBTYPE:STRING=STATIC -D FORCE_STATIC_VCRT:STRING=ON ..
@ -120,7 +120,7 @@ to have **D:\TBuild\Libraries\opus\win32**
####FFmpeg
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder) and run
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder) and run
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
@ -132,7 +132,7 @@ http://msys2.github.io/ > Download [msys2-x86_64-20150512.exe](http://sourceforg
Download [yasm for Win64](http://www.tortall.net/projects/yasm/releases/yasm-1.3.0-win64.exe) from http://yasm.tortall.net/Download.html, rename **yasm-1.3.0-win64.exe** to **yasm.exe** and place it to your Visual C++ **bin** directory, like **\\Program Files (x86)\\Microsoft Visual Studio 14\\VC\\bin\\**
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder), go to **D:\\msys64\\** and launch **msys2_shell.bat**, there run
Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder), go to **D:\\msys64\\** and launch **msys2_shell.bat**, there run
PATH="/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN:$PATH"
@ -153,7 +153,7 @@ Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Fi
####Qt 5.5.1, slightly patched
* Install Python 3.3.2 from https://www.python.org/download/releases/3.3.2 > [**Windows x86 MSI Installer (3.3.2)**](https://www.python.org/ftp/python/3.3.2/python-3.3.2.msi)
* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **\\Program Files (x86)\\Microsoft Visual Studio 14.0\\Common7\\Tools\\Shortcuts\\** folder)
* Open **VS2015 x86 Native Tools Command Prompt.bat** (should be in **Start Menu > Programs > Visual Studio 2015** menu folder)
There go to Libraries directory

View File

@ -970,9 +970,17 @@ void InputArea::onDocumentContentsChange(int position, int charsRemoved, int cha
QString oldtext(_oldtext);
QTextCursor(_inner.document()->docHandle(), 0).joinPreviousEditBlock();
QTextCursor c(_inner.document()->docHandle(), 0);
c.movePosition(QTextCursor::End);
int pos = c.position();
if (!position) { // Qt bug workaround https://bugreports.qt.io/browse/QTBUG-49062
QTextCursor c(_inner.document()->docHandle(), 0);
c.movePosition(QTextCursor::End);
if (position + charsAdded > c.position()) {
int32 toSubstract = position + charsAdded - c.position();
if (charsRemoved >= toSubstract) {
charsAdded -= toSubstract;
charsRemoved -= toSubstract;
}
}
}
_correcting = true;
if (_maxLength >= 0) {
@ -1645,9 +1653,17 @@ void InputField::onDocumentContentsChange(int position, int charsRemoved, int ch
QString oldtext(_oldtext);
QTextCursor(_inner.document()->docHandle(), 0).joinPreviousEditBlock();
QTextCursor c(_inner.document()->docHandle(), 0);
c.movePosition(QTextCursor::End);
int pos = c.position();
if (!position) { // Qt bug workaround https://bugreports.qt.io/browse/QTBUG-49062
QTextCursor c(_inner.document()->docHandle(), 0);
c.movePosition(QTextCursor::End);
if (position + charsAdded > c.position()) {
int32 toSubstract = position + charsAdded - c.position();
if (charsRemoved >= toSubstract) {
charsAdded -= toSubstract;
charsRemoved -= toSubstract;
}
}
}
_correcting = true;
if (_maxLength >= 0) {