Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Kotlin in QT Project. How?
Forum Updated to NodeBB v4.3 + New Features

Kotlin in QT Project. How?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
13 Posts 6 Posters 7.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bogong
    wrote on 14 Sept 2019, 21:03 last edited by
    #1

    Hello all!
    Is there any way to add Kotlin in QT Project?

    A 1 Reply Last reply 14 Sept 2019, 21:24
    0
    • B bogong
      14 Sept 2019, 21:03

      Hello all!
      Is there any way to add Kotlin in QT Project?

      A Offline
      A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on 14 Sept 2019, 21:24 last edited by
      #2

      Hi @bogong,

      why?

      Qt has to stay free or it will die.

      B 1 Reply Last reply 14 Sept 2019, 21:27
      1
      • A aha_1980
        14 Sept 2019, 21:24

        Hi @bogong,

        why?

        B Offline
        B Offline
        bogong
        wrote on 14 Sept 2019, 21:27 last edited by
        #3

        @aha_1980 because ...

        A 1 Reply Last reply 15 Sept 2019, 07:04
        -1
        • B bogong
          14 Sept 2019, 21:27

          @aha_1980 because ...

          A Offline
          A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on 15 Sept 2019, 07:04 last edited by
          #4

          @bogong can you elaborate a bit more? What do you really want to do?

          Qt has to stay free or it will die.

          B 1 Reply Last reply 15 Sept 2019, 09:09
          0
          • A aha_1980
            15 Sept 2019, 07:04

            @bogong can you elaborate a bit more? What do you really want to do?

            B Offline
            B Offline
            bogong
            wrote on 15 Sept 2019, 09:09 last edited by
            #5

            @aha_1980 I want to add Kotlin class into QT Project and seeking solution.

            J 1 Reply Last reply 15 Sept 2019, 23:49
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 15 Sept 2019, 20:11 last edited by
              #6

              From the looks of if Kotlin is to replace Java, so you likely have to look into the direction of JNI.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              B 1 Reply Last reply 16 Sept 2019, 06:56
              3
              • B bogong
                15 Sept 2019, 09:09

                @aha_1980 I want to add Kotlin class into QT Project and seeking solution.

                J Offline
                J Offline
                JKSH
                Moderators
                wrote on 15 Sept 2019, 23:49 last edited by JKSH
                #7

                @bogong said in Kotlin in QT Project. How?:

                I want to add Kotlin class into QT Project and seeking solution.

                Ask the Kotlin community if there is a way to call Kotlin code from C++ code. If it exists, then you can use Kotlin in Qt. If it doesn't exist, then you're out of luck.

                Qt is a C++ library (mostly).

                Also, which platforms do you plan to target? Windows/Linux/Android/...?

                Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                B 1 Reply Last reply 16 Sept 2019, 05:09
                1
                • J JKSH
                  15 Sept 2019, 23:49

                  @bogong said in Kotlin in QT Project. How?:

                  I want to add Kotlin class into QT Project and seeking solution.

                  Ask the Kotlin community if there is a way to call Kotlin code from C++ code. If it exists, then you can use Kotlin in Qt. If it doesn't exist, then you're out of luck.

                  Qt is a C++ library (mostly).

                  Also, which platforms do you plan to target? Windows/Linux/Android/...?

                  B Offline
                  B Offline
                  bogong
                  wrote on 16 Sept 2019, 05:09 last edited by
                  #8

                  @jksh I know what Qt is. I am seeking solution for implementing Kotlin into Qt for Android and build it automatically like I am doing right now with Java.

                  A 1 Reply Last reply 16 Sept 2019, 05:20
                  0
                  • B bogong
                    16 Sept 2019, 05:09

                    @jksh I know what Qt is. I am seeking solution for implementing Kotlin into Qt for Android and build it automatically like I am doing right now with Java.

                    A Offline
                    A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 16 Sept 2019, 05:20 last edited by
                    #9

                    @bogong said in Kotlin in QT Project. How?:

                    I am seeking solution for implementing Kotlin into Qt for Android and build it automatically like I am doing right now with Java

                    And why can't you ask such a precise question from the beginning? I asked you two times to give a better description of you task, but you refused up to now.

                    So it seems the answer is currently: NO.

                    Regards

                    Qt has to stay free or it will die.

                    B 1 Reply Last reply 16 Sept 2019, 06:38
                    3
                    • A aha_1980
                      16 Sept 2019, 05:20

                      @bogong said in Kotlin in QT Project. How?:

                      I am seeking solution for implementing Kotlin into Qt for Android and build it automatically like I am doing right now with Java

                      And why can't you ask such a precise question from the beginning? I asked you two times to give a better description of you task, but you refused up to now.

                      So it seems the answer is currently: NO.

                      Regards

                      B Offline
                      B Offline
                      bogong
                      wrote on 16 Sept 2019, 06:38 last edited by bogong
                      #10

                      @aha_1980 It seems you only DO NOT know answer. There are solution to use Kotlin in C++ and it's in official Kotlin doc. It's making through plain C wrapper. Natively Kotlin support Objective-C and plain C. And you have to build Kotlin part like shared object for Android or static lib for iOS and then within wrapper written on Objective-C/CPP or plain C add it to CPP project that might be using in Android or iOS application. I just been seeking in-box solution in Qt (because there are global troubles in compilers, you have to build it separately and wrap it into plain C or in Java and then to use it through JNI - this way haven't tested it yet) and the question was super clear: "Is there any way to add Kotlin in QT Project?" - It was my first question. In return you asked me not about details, you asked me about WHY I need this ... I've been 2 times explaining to you what I need. And now you writing me "And why can't you ask such a precise question from the beginning?" - really???

                      Issue closed ...

                      1 Reply Last reply
                      0
                      • S SGaist
                        15 Sept 2019, 20:11

                        From the looks of if Kotlin is to replace Java, so you likely have to look into the direction of JNI.

                        B Offline
                        B Offline
                        bogong
                        wrote on 16 Sept 2019, 06:56 last edited by bogong
                        #11

                        @sgaist Directly it's not possible because of compilers, there need to be built Kotlin first on native compiler like *.so, after it wrap it into Java and after add all of it into Qt. But this way haven't tested by me yet. It's only theory.

                        1 Reply Last reply
                        0
                        • T Offline
                          T Offline
                          thomaso
                          wrote on 21 Jul 2022, 09:05 last edited by
                          #12

                          This topic is quite old but I thought I would answer it for others that might think about using Kotlin in Qt projects.

                          You can do it (at least for Android) via JNI! See this presentation from QtWS21: https://www.youtube.com/watch?v=nmvurCcsWos&t=50s

                          1 Reply Last reply
                          1
                          • P Offline
                            P Offline
                            Paul Breeuwsma
                            wrote on 14 Jul 2024, 12:18 last edited by
                            #13

                            You can use Qt in Java (so also in Kotlin) using QtJambi.

                            I made the application Mouse Melon with Kotlin and Qt.

                            1 Reply Last reply
                            0

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved