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. [SOLVED]"Update of Generated Files" message
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]"Update of Generated Files" message

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 2 Posters 2.9k Views 1 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.
  • O Offline
    O Offline
    outdoor_guy
    wrote on last edited by
    #1

    HI

    I made a now QT-Quick Project with the wizard.

    Then I changed the qmlapplicationviewer.h and .cpp to make the connection between the qml and my C++-Classes.
    Now everytime I reload the project in the Creator, I got the message:

    The following files are either outdated or have been modified:

    qmlapplicationviewer.h, qmlapplicationviewer.cpp

    Do you want Qt Creator to update the files? Any changes will be lost.

    How can I get rid of this message forever? It is very dangerous, because I click accidently "YES", all my changes are lost.

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      Well, you should not modify those files in the first place as they are generated and subject to change (the same way you should not modify code generated out of .ui files).

      What is the "connection between the qml and my C++-Classes" that absolutely requires to modify those files? QmlApplicationViewer is-a QDeclarativeView so you can access all members like the rootContext and a like to add context properties anywhere you have access to your QmlApplicationViewer, for example in main():
      @
      Q_DECL_EXPORT int main(int argc, char *argv[])
      {
      QScopedPointer<QApplication> app(createApplication(argc, argv));
      QScopedPointer<QmlApplicationViewer> viewer(QmlApplicationViewer::create());

      viewer->setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
      viewer->setMainQmlFile&#40;QLatin1String("qml/qmltest/main.qml"&#41;);
      viewer->showExpanded();
      
      // place your connection code here, outside of the generated files 
      viewer->rootContext()->setContextProperty(..., ...);
      
      return app->exec&#40;&#41;;
      

      }
      @

      1 Reply Last reply
      0
      • O Offline
        O Offline
        outdoor_guy
        wrote on last edited by
        #3

        I got from another source the following information:

        To get rid of the message, remove the checksum in the first line of qmlapplicationviewer.h and .cpp

        I did it, and it works fine for my purpose

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          Well, people also use pragmas and compiler switches to get rid of unpleasant compiler warnings - which doesn't make such a practice right too as you are fine for now, but you will probably run into serious troubles later on.

          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