[Development] QLatin1Constant and QtContacts / QtOrganizer

2011-12-19 Thread Todd.Rose
I'm in the early stages of trying to port a Qt4.7 app that uses qt-mobility to 
Qt5.  Today I noticed compile errors caused by the duplication of 
qlatin1constant.h in both of these modules.

The problem shows when you write an app that uses both the QtContacts and the 
QtOrganizer modules.   Headers within the QtContacts module will sometimes 
include the QtOrganizer version of qlatin1constant.h (or vice-versa depending 
on the app's include path ordering).  The use of namespaces in these headers is 
what leads to the errors.

There's several solutions, and I guess it'd be best if the QLatin1Constant 
functionality was moved to a core library, but until then can we at least have 
the headers *within* the Contacts and Organizer modules include 
qlatin1constant.h in an unambiguous manner?

Maybe something like:

#include "../QtContacts/qtlatin1constant.h"

rather than the include-path-sensitive:

#include 

BR,
-Todd

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


[Development] Status of QtDeclarative on Windows?

2012-01-13 Thread Todd.Rose
Just for fun I've been playing with a medium-sized QML app that we had written 
for 4.7/Symbian and porting it to Qt5/QML2.  Mostly have been working on Linux 
but the past few days I finally got around to compiling Qt5 on Windows and 
playing around with the project enough so that it would compile and run under 
qmlscene (it's mostly qml/js with a C++ plugin module as well).

Anyway, the performance on my Windows box is horrible.  ListView scrolling, 
image loading, animations, everything is like it's running in quicksand.  Is 
this expected?  If not, what do I need to do to in order to troubleshoot?  This 
machine is relatively old and has a crappy video card (older Nvidia Quadro), 
but it should be more than good enough to run this app smoothly.  Any tips or 
tricks to enable extra debug tracing?

Thanks,
Todd
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Status of QtDeclarative on Windows?

2012-01-14 Thread Todd.Rose
It seems equally slow when running debug and release libs, but will double 
check later this weekend to make sure it's not user-error.  I think it has more 
to do with running with a video card that doesn't provide much (if any?) 
hardware acceleration.  But I was assuming that even in that case that QML2 
would be just as good as QML1.  Clearly something is causing that to not be the 
case.

What's the expectation when using video cards that don't offer OpenGL hardware 
acceleration?   

-Todd

> -Original Message-
> From: Storm-Olsen Marius (Nokia-MP/Austin)
> Sent: Saturday, January 14, 2012 9:12 AM
> To: development@qt-project.org; Rose Todd (Nokia-M/Alpharetta)
> Subject: Re: [Development] Status of QtDeclarative on Windows?
> 
> Are you sure you are at least running the release version of your application?
> 
> Debug version uses the debug CRT libs (and a debug Qt which does the
> same), so everything will be a lot slower than the end product.
> 
> You cannot really evaluate performance with debug builds.
> 
> --
> Sent from my Nokia N9
> On 1/13/12 23:12 ext todd.r...@nokia.com wrote:
> Just for fun I’ve been playing with a medium-sized QML app that we had
> written for 4.7/Symbian and porting it to Qt5/QML2.  Mostly have been
> working on Linux but the past few days I finally got around to compiling Qt5
> on Windows and playing around with the project enough so that it would
> compile and run under qmlscene (it’s mostly qml/js with a C++ plugin module
> as well).
> 
> Anyway, the performance on my Windows box is horrible.  ListView scrolling,
> image loading, animations, everything is like it’s running in quicksand.  Is 
> this
> expected?  If not, what do I need to do to in order to troubleshoot?  This
> machine is relatively old and has a crappy video card (older Nvidia Quadro),
> but it should be more than good enough to run this app smoothly.  Any tips
> or tricks to enable extra debug tracing?
> 
> Thanks,
> Todd
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Status of QtDeclarative on Windows?

2012-01-15 Thread Todd.Rose
Well it looks like the slowness I'm seeing is due to the rendering thread using 
all of the CPU.  I tried toggling the nvidia driver settings for vsync and 
triple-buffering but that doesn’t change the behavior.  Is there anything else 
I can try?  Do other people see acceptable performance on Windows currently?

-Todd

> -Original Message-
> From: development-bounces+todd.rose=nokia@qt-project.org
> [mailto:development-bounces+todd.rose=nokia@qt-project.org] On
> Behalf Of ext todd.r...@nokia.com
> Sent: Saturday, January 14, 2012 4:47 PM
> To: Storm-Olsen Marius (Nokia-MP/Austin); development@qt-project.org
> Subject: Re: [Development] Status of QtDeclarative on Windows?
> 
> It seems equally slow when running debug and release libs, but will double
> check later this weekend to make sure it's not user-error.  I think it has 
> more
> to do with running with a video card that doesn't provide much (if any?)
> hardware acceleration.  But I was assuming that even in that case that QML2
> would be just as good as QML1.  Clearly something is causing that to not be
> the case.
> 
> What's the expectation when using video cards that don't offer OpenGL
> hardware acceleration?
> 
> -Todd
> 
> > -Original Message-
> > From: Storm-Olsen Marius (Nokia-MP/Austin)
> > Sent: Saturday, January 14, 2012 9:12 AM
> > To: development@qt-project.org; Rose Todd (Nokia-M/Alpharetta)
> > Subject: Re: [Development] Status of QtDeclarative on Windows?
> >
> > Are you sure you are at least running the release version of your
> application?
> >
> > Debug version uses the debug CRT libs (and a debug Qt which does the
> > same), so everything will be a lot slower than the end product.
> >
> > You cannot really evaluate performance with debug builds.
> >
> > --
> > Sent from my Nokia N9
> > On 1/13/12 23:12 ext todd.r...@nokia.com wrote:
> > Just for fun I’ve been playing with a medium-sized QML app that we had
> > written for 4.7/Symbian and porting it to Qt5/QML2.  Mostly have been
> > working on Linux but the past few days I finally got around to
> > compiling Qt5 on Windows and playing around with the project enough so
> > that it would compile and run under qmlscene (it’s mostly qml/js with
> > a C++ plugin module as well).
> >
> > Anyway, the performance on my Windows box is horrible.  ListView
> > scrolling, image loading, animations, everything is like it’s running
> > in quicksand.  Is this expected?  If not, what do I need to do to in
> > order to troubleshoot?  This machine is relatively old and has a
> > crappy video card (older Nvidia Quadro), but it should be more than
> > good enough to run this app smoothly.  Any tips or tricks to enable extra
> debug tracing?
> >
> > Thanks,
> > Todd
> ___
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Types defined in c++ plugin aren't available in QML code

2012-01-16 Thread Todd.Rose
Hi,

I think your example.qml needs to import the library that contains your custom 
C++ type...so in your scenario it would be something like "import myplugin 1.0".

Best regards,
Todd


From: development-bounces+todd.rose=nokia@qt-project.org 
[development-bounces+todd.rose=nokia@qt-project.org] on behalf of ext 
Łukasz Korbel [korbe...@gmail.com]
Sent: Monday, January 16, 2012 12:35 PM
To: development@qt-project.org
Subject: [Development] Types defined in c++ plugin aren't available in QML code

Hello,
I have problem with using c++ defined types in QML code. Qt version i use is Qt 
5.0 built from git repository.

Problem:
I wrote simple project in Qt 4.7 according to guidelines from 
http://doc.qt.nokia.com/qt5/qml-extending.html and 
http://doc.qt.nokia.com/qt5/src-imports-folderlistmodel.html.
Next I made transition from Qt.4.7 to 5.0. ( 
http://wiki.qt-project.org/Transition_from_Qt_4.x_to_Qt5)
Building of project is going succesful but running qmlscene example.qml returns 
error
that MyType(the one I've created) is not a type.

Details of project:
MyType is C++ class meeting following conditions:
1. Inherit from QObject
2. Use Q_OBJECT macro in body and QML_DECLARE_TYPE macro in header file
3. MyType is registered with qmlRegisterType in MyPlugin class

MyPlugin class (in MyPlugin.cpp) inherits from QDeclarativeExtensionPlugin, 
defines void registerTypes(const char *uri) method and have Q_EXPORT_PLUGIN2 
macro in file.



Listing:

--
MyType.h
--
#ifndef MYTYPE_H
#define MYTYPE_H

#include 
#include 
#include 

QT_BEGIN_HEADER
QT_MODULE(Declarative)

class MyType : public QObject
{
Q_OBJECT
Q_PROPERTY( QString data READ data WRITE setData NOTIFY dataChanged)

public:
MyType();
~MyType();

QString data() const;
void setData( const QString&);

Q_INVOKABLE void performAlogrithm();

Q_SIGNALS:
void dataChanged();

private:
Q_DISABLE_COPY(MyType);
QString data_;
};

QML_DECLARE_TYPE(MyType)
QT_END_HEADER

#endif
--


--
MyType.cpp
--
#include "MyType.h"

MyType:: MyType()
{
data_ = "init";
}

MyType:: ~MyType()
{
data_ = "destroy";
}

QString MyType:: data() const
{
return data_;
}

void MyType:: setData( const QString& data)
{
data_ = data;
}

void MyType:: performAlogrithm()
{
//do something
emit dataChanged();
}
--


--
MyPlugin.cpp
--
#ifndef MYPLUGIN
#define MYPLUGIN

#include 
#include 
#include "MyType.h"

class MyPlugin : public QDeclarativeExtensionPlugin
{
Q_OBJECT

public:
void registerTypes(const char *uri)
{
qmlRegisterType(uri, 1, 0, "MyType");
}
};

#include "MyPlugin.moc"
Q_EXPORT_PLUGIN2(myplugin, QT_PREPEND_NAMESPACE(MyPlugin));

#endif
--


--
project.pro<http://project.pro>
--

TEMPLATE = lib
CONFIG += qt plugin release
QT += declarative
HEADERS += MyType.h
SOURCES += MyType.cpp MyPlugin.cpp
TARGET = $$qtLibraryTarget(myplugin)
--


--
qmldir

[Development] Text clipping in QtQuick 2.0

2012-01-16 Thread Todd.Rose
Text elements with wrapMode: Text.NoWrap are being clipped when the text 
painted width exceeds the element width.   Seems like a big regression from 
QtQuick1.x...is this a known issue?  Bug? Feature?

Simple example:

TextBug.qml


import QtQuick 2.0

Rectangle {

width: 360

height: 360

Rectangle {

id: leftRect

anchors.left: parent.left

anchors.top: parent.top

anchors.bottom: parent.bottom

width: 60

color: "red"

}

Rectangle {

id: rightRect

anchors.right: parent.right

anchors.top: parent.top

anchors.bottom: parent.bottom

width: 60

color: "red"

}

Text {

id: bugText

anchors.left: leftRect.right

anchors.right: rightRect.left

anchors.verticalCenter: parent.verticalCenter

wrapMode: Text.NoWrap

font.pointSize: 16

clip: true

text: "Hello World! Hello World! Hello World! Hello World! Hello World! 
Hello World! Hello World! Hello World! Hello World! Hello World!"

}

MouseArea {

anchors.fill: parent

onClicked: {

if (bugText.wrapMode == Text.NoWrap)

bugText.wrapMode = Text.WordWrap

else

bugText.wrapMode = Text.NoWrap

}

}

}

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Text clipping in QtQuick 2.0

2012-01-16 Thread Todd.Rose
Doh!  That should read "Text elements...are *not* being clipped..."

From: development-bounces+todd.rose=nokia@qt-project.org 
[mailto:development-bounces+todd.rose=nokia@qt-project.org] On Behalf Of 
ext todd.r...@nokia.com
Sent: Tuesday, January 17, 2012 12:34 AM
To: development@qt-project.org
Subject: [Development] Text clipping in QtQuick 2.0

Text elements with wrapMode: Text.NoWrap are being clipped when the text 
painted width exceeds the element width.   Seems like a big regression from 
QtQuick1.x...is this a known issue?  Bug? Feature?

Simple example:

TextBug.qml


import QtQuick 2.0

Rectangle {

width: 360

height: 360

Rectangle {

id: leftRect

anchors.left: parent.left

anchors.top: parent.top

anchors.bottom: parent.bottom

width: 60

color: "red"

}

Rectangle {

id: rightRect

anchors.right: parent.right

anchors.top: parent.top

anchors.bottom: parent.bottom

width: 60

color: "red"

}

Text {

id: bugText

anchors.left: leftRect.right

anchors.right: rightRect.left

anchors.verticalCenter: parent.verticalCenter

wrapMode: Text.NoWrap

font.pointSize: 16

clip: true

text: "Hello World! Hello World! Hello World! Hello World! Hello World! 
Hello World! Hello World! Hello World! Hello World! Hello World!"

}

MouseArea {

anchors.fill: parent

onClicked: {

if (bugText.wrapMode == Text.NoWrap)

bugText.wrapMode = Text.WordWrap

else

bugText.wrapMode = Text.NoWrap

}

}

}

___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Text clipping in QtQuick 2.0

2012-01-17 Thread Todd.Rose
:-)   In my defense I was surprised that it wasn't already reported so I 
thought maybe I was doing something wrong.  FWIW you can work around it for now 
by putting the Text inside a Rectangle with clip: true.

BR,
Todd

> -Original Message-
> From: development-bounces+todd.rose=nokia@qt-project.org
> [mailto:development-bounces+todd.rose=nokia@qt-project.org] On
> Behalf Of Alpert Alan (Nokia-MP/Brisbane)
> Sent: Tuesday, January 17, 2012 5:14 AM
> To: development@qt-project.org
> Subject: Re: [Development] Text clipping in QtQuick 2.0
> 
> Clipping has never been enabled by default (not even in QtQuick 1.x). An
> important detail he left out of the description (though not the example) was
> that he explicitly set clip: true on the Text element.
> 
> This does make him seen extremely open minded to consider clip: true not
> clipping as a 'feature' ;). If I saw that behavior I'd file it in JIRA 
> directly.
> 
> --
> Alan Alpert
> 
> On Tue, 17 Jan 2012 20:01:50 ext lars.kn...@nokia.com wrote:
> > Isn't this mostly because we don't cache text in textures anymore in Qt5?
> >
> > Enabling clipping be default on all Text elements would cause a
> > performance hit, so I'm not sure this should be enabled by default.
> >
> > Cheers,
> > Lars
> >
> > On 1/17/12 7:30 AM, "ext andrew.den-ex...@nokia.com"
> >
> >  wrote:
> > >It¹s a bug.  https://bugreports.qt.nokia.com/browse/QTBUG-23670
> > >
> > >Specifically items are being clipped to their boundingRect¹s, for
> > >which some item¹s  quite logically return their painted size and so
> > >are never clipped.  Text and Image are I think the only ones that do this.
> > >
> > >Andrew
> > >
> > >From: development-bounces+andrew.den-exter=nokia.com@qt-
> project.org
> > >[mailto:development-bounces+andrew.den-exter=nokia.com@qt-
> project.org
> > >] On Behalf Of Rose Todd (Nokia-M/Alpharetta)
> > >Sent: Tuesday, January 17, 2012 3:42 PM
> > >To: development@qt-project.org
> > >Subject: Re: [Development] Text clipping in QtQuick 2.0
> > >
> > >
> > >
> > >Doh!  That should read ³Text elementsŠare *not* being clippedŠ²
> > >
> > >From:development-bounces+todd.rose=nokia@qt-project.org
> > >[mailto:development-bounces+todd.rose=nokia@qt-project.org]
> > ><mailto:[mailto:development-bounces+todd.rose=nokia.com@qt-
> project.or
> > >g]>
> > >On Behalf Of
> > >ext todd.r...@nokia.com
> > >Sent: Tuesday, January 17, 2012 12:34 AM
> > >To: development@qt-project.org
> > >Subject: [Development] Text clipping in QtQuick 2.0
> > >
> > >
> > >
> > >Text elements with wrapMode: Text.NoWrap are being clipped when the
> text
> > >painted width exceeds the element width.   Seems like a big regression
> > >from QtQuick1.xŠis this a known issue?  Bug? Feature?
> > >
> > >
> > >Simple example:
> > >
> > >
> > >TextBug.qml
> > >
> > >import QtQuick 2.0Rectangle {width: 360height: 360Rectangle {
> > >
> > >   id: leftRectanchors.left: parent.leftanchors.top:
> > >parent.topanchors.bottom: parent.bottomwidth: 60
> > >color: "red"}Rectangle {id: rightRect
> > >anchors.right: parent.rightanchors.top: parent.top
> > >anchors.bottom: parent.bottomwidth: 60color: "red"}
> > >
> > > Text {id: bugTextanchors.left: leftRect.right
> > >
> > >anchors.right: rightRect.leftanchors.verticalCenter:
> > >parent.verticalCenterwrapMode: Text.NoWrapfont.pointSize:
> > >16clip: truetext: "Hello World! Hello World! Hello World!
> > >Hello World! Hello World! Hello World! Hello World! Hello World! Hello
> > >World! Hello World!"}MouseArea {anchors.fill: parent
> > >
> > >  onClicked: {if (bugText.wrapMode == Text.NoWrap)
> > >
> > >bugText.wrapMode = Text.WordWrapelse
> > >
> > >bugText.wrapMode = Text.NoWrap}}}
> > >
> > >
> > >
> > >
> > >
> > >___
> > >Development mailing list
> > >Development@qt-project.org
> > >http://lists.qt-project.org/mailman/listinfo/development
> ___
> Development mailing list
> Development@qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development


Re: [Development] Work on qDebug and friends

2012-01-24 Thread Todd.Rose
> Hi,
> 
> I've been working on a patch to the Qt logging framework:
> http://codereview.qt-project.org/#change,13433,patchset=14 . Basically it
> redefines qDebug() and friends as a macro so that we can automatically
> capture the source file, line, and function a particular message comes from:
> 
>   qDebug("Hello world")
> 
> actually is changed by the precompiler to:
> 
>   QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO):debug("Hello
> World")
> 
> The additional information can then be processed in a custom message
> handler, that also got a new signature:
> 
> void myMessageHandler(QtMsgType type, const QMessageLogContext
> &context, const char *msg) {
>   switch (type) {
> case QtDebugMsg:
> printf("DBG: %s (%s:%i in %s)\n", msg, context.file, context.line,
> context.function);  }
> break;
>// ...
> }
> 
> int main(int argc, char **argv)
> {
>   qInstallMessageHandler(myMessageHandler);
> }
> 
> 
> 
> The patch is almost ready to go in ... Anyhow, the question is whether there's
> additional things we need to have in QtCore to make the logging framework
> of Qt first-class? See my second mail regarding debug areas ...
> 
> --
> Kai Koehne


The "additional things we need" question is pretty subjective, but there are 
probably quite a few things that would be "nice to have".  I usually just copy 
all my logging/tracing/profiling macros around from project to project.  There 
are certain things that you pretty much always need in any non-trivial app:

- capture log stream and write to file (and manage log file sizes and rotation 
strategy)
- add current time and current thread id to each log message
- an easy and consistent way to compile out expensive verbose debugging code 
(not just the qDebug() call, but also the code that computes the arguments that 
are passed)
- macros similar to qDebug but that are used to provide simple profiling 
(timing of function/code-block durations)
- support for utf8 in the log message

I would also like to see more effort put into the part of QtCreator that parses 
log messages and displays hyperlinks to source files.  The current regex code 
there needs to be loosened up a bit and be more forgiving as far as where in 
the message the __FILE__:__LINE__ portion is.  This is a really nice feature 
when it works, and one of the best uses of the __FILE__ and __LINE__ info, but 
at the moment it doesn't always work correctly because running your app in 
different contexts (desktop/simulator/on-device) will end up with different 
stuff prepended to your log message before it gets to the app output window.

Most of the above is achievable by writing custom message handlers and custom 
macros.  I guess the question is whether that's good enough or whether you want 
to provide more functionality out-of-the-box.

BR,
-Todd





___
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development