Review Request 115485: Porting KTranscript from KJS to QtScript

Alex Merry kde at randomguy3.me.uk
Sat Feb 22 13:52:27 UTC 2014



> On Feb. 22, 2014, 1:35 p.m., Chusslove Illich wrote:
> > I tried to run a standalone non-GUI program using ki18n:
> > 
> >   #include <QDebug>
> >   #include <KLocalizedString>
> > 
> >   int main (int argc, char *argv[])
> >   {
> >       setlocale (LC_ALL, "");
> >       KLocalizedString::setApplicationDomain("test-ki18n-01");
> >       qDebug() << i18n("Delete %1?", i18n("file"));
> >       return 0;
> >   }
> > 
> > and got abort with this message:
> > 
> >   QScriptEngine: Must construct a Q(Core)Application before a QScriptEngine
> > 
> > It does work when I add only
> > 
> >   #include <QCoreApplication>
> >   ...
> >   QCoreApplication a(argc, argv);
> > 
> > What is the reason that this is necessary? If one does want to use ki18n in
> > non-Qt-UI program, would it be inappropriate (in whatever way) to
> > nevertheless require creation of QCoreApplication?
> >
> 
> Kevin Krammer wrote:
>     QCoreApplication is for non-UI Qt applications, QGuiApplication and its subclass QApplication are the ones for UI programs.
>     I was under the impression that translations always require the presence of a QCoreApplication (or derived) instance. Qt's own tr() does.

And, indeed, there are a lot of other things in QtCore that break if you do not have a QCoreApplication instance.  In short, if you are making a Qt application (GUI or not), you need to create an instance of QCoreApplication (or one of its subclasses).


- Alex


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115485/#review50522
-----------------------------------------------------------


On Feb. 21, 2014, 4:30 p.m., Kevin Krammer wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115485/
> -----------------------------------------------------------
> 
> (Updated Feb. 21, 2014, 4:30 p.m.)
> 
> 
> Review request for KDE Frameworks and Chusslove Illich.
> 
> 
> Repository: ki18n
> 
> 
> Description
> -------
> 
> Attempt at replacing the KJS dependency with a QtScript, i.e. making ki18n a tier1 framework.
> Needs more testing and likely fixing
> 
> 
> Diffs
> -----
> 
>   CMakeLists.txt 3e099d5 
>   src/CMakeLists.txt 9e3ce9f 
>   src/ktranscript.cpp c922e91 
> 
> Diff: https://git.reviewboard.kde.org/r/115485/diff/
> 
> 
> Testing
> -------
> 
> Unittest runs, but the test script is very minimal and would need to be extendedb by someone who understands the scripting requirements.
> There is also a weird crash at test shutdown, in QThreadStorage. As far as I can tell I did not change anything related to threads though.
> 
> 
> Thanks,
> 
> Kevin Krammer
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140222/6ef28e16/attachment.html>


More information about the Kde-frameworks-devel mailing list