Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Debug specific code
Qt 6.11 is out! See what's new in the release blog

Debug specific code

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 737 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.
  • R Offline
    R Offline
    Ravisha
    wrote on last edited by
    #1

    We need to add few code , for ex : skip few UI during debug or add new UI for debug . would like to include this only for debug.
    For now , we manage with isDebug flag in the main qml file. We are setting this vaue from the QML launcher cpp code.(Pardon me if the terminologies arent apt as i am quite new). But i need to set the flag before the instnace is created.Is there a way to achieve this.

    QT : 4.8 , cant update to latest due to hardware and config limitations

    QDeclarativeView viewer;
    viewer.setStyleSheet("background:grey");
    viewer.setSource(QUrl("qrc:/K/IBK/main.qml"));
    QGraphicsObject *rootObject = viewer.rootObject();
    rootObject->setProperty("isDebug",true);
    
    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can use a Loader to load different (or none) QML files depending on whether your isDebug property is true or false.

      (Z(:^

      R 1 Reply Last reply
      2
      • sierdzioS sierdzio

        You can use a Loader to load different (or none) QML files depending on whether your isDebug property is true or false.

        R Offline
        R Offline
        Ravisha
        wrote on last edited by
        #3

        @sierdzio Quite right. Although i would prefer to not change code flow much. If i could just set this flag before instance creation

        sierdzioS 1 Reply Last reply
        0
        • R Ravisha

          @sierdzio Quite right. Although i would prefer to not change code flow much. If i could just set this flag before instance creation

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @Ravisha said in Debug specific code:

          @sierdzio Quite right. Although i would prefer to not change code flow much. If i could just set this flag before instance creation

          You could do it with File Selectors, but they are not available in Qt 4. I don't see any other possibility.

          (Z(:^

          1 Reply Last reply
          2

          • Login

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