Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Building Qt Quick project in Visual Studio
Forum Updated to NodeBB v4.3 + New Features

Building Qt Quick project in Visual Studio

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 4 Posters 466 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.
  • D Offline
    D Offline
    Dmitry87
    wrote on 16 Jan 2021, 21:17 last edited by
    #1

    I'm trying to build Qt QML project in Visual Studio 2019 using Qt Tools for Visual stuido and have one problem.
    In .pro file I have these lines:

    QML_IMPORT_NAME = PRJ1
    QML_IMPORT_MAJOR_VERSION = 1
    

    and in main.qml:

    import PRJ1
    

    These line are needed to import custom QML types.
    I converted .pro to .vcxproj via "Qt Tools for Visual stuido " and the converter didn't add "PRJ1" to vcxproj. When i start the program it crahshes with error that PRJ1 is not defined. If I remove "import PRJ1" it works but without custom types. How should QML_IMPORT_NAME and QML_IMPORT_MAJOR_VERSION be defined in visual studio project?

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VeNToR
      wrote on 11 Feb 2021, 14:23 last edited by
      #2

      @Dmitry87 said in Building Qt Quick project in Visual Studio:

      I have the same problem. Where I have to config QML_IMPORT_NAME etc. in Visual Studio ?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        ferretzhu
        wrote on 28 Feb 2021, 15:20 last edited by
        #3

        I had the same problem when using VS2015.
        I tried qt example project openglunderqml did the same error.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          Krakenus00
          wrote on 28 Feb 2021, 15:54 last edited by Krakenus00
          #4

          You should consider using qmlRegisterType() function. Check the example here.
          Also, you can try to edit something in the .vcproj settings, as it has almost all of the .pro settings:
          VS settings

          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