Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 28
Registered: ‎06-25-2009
My Device: 9930
My Carrier: China Telecom

how to obtain the width of a Qstring belonging to a TextArea?

how to obtain the width of a Qstring when displayed in a TextArea?

 

I think it is related with the current font, but i found no api for that.

Developer
Posts: 49
Registered: ‎08-21-2012
My Device: Blackberry z10 LE
My Carrier: Vodafone

Re: how to obtain the width of a Qstring belonging to a TextArea?

Developer
Posts: 28
Registered: ‎06-25-2009
My Device: 9930
My Carrier: China Telecom

Re: how to obtain the width of a Qstring belonging to a TextArea?

Thank you, AlterX

 

But, you know, not all QT classes supported by cascades,  like QFont

Developer
Posts: 49
Registered: ‎08-21-2012
My Device: Blackberry z10 LE
My Carrier: Vodafone

Re: how to obtain the width of a Qstring belonging to a TextArea?

Than, it's very impossible to have that! what the hell Cascades Qt is without Qt?!??!
Nokia Qt Ambassador
http://www.softairrealfight.net
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: how to obtain the width of a Qstring belonging to a TextArea?

(please moderate your language)

 

AlterX, I love your enthusiasm, and you should find your understanding of Qt will make developing in Cascades pretty natural.

 

To clarify what Peter said in another thread...

 

Cascades is not Qt.  For very specific visual performance, consistent look and feel, and deep integration with the OS, Cascades is not Qt.   You can use Qt or even other UI, but you give up the consistent look and feel and deep integration you get with Cascades.  For example, cascades classes are rendered using a separate rendering thread. This is a significant difference from Qt.

 

See: https://developer.blackberry.com/cascades/documentation/getting_started/introtocascades.html

And of course there are other options for developing on blackberry: https://developer.blackberry.com/

 

So, what is supported and what is not?

Short answer 1:

Any Qt describe here is supported: https://developer.blackberry.com/cascades/reference/qt_index.html

 

Short answer 2:

When using Cascades, use cascades classes and namespaces for UI.

 

Longer answer:

Much of Qt is supported, but you either use Qt application and UI classes, or you use Cascades namespace and UI classes.  That means QString, signals and slots, and many other Qt-isms are supported.   In addition, sometimes Qt UI classes and even QPainter can be used -- so long as this is done outside of the UI, and in particular outside of a PaintEvent.  See http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-QImage-and-QPainter-to-P...

 

Stuart

Developer
Posts: 49
Registered: ‎08-21-2012
My Device: Blackberry z10 LE
My Carrier: Vodafone

Re: how to obtain the width of a Qstring belonging to a TextArea?

I've understood, but at this point is useless to speak about Qt in blackberry...why they should provide a non complete Qt implementation but just a little and not enough portion?!?
I mean...I'm creating a very complex realtime game, with gps, compass, advanced graphics animations, networking library to communicate over udp and so on...on blackberry I cannot easly build my app as I just did with the others that support Qt!
And just to clarify, with Qt5 the opengl rendering will be on separate thread too Smiley Wink
Nokia Qt Ambassador
http://www.softairrealfight.net
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: how to obtain the width of a Qstring belonging to a TextArea?

Then you are on the right platform, just the wrong forum.

Use the native ndk and Qt.

 

Stuart

Developer
Posts: 49
Registered: ‎08-21-2012
My Device: Blackberry z10 LE
My Carrier: Vodafone

Re: how to obtain the width of a Qstring belonging to a TextArea?

But I didn't understand: Qt framework (not cascade) is officially supported on blackberry? with officially supported I meant is the runtime shipped with a device like the native one?!
Nokia Qt Ambassador
http://www.softairrealfight.net
Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: how to obtain the width of a Qstring belonging to a TextArea?

Scan the native forum for Qt and QtQuick, but be aware that that forum has a mix of NKD2 and BB10 questions. Please start a thread there if you can't find what you need.

 

=====================

Back to the topic of this thread...

 

The solution provided by AlterX doesn't work directly, of course, but it might be on the right track.  Has anyone discovered a clean way?

 

Stuart

Developer
Posts: 849
Registered: ‎03-03-2011
My Device: Z10

Re: how to obtain the width of a Qstring belonging to a TextArea?

mzex is working with pure Qt on PlayBook.
--------------------------------------------------------------------------------------
Leader of Ljubljana BlackBerry Developer Group
BlackBerry Certified Builder for Native Application Development