Results 1 to 7 of 7

Thread: using a busy indicator when loading component

  1. #1
    Join Date
    Jun 2016
    Posts
    99
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default using a busy indicator when loading component

    I want to use a busyIndicator when loading a qml component.... but no indicator appears

    qml

    Qt Code:
    1. BusyIndicator {
    2. id: userEvent_busyInd
    3. anchors.centerIn: parent
    4. anchors.verticalCenterOffset: 100
    5. z: 100
    6. running: usereventcomponent.status === usereventcomponent.Loading
    7. }
    8.  
    9. Action {
    10. id: action_userEventLogBtn
    11. enabled:!inSequence
    12. onTriggered:{
    13. //----Code to Load User Event Dialog-----//
    14. UserEventLog.init();
    15. weld_view.state = "USEREVENT"
    16. xmui.insertLogMessage(rootItem.getUserName(), "User entered userEventDialog");
    17. }
    18. }
    19.  
    20. State {
    21. name: "USEREVENT"
    22. PropertyChanges {target: mask; visible:true; z: 1;}
    23. PropertyChanges {target: usereventlog_loader; sourceComponent:usereventcomponent;}
    24. }
    25.  
    26. Loader{
    27. id: usereventlog_loader
    28. width: 1300
    29. height: 600
    30. anchors.horizontalCenter: parent.horizontalCenter
    31. anchors.verticalCenter: parent.verticalCenter
    32. sourceComponent: null
    33. z: 3
    34. }
    35.  
    36. Component {
    37. id: usereventcomponent
    38. UserEventDialog {
    39. id: userEventLog
    40. }
    41. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: using a busy indicator when loading component

    Does the loading take long enough for the indicator to even become visually recognizable?

    Does it show when you just set its "running" property to true?

    Cheers,
    _

  3. #3
    Join Date
    Jun 2016
    Posts
    99
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: using a busy indicator when loading component

    yes it shows when I set the running property to true.

    I was wondering the same thing if it takes long enough for the indicator to be visible I'm not sure how to tell. I eventually want to use the busyIndicator to when searching database... but would like to get simpler version working first when jsut the qml component loads....

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: using a busy indicator when loading component

    The Loader could be too quick for you to notice the indicator.

    Try something like a Timer element to change a boolean property after a noticable time, e.g. 200ms.

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    jfinn88 (27th September 2016)

  6. #5
    Join Date
    Jun 2016
    Posts
    99
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: using a busy indicator when loading component

    that's what I was thinking I will give it a try...

    update: not able to get it working right....

    the interval property seems to delay the busyIndacator image from appearing instead of the component...

    Qt Code:
    1. Timer {
    2. id: delay
    3. interval: 5000
    4. onTriggered:{
    5. userEvent_busyInd.running = true
    6. }
    7. }
    8.  
    9. BusyIndicator {
    10. id: userEvent_busyInd
    11. anchors.centerIn: parent
    12. anchors.verticalCenterOffset: 100
    13. z: 100
    14. running: true //usereventcomponent.status === usereventcomponent.Loading
    15. }
    16.  
    17. Component.onCompleted: {
    18. delay.stop();
    19. userEvent_busyInd.running = false
    20. }
    To copy to clipboard, switch view to plain text mode 

    action that loads component

    Qt Code:
    1. Action {
    2. id: action_userEventLogBtn
    3. enabled:!inSequence
    4. onTriggered:{
    5. //----Code to Load User Event Dialog-----//
    6. UserEventLog.init();
    7. weld_view.state = "USEREVENT"
    8. xmui.insertLogMessage(rootItem.getUserName(), "User entered userEventDialog");
    9. //onLoaded: console.log("User Event Log");
    10.  
    11. //---Busy Indicator---//
    12. delay.start();
    13. }
    14. //Component.onCompleted: {
    15. //userEvent_busyInd.running = false
    16. //}
    17. }
    18.  
    19. State {
    20. name: "USEREVENT"
    21. PropertyChanges {target: mask; visible:true; z: 1;}
    22. PropertyChanges {target: usereventlog_loader; sourceComponent:usereventcomponent;}
    23. }
    24.  
    25. Component {
    26. id: usereventcomponent
    27. UserEventDialog {
    28. id: userEventLog
    29. }
    30. }
    31.  
    32. Loader{
    33. id: usereventlog_loader
    34. width: 1300
    35. height: 600
    36. anchors.horizontalCenter: parent.horizontalCenter
    37. anchors.verticalCenter: parent.verticalCenter
    38. sourceComponent: null
    39. z: 3
    40. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jfinn88; 27th September 2016 at 21:32.

  7. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: using a busy indicator when loading component

    I was thinking more along the lines of using the timer to stop the busy indicator instead of starting it.
    Simulating the operation you will later on want to end the busy indicator when its done.

    Cheers,
    _

  8. #7
    Join Date
    Jun 2016
    Posts
    99
    Thanks
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: using a busy indicator when loading component

    I see... let me mess around with it... thanks

Similar Threads

  1. Busy Indicator using QProgressDialog??
    By qtzcute in forum Qt Programming
    Replies: 13
    Last Post: 6th September 2011, 12:31
  2. QProgress bar - Busy Indicator - Strange behaviour
    By johnnyturbo3 in forum Newbie
    Replies: 4
    Last Post: 27th April 2011, 14:56
  3. Replies: 1
    Last Post: 19th July 2010, 12:43
  4. QProgressBar, stylesheet, and the busy indicator
    By latency in forum Qt Programming
    Replies: 0
    Last Post: 3rd September 2009, 02:10
  5. QProgressBar busy indicator
    By Michiel in forum Qt Tools
    Replies: 2
    Last Post: 1st August 2007, 17:54

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.