[texworks] Qt5 support

Vladimir Lomov lomov.vl at gmail.com
Fri Jan 9 12:53:07 CET 2015

** Stefan Löffler [2015-01-09 08:39:32 +0100]:

> Hi,
> thanks a lot for the effort.
> On 08.01.2015 11:10, Vladimir Lomov wrote:
>> Ok, it was interesting experience to use CMake as "config" system
>> instead of .pro file. I made new patches, one to make possible to
>> compile vs. Qt5 (qt5.patch)
> This one puzzles me a bit. I compiled with Qt 5.1 and Qt 5.3.2, and it
> worked fine without the patch in both cases. In fact, the Qt 5.4
> documentation (http://doc.qt.io/qt-5/qapplication.html) also claims that
> is enough to write #include <QApplication>, provided the build system is
> set up correctly (in which case the QtWidgets subdirectory should be in
> the list of include directories). The same thing applies to QAction,
> QMainWindow, QMessageBox,.... I would have assumed that this is a
> problem with the CMake configuration, but apparently you had the same
> issue with qmake, which might hint either at a Qt bug, or at an issue of
> both systems picking up the directories in your configuration.
> Do you only have Qt 5.4 installed (i.e., no other version of Qt 5 and no
> Qt 4)?
> Could you send me the compiler command line (e.g., TWScript.cpp)? To see
> it, you probably need to invoke `make VERBOSE=1`. If you want, you can
> also send it to me off-list.

My fault. I prepared first version of this patch to use with
TeXworks.pro (actually I tried just to compile vs Qt5 using TeXworks.pro
but compilation fails due to missing headers, so I prepared a patch).
Now I tried to compile texworks using cmake _without_ patch but with
DESIRED_QT_VERSION=5 and compilation finished successfully. So no need
for this patch.

>> and the other (cmake-i18n.patch) to install
>> qm files while building TeXworks on Linux.
> Thanks. The QLibraryInfo approach looks very interesting. I will look
> into it (particularly the question in which order the translations are
> used) and then commit it.

I just used example in Qt5 documentation. As for the order, I think
translations provided by Linux distribution should be checked at first.

> Regarding the installation of the .qm files: this actually should not be
> necessary. Those files should be bundled into the texworks application
> itself (by QT_ADD_QM_TRANSLATIONS in src/CMakeLists.txt). The reason is
> that the Tw-specific translations are probably not much use for other
> programs (first, because they depend on the exact strings used in Tw,
> and second because other programs usually won't look for TeXworks_*.qm
> files).

Again, my fault. I began with TeXworks.pro and after switching to CMake
didn't try to compile and run texworks. Now I tried and it works fine, I
mean that after start texworks shows interface on Russian.

> So, I don't think that installing them system-wide (and
> especially in a directory "owned" by qt) is a good idea.

I don't know where translations for Qt5 application should "live" but,
for example, translations of Qt5 GUI of transmission go into
/usr/share/qt5/translations according to rpm (
see here: http://rpm.pbone.net or

> If they are not picked up, that's a different problem that we should
> investigate separately (possibly the resource file listing all the
> translations does not get created properly)?

Is that means that all resource files, including translations are
"incorporated" into executable? IMHO, it is good for portable
application but a bit strange for Linux distribution package.

In summary, I think only search for qt translation in distribution is
needed, the rest is Ok. I made one patch, 'system-trans.patch' and
checked how it works with CMake build-configuration system: all is Ok.

> All the best,
> Stefan

WBR, Vladimir Lomov

Farewell we call to hearth and hall!
Though wind may blow and rain may fall,
We must away ere break of day
Far over wood and mountain tall.

	To Rivendell, where Elves yet dwell
	In glades beneath the misty fell,
	Through moor and waste we ride in haste,
	And whither then we cannot tell.

With foes ahead, behind us dread,
Beneath the sky shall be our bed,
Until at last our toil be passed,
Our journey done, our errand sped.

	We must away!  We must away!
	We ride before the break of day!
		-- J. R. R. Tolkien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: system-trans.patch
Type: text/x-diff
Size: 985 bytes
Desc: not available
URL: <http://tug.org/pipermail/texworks/attachments/20150109/79a29c69/attachment.bin>

More information about the texworks mailing list