QStringLiteral and QTimer in KCompletion tests

Aleix Pol aleixpol at kde.org
Tue Jan 21 01:01:30 UTC 2014


On Tue, Jan 21, 2014 at 12:26 AM, David Gil Oliva
<davidgiloliva at gmail.com>wrote:

> Hi!
>
> *kcompletionuitest.cpp*
>
> In kcompletionuitest.cpp I have found many uses of QStringLiteral that
> perhaps aren't necessary, but I'm not sure:
>
> Form1::Form1(QWidget *parent)
>     : QWidget(parent)
> {
>     setAttribute(Qt::WA_DeleteOnClose);
>     *setObjectName(QStringLiteral("Form1"));*
>     resize(559, 465);
>     *setWindowTitle(QStringLiteral("Form1"));*
>     Form1Layout = new QVBoxLayout(this);
>
>     GroupBox1 = new QGroupBox(this);
>     GroupBox1->setLayout(new QVBoxLayout());
>     *GroupBox1->setTitle(QStringLiteral("Completion Test"));*
>
> Can't it be just GroupBox1->setTitle("Completion Test"); for example?
>
> *kcomboboxtest.cpp*
>
> Another thing: the test kcomboboxtest has a Enable/Disable button that
> uses a QTimer, so, when pressed, it takes 5 endless seconds to
> enable/disable the combo boxes and change the text of the button. May I
> take off that QTimer or is it useful in some unknown way? :-/
>
>
> Thanks!
>
> David Gil
>
> _______________________________________________
> Kde-frameworks-devel mailing list
> Kde-frameworks-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kde-frameworks-devel
>
>
You'll see you'll get errors if you pass the char* right away to the
QString. This is because we don't let frameworks use the QString(char*)
constructor as it's not the fastest way to construct a QString. For
applications we don't enforce it, though.

For more information, see the Qt documentation or
http://woboq.com/blog/qstringliteral.html

Regarding the QTimer, I'd assume that it's the thing that does the actual
testing. Maybe you want to reduce the timeout?

Aleix
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140121/0a749abc/attachment.html>


More information about the Kde-frameworks-devel mailing list