[SOLVED] Conversion from ascci to char in QML
-
@p3c0
Keys.onPressed:
{if(event.text) { console.log("zero is pressed"); textin.insert(0,String.fromCharCode(Keys)) } }
is this code k,
because when i press any keys its getting printed in application outputbut i need in text input.
@Pradeep-Kumar.M No conversion required now. Try
Keys.onPressed: { textin.insert(0,event.text) }
-
its working fine, thank u for that,
but in text input, its not appending, its getting from right to left, i want from left to right. -
its working fine, thank u for that,
but in text input, its not appending, its getting from right to left, i want from left to right.@Pradeep-Kumar.M Are you using Arabic language or Arabic locale ? In that case it will be aligned to right side.
-
@Pradeep-Kumar.M Are you using Arabic language or Arabic locale ? In that case it will be aligned to right side.
no, in text input its printing, which ever key is pressed, but not in appending fashion
ex: if i press 1234567890abcdefgh
its printing in text input as hgfedcba0987654321
i want in 1234567890abcdefgh
-
no, in text input its printing, which ever key is pressed, but not in appending fashion
ex: if i press 1234567890abcdefgh
its printing in text input as hgfedcba0987654321
i want in 1234567890abcdefgh
@Pradeep-Kumar.M Ofcourse it will. You are inserting every new character at 0'th position.
-
Hi @Pradeep-Kumar.M,
Use String.fromCharCode to convert code to character and then use insert to add that character toTextInput
.so what to do if i want in appending fashion of letters, numbers, any other keys from keyboard, to text input
-
so what to do if i want in appending fashion of letters, numbers, any other keys from keyboard, to text input
@Pradeep-Kumar.M Get the new index position from
TextInput
. You want it to append it at the end solength
should give you the last index. Insert it theretextin.insert(textin.length,event.text)
-
@Pradeep-Kumar.M Get the new index position from
TextInput
. You want it to append it at the end solength
should give you the last index. Insert it theretextin.insert(textin.length,event.text)
thank you, it worked.
-
thank you, it worked.
@Pradeep-Kumar.M You're Welcome :)
-
one more question
i tries Qt Integration
here is ex: of main.cpp
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
window->dumpObjectTree();
QQuickWindow *window1 = topLevel->findChild<QQuickWindow * >(objectname);can i have QQMLContext, QQMLComponent & QQMLEngine,
if so
can u provide code of it, along with component item. -
one more question
i tries Qt Integration
here is ex: of main.cpp
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);
window->dumpObjectTree();
QQuickWindow *window1 = topLevel->findChild<QQuickWindow * >(objectname);can i have QQMLContext, QQMLComponent & QQMLEngine,
if so
can u provide code of it, along with component item.@Pradeep-Kumar.M Do you mean an example ?
-
yeah but
to replace the lines above which i sent in previous post -
yeah but
to replace the lines above which i sent in previous post -
for wat exactly setcontextproperty is used
-
for wat exactly setcontextproperty is used
@Pradeep-Kumar.M To expose C++ objects to QML.
-
do we have QQMLContextItem or QQMLComponentItem
-
do we have QQMLContextItem or QQMLComponentItem
@Pradeep-Kumar.M None. We have
QQuickItem
. -
QML is scripting language,
QtQuick is module required for writing QML Applications,diff between QtQuick and QML please?.
-
QML is scripting language,
QtQuick is module required for writing QML Applications,diff between QtQuick and QML please?.
@Pradeep-Kumar.M Yes you have the answer. Check out what-is-qml and what-is-qt-quick.
It's all in the docs. You should go through it. -
@Pradeep-Kumar.M Yes you have the answer. Check out what-is-qml and what-is-qt-quick.
It's all in the docs. You should go through it.@p3c0
k