Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to use JavaScript for programming in Qt? If so, is it less safe?

Is it possible to use JavaScript for programming in Qt? If so, is it less safe?

Scheduled Pinned Locked Moved General and Desktop
javascriptcommunityeditio
6 Posts 5 Posters 1.8k Views
  • 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.
  • A Offline
    A Offline
    AM10
    wrote on 7 May 2015, 23:00 last edited by AM10 5 Jul 2015, 23:02
    #1

    Dear people out there,

    May I ask you something? I am a Windows programmer, but I'm sincerely interested into dropping off down the road of Linux programming. I mean, desktop applications.

    I could learn C++ to use Qt natively, or, I could use JavaScript I learnt from webdevelopment. But would such thing be possible? Of course there are tons of plugins and extensions out there on internet. But, is it officially supported? Is it something that is allowed to enter Qt? Or are they some kind of hacks?

    The other question, whether JavaScript would be supported, are they less safe than C++ applications both made by Qt? I know that safety of program depends on programming, but even when program is written well, it would be easier to find bug in DOS or PHP, than compiled Assembly, and it's not even about how defended code is, but it's just made to be protected.

    Would making application in JavaScript, make program somehow more vulnerable than C++ program would make it? I mean, JavaScript is extremely dependent to an amount of libraries, can Qt deal with this and somehow back-up JavaScript in it? C++ on the other hand is only vulnerable if you know the compiler, nothing else can be really done to it. While JavaScript's compiler and interpreter can be hijacked. (that's why I don't like Java, many bugs)

    Sincerely, Adrian M.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 8 May 2015, 05:10 last edited by
      #2

      HI and welcome to devnet,

      Qt is a C++ toolkit so the official languange is the C++.
      Using the new technology (QtQuick) you can write the UI using the declarative language QML and some Javascript code; the business logic must be implemented in C++ (for non trivial application).

      There's no way (thanks God) to use external Javascript libraries

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tarod.net
        wrote on 8 May 2015, 07:08 last edited by
        #3

        As @mcosta said, you could use JavaScript if you develop applications using QML and Qt Quick.

        Please, read more here.

        "Individually, we are one drop. Together, we are an ocean."

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ealione
          wrote on 8 May 2015, 08:35 last edited by
          #4

          I am not sure why you would want that, but in any case @mcosta is correct. Have a look to some QML examples that use javascript here and here.

          If those examples are close to what you have in mind then a good place to start would be from here

          Moreover there is the option of using QtScript that can support scripts written in ECMAScript. A language somewhat similar to javascript. Have a look here.

          As for your security concerns I would say that it is hard to answer. You can add you qml code inside your project resources obfuscating it for example, but in general this is not a meaningful question. It depends on what you are making and how you define secure.

          1 Reply Last reply
          0
          • O Offline
            O Offline
            onek24
            wrote on 8 May 2015, 08:45 last edited by onek24 5 Aug 2015, 08:46
            #5

            You might aswell want to check out the QtQuickCompiler which allows you to compile your .qml files (containing the QML and JavaScript) which improving the startup-time. Also you won't need to deploy the .qml files with your applications, which might increase the security. :)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              AM10
              wrote on 8 May 2015, 10:18 last edited by
              #6

              Thank you for reply everybody.

              Apparently, I'd need to learn C++, but no problem, there's tons of resources out there.

              1 Reply Last reply
              0

              1/6

              7 May 2015, 23:00

              • Login

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