Re: [Interest] QLineEdit placeholder text Qt 5.6.3

2020-09-14 Thread Federico Ferri
https://stackoverflow.com/questions/50423658/qlineedit-paint-a-different-text-than-the-actual-text-placeholder-with-text-n/50425331#50425331



On 13 September 2020 at 14:00:02, Ramakanth Kesireddy (rama.k...@gmail.com)
wrote:

Hi,

Am using Qt 5.6.3 widgets on embedded Linux.
To display placeholder text of datetimeformat MMDDhhmmss,QLineEdit is
being used.
It is removed by default as soon as text is entered from custom virtual
keyboard as expected.

Is it possible to display the above placeholder text when user enters the
date from custom keypad so that user could see the format to enter?

For example, when user enters 2, it could still be shown as  2YYYMMDDhhmmss
based on entered date and then follows. Does it makes makes sense to
consider custom QLineEdit to achieve the same?

Any other suggestions are welcome.
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QML/C++ interaction in Qt6

2020-09-14 Thread Jérôme Godbout
Oh,... now that's a deal breaker... I guess I will have to stick with the old 
method for a while, having 1 plugins per modules to be expose will need some 
major refactor over here. I have subrepos who have a single .pri and might 
expose a few modules and some modules are partials between subrepos. I gather 
my .pri to build for some targets and platforms specific subrepos might add 
stuff to it. 

The idea seem good, but the result doesn't scale too well and ain't flexible. 
Is the old way will still work into Qt 6 then?

-Original Message-
From: Giuseppe D'Angelo  
Sent: September 14, 2020 11:22 AM
To: Jérôme Godbout 
Subject: Re: [Interest] QML/C++ interaction in Qt6

On 14/09/2020 17:19, Jérôme Godbout wrote:
> Yeah I got that part, the part I do not get is how can you have multiple 
> QML_IMPORT_NAME and multiple files in each? how do you tell into which 
> modules goes which classe? Is it the declaration order into the .pro/.pri?
> 
> I for one, also keep track of every singleton instance instanciate from Qml 
> for C++ type, so my C++ can request the same singleton if ever needed (I18n, 
> Application wide settings, style and themes...). I did make my own template 
> class wher I can register the module more easily, nt havign to retype the 
> module name and version each time. Also have the getter for those singleton 
> instance per Engine*.

As far as I know, you split the project in multiple .pro files (e.g. by 
building a bunch of static libs or QML plugins). Each .pro will have its 
own import.

HTH,

-- 
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts

___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QML/C++ interaction in Qt6

2020-09-14 Thread Giuseppe D'Angelo via Interest

Il 14/09/20 15:54, Jérôme Godbout ha scritto:

//

how does the Person class is link to the People name exactly?!?



QML_IMPORT_NAME does the link.

The "equivalent" of registering a QML_ELEMENT class, using the syntax of 
old registrations is something like



  qmlRegisterType("QML_IMPORT_NAME", QML_IMPORT_MAJOR_VERSION, 
QML_IMPORT_MINOR_VERSION, "CLASS_WITH_QML_ELEMENT")


In your case that translates to


  qmlRegisterType("People", 1, 0, "Person")


HTH,
--
Giuseppe D'Angelo | giuseppe.dang...@kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



smime.p7s
Description: Firma crittografica S/MIME
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest


Re: [Interest] QML/C++ interaction in Qt6

2020-09-14 Thread Jérôme Godbout
Hi,

Thanks for the info, I did took a look at the QML_ELEMENT at 
https://www.qt.io/blog/qml-type-registration-in-qt-5.15

I was a bit confuse about how this actually do the the convertion between 
people and person in the following example given:



***

qmlRegisterType("People", 1,0, "Person");



This would register the C++ class "Person" as a QML element also called 
"Person", into the module "People" under the version 1.0. This line has 
disappeared in Qt 5.15. Instead, the following lines have been added to the 
adding.pro file:



CONFIG += qmltypes

QML_IMPORT_NAME = People

QML_IMPORT_MAJOR_VERSION = 1



These lines specify the import name and major version for all types exposed to 
QML. Finally, the most important change, is the "QML_ELEMENT" macro added to 
the person.h file:



class Person : public QObject

{

Q_OBJECT

Q_PROPERTY(QString name READ name WRITE setName)

Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)

QML_ELEMENT

public:

Person(QObject *parent = nullptr);

[...]

};

***

how does the Person class is link to the People name exactly?!? I do not 
understand how can it known that the C++ class should be link the given People 
import name?! Is like a stack, if I change the QML_IMPORT_NAMES before using 
any HEADERS += or SOURCES += ? like this:



CONFIG += qmltypes

QML_IMPORT_NAME = People

QML_IMPORT_MAJOR_VERSION = 1



HEADERS += Person.h

SOURCES += Person.cpp



QML_IMPORT_NAME = MyOtherModule

QML_IMPORT_MAJOR_VERSION = 1



HEADERS += MyOtherClass.h

SOURCES += MyOtherClass.cpp



Is that how it should work? Is the order of declaration into .pro and .pri 
matter to make this work or there is something I don’t get here? Thanks



-Original Message-
From: Ulf Hermann 
Sent: September 12, 2020 3:24 AM
To: Jérôme Godbout ; interest@qt-project.org
Subject: Re: [Interest] QML/C++ interaction in Qt6



> Will Qt 6 still use the Meta information to access Qml properties or

> it rely more on compiled C++ now? I guess it still the same as before.

> Is the properties declaration of Qt for MCU (Qml lite or soemthign

> like that) be available (syntax wise, template)? That would leverage

> soo much redundent code to expose properties with get/set and changed

> event. That will be a slim fast for code that expose to Qml (to Meta

> data actually, Qml use the meta data) and maybe event make that layer

> disapear one day.



Registration of C++ types for QML in dev is largely unchanged from 5.15.

You get the QML_ELEMENT etc. macros we introduced in 5.15 to make the 
registration as painless as possible. The indirection through the metatype 
system is necessary for the case of dynamically interpreted QML. We can 
generate C++ code from your QML to directly access your C++ types, but if you 
want to execute that same QML in interpreted mode, those C++ types need to be 
visible to metatype system in order to be accessible.



Also, the new property system is being introduced. If you provide a BINDABLE 
property, you may be able to skip the READ, WRITE, and NOTIFY methods in the 
future. This is still being worked on, though.



best,

Ulf
___
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest