wintab support option with customized qt
This commit is contained in:
parent
975f98c639
commit
8ae3e5c25d
8 changed files with 112 additions and 17 deletions
74
stuff/doc/LICENSE/notice_about_modified_qt.txt
Normal file
74
stuff/doc/LICENSE/notice_about_modified_qt.txt
Normal file
|
@ -0,0 +1,74 @@
|
|||
## Notice about modified Qt
|
||||
|
||||
If you are using Windows version of OpenToonz installed from the installer
|
||||
provided from OpenToonz website (https://opentoonz.github.io/), Qt libraries
|
||||
distributed with the software may be our customized version.
|
||||
The other OS versions (macOS, Linux) are not the case.
|
||||
|
||||
|
||||
### To check whether the Qt libraries are customized.
|
||||
|
||||
- Launch OpenToonz.
|
||||
- Open Preferences.
|
||||
- Check if there is a checkbox "Use Qt's Native Windows Ink Support" in the
|
||||
"Touch / Tablet Settings" category.
|
||||
|
||||
If the option exists, Qt libraries are customized version (Qt 5.15.2 with WinTab support).
|
||||
|
||||
----------
|
||||
|
||||
## About Qt 5.15.2 with WinTab support
|
||||
|
||||
This version is made based on v5.15.2 with cherry-picking the following commit
|
||||
to the qtbase module, in order to make it enable to use WinTab API in Qt 5.15.2:
|
||||
|
||||
commit id: [4c4693cf964e9d7370c27a26e1d263a262aee568](https://github.com/shun-iwasawa/qtbase/commit/4c4693cf964e9d7370c27a26e1d263a262aee568)
|
||||
commit title: Windows: Provide a way to switch between WinTab and Windows Ink at run-time
|
||||
|
||||
|
||||
### Source Code
|
||||
|
||||
You can find the source code tree to build this package and track the modification here:
|
||||
https://github.com/shun-iwasawa/qt5/tree/v5.15.2_wintab
|
||||
|
||||
|
||||
### Build Configurations
|
||||
|
||||
The attached package is built by the following command lines:
|
||||
```
|
||||
> configure -debug-and-release -opensource -confirm-license -prefix ../build -make libs -no-pch -openssl OPENSSL_PREFIX="path\to\OpenSSL-Win64" -opengl dynamic
|
||||
|
||||
> jom -j4
|
||||
|
||||
> jom module-qtscript -j4
|
||||
|
||||
> jom install
|
||||
```
|
||||
|
||||
|
||||
### Dependent Libraries
|
||||
|
||||
The attached package is built by using the following libraries / softwares.
|
||||
|
||||
- OpenSSL Toolkit 1.1.1j
|
||||
[Binary package from Shining Light Productions](https://slproweb.com/products/Win32OpenSSL.html)
|
||||
- Perl
|
||||
[ActivePerl 5.28](https://www.activestate.com/products/perl/downloads/)
|
||||
- [Python 2.7.18](https://www.python.org/downloads/release/python-2718/)
|
||||
- [Ruby 2.7.2-1 (x64)](https://rubyinstaller.org/downloads/)
|
||||
- ANGLE : already included in the repository.
|
||||
- Microsoft Visual Studio Community 2019
|
||||
- [jom](https://wiki.qt.io/Jom)
|
||||
- ICU : Not used.
|
||||
|
||||
|
||||
#### Reference:
|
||||
|
||||
- [Qt for Windows - Requirements](https://doc.qt.io/qt-5/windows-requirements.html)
|
||||
- [Qt for Windows - Building from Source](https://doc.qt.io/qt-5/windows-building.html)
|
||||
|
||||
|
||||
----------
|
||||
March 26, 2021
|
||||
Shun Iwasawa, OpenToonz team
|
||||
|
|
@ -104,6 +104,7 @@ option(WITH_SYSTEM_SUPERLU "Use the system SuperLU library instead of 'thirdpary
|
|||
option(WITH_CANON "Build with Canon DSLR support - Requires Canon SDK" OFF)
|
||||
option(WITH_TRANSLATION "Generate translation projects as well" ON)
|
||||
option(WITH_CRASHRPT "Build CrashRpt support - Requires CrashRpt Library" OFF)
|
||||
option(WITH_WINTAB "(Windows only) Build with customized Qt with WinTab support. https://github.com/shun-iwasawa/qt5/releases/tag/v5.15.2_wintab" OFF)
|
||||
|
||||
# avoid using again
|
||||
option_defaults_clear()
|
||||
|
@ -128,19 +129,7 @@ endif()
|
|||
message(STATUS "Thirdpary Library Search path:" ${THIRDPARTY_LIBS_HINTS})
|
||||
|
||||
if(BUILD_ENV_MSVC)
|
||||
if(MSVC_VERSION GREATER 1800)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(QT_PATH "C:/Qt/5.9.2/msvc2015" CACHE PATH "Qt installation directory")
|
||||
else()
|
||||
set(QT_PATH "C:/Qt/5.9.2/msvc2015_64" CACHE PATH "Qt installation directory")
|
||||
endif()
|
||||
else()
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
set(QT_PATH "C:/Qt/5.9.2/msvc2013" CACHE PATH "Qt installation directory")
|
||||
else()
|
||||
set(QT_PATH "C:/Qt/5.9.2/msvc2013_64" CACHE PATH "Qt installation directory")
|
||||
endif()
|
||||
endif()
|
||||
set(QT_PATH "C:/Qt/5.15.2/msvc2019${PLATFORM2}" CACHE PATH "Qt installation directory")
|
||||
if(NOT EXISTS ${QT_PATH})
|
||||
message("Specify QT_PATH properly")
|
||||
return()
|
||||
|
|
|
@ -483,6 +483,9 @@ public:
|
|||
|
||||
// Tablet tab
|
||||
bool isWinInkEnabled() const { return getBoolValue(winInkEnabled); }
|
||||
bool isQtNativeWinInkEnabled() const {
|
||||
return getBoolValue(useQtNativeWinInk);
|
||||
}
|
||||
|
||||
// Others (not appeared in the popup)
|
||||
// Shortcut popup settings
|
||||
|
|
|
@ -183,6 +183,8 @@ enum PreferencesItemId {
|
|||
// TounchGestureControl // Touch Gesture is a checkable command and not in
|
||||
// preferences.ini
|
||||
winInkEnabled,
|
||||
// This option will be shown & available only when WITH_WINTAB is defined
|
||||
useQtNativeWinInk,
|
||||
|
||||
//----------
|
||||
// Others (not appeared in the popup)
|
||||
|
|
|
@ -432,6 +432,10 @@ if (WITH_CRASHRPT)
|
|||
add_definitions(-DWITH_CRASHRPT)
|
||||
endif()
|
||||
|
||||
if (WITH_WINTAB AND BUILD_TARGET_WIN AND (PLATFORM EQUAL 64))
|
||||
add_definitions(-DWITH_WINTAB)
|
||||
endif()
|
||||
|
||||
if(BUILD_ENV_APPLE)
|
||||
include_directories(
|
||||
../../sources/mousedragfilter
|
||||
|
|
|
@ -373,8 +373,9 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
#ifdef Q_OS_WIN
|
||||
// Since currently Tahoma does not work with OpenGL of software or
|
||||
// angle,
|
||||
// force Qt to use desktop OpenGL
|
||||
// angle, force Qt to use desktop OpenGL
|
||||
// FIXME: This options should be called before constructing the application.
|
||||
// Thus, ANGLE seems to be enabled as of now.
|
||||
a.setAttribute(Qt::AA_UseDesktopOpenGL, true);
|
||||
#endif
|
||||
|
||||
|
@ -733,6 +734,19 @@ int main(int argc, char *argv[]) {
|
|||
QWindowsWindowFunctions::setHasBorderInFullScreen(w.windowHandle(), true);
|
||||
#endif
|
||||
|
||||
// Qt have started to support Windows Ink from 5.12.
|
||||
// Unlike WinTab API used in Qt 5.9 the tablet behaviors are different and
|
||||
// are (at least, for OT) problematic. The customized Qt5.15.2 are made with
|
||||
// cherry-picking the WinTab feature to be officially introduced from 6.0.
|
||||
// See https://github.com/shun-iwasawa/qt5/releases/tag/v5.15.2_wintab for
|
||||
// details. The following feature can only be used with the customized Qt,
|
||||
// with WITH_WINTAB build option, and in Windows-x64 build.
|
||||
|
||||
#ifdef WITH_WINTAB
|
||||
bool useQtNativeWinInk = Preferences::instance()->isQtNativeWinInkEnabled();
|
||||
QWindowsWindowFunctions::setWinTabEnabled(!useQtNativeWinInk);
|
||||
#endif
|
||||
|
||||
splash.showMessage(offsetStr + "Loading style sheet...",
|
||||
Qt::AlignRight | Qt::AlignBottom, Qt::black);
|
||||
a.processEvents();
|
||||
|
|
|
@ -1165,7 +1165,11 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
|
|||
// Touch / Tablet Settings
|
||||
// TounchGestureControl // Touch Gesture is a checkable command and not in
|
||||
// preferences.ini
|
||||
{winInkEnabled, tr("Enable Windows Ink Support* (EXPERIMENTAL)")}};
|
||||
{winInkEnabled, tr("Enable Windows Ink Support* (EXPERIMENTAL)")},
|
||||
{useQtNativeWinInk,
|
||||
tr("Use Qt's Native Windows Ink Support*\n(CAUTION: This options is for "
|
||||
"maintenance purpose. \n Do not activate this option or the tablet "
|
||||
"won't work properly.)")}};
|
||||
|
||||
return uiStringTable.value(id, QString());
|
||||
}
|
||||
|
@ -1949,6 +1953,9 @@ QWidget* PreferencesPopup::createTouchTabletPage() {
|
|||
|
||||
lay->addWidget(enableTouchGestures, 0, 0, 1, 2);
|
||||
if (winInkAvailable) insertUI(winInkEnabled, lay);
|
||||
#ifdef WITH_WINTAB
|
||||
insertUI(useQtNativeWinInk, lay);
|
||||
#endif
|
||||
|
||||
lay->setRowStretch(lay->rowCount(), 1);
|
||||
if (winInkAvailable) insertFootNote(lay);
|
||||
|
|
|
@ -639,6 +639,8 @@ void Preferences::definePreferenceItems() {
|
|||
// TounchGestureControl // Touch Gesture is a checkable command and not in
|
||||
// preferences.ini
|
||||
define(winInkEnabled, "winInkEnabled", QMetaType::Bool, false);
|
||||
// This option will be shown & available only when WITH_WINTAB is defined
|
||||
define(useQtNativeWinInk, "useQtNativeWinInk", QMetaType::Bool, false);
|
||||
|
||||
// Others (not appeared in the popup)
|
||||
// Shortcut popup settings
|
||||
|
|
Loading…
Reference in a new issue