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 last edited by
    #1

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

    aha_1980A 1 Reply Last reply
    0
    • B bogong

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

      aha_1980A Offline
      aha_1980A Offline
      aha_1980
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi @bogong,

      why?

      Qt has to stay free or it will die.

      B 1 Reply Last reply
      1
      • aha_1980A aha_1980

        Hi @bogong,

        why?

        B Offline
        B Offline
        bogong
        wrote on last edited by
        #3

        @aha_1980 because ...

        aha_1980A 1 Reply Last reply
        -1
        • B bogong

          @aha_1980 because ...

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on 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
          0
          • aha_1980A aha_1980

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

            B Offline
            B Offline
            bogong
            wrote on last edited by
            #5

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

            JKSHJ 1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on 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
              3
              • B bogong

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

                JKSHJ Offline
                JKSHJ Offline
                JKSH
                Moderators
                wrote on 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
                1
                • JKSHJ JKSH

                  @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 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.

                  aha_1980A 1 Reply Last reply
                  0
                  • B bogong

                    @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.

                    aha_1980A Offline
                    aha_1980A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 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
                    3
                    • aha_1980A aha_1980

                      @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 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
                      • SGaistS SGaist

                        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 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 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 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