Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Is there a loading widget?



  • Hi,

    I need to widget, which will be use, when the application will be start. So this is a "loading / waiting widget". I know there is a QProgressBar, but I don't know how long will be application started. I need something like GIF, where we have loop:

    widget.png

    How can I do that?


  • Lifetime Qt Champion

    Hi,

    It seems you are looking for QSplashScreen.



  • @SGaist Thank you, but I find something, what I'm looking for:

        QProgressBar *bar = new QProgressBar(this);
        bar->setGeometry(50,50,300,40);
        bar->setTextVisible(false);
        bar->setStyleSheet("QProgressBar::chunk {    background-color: #2196F3; width: 10px;  margin: 0.5px;}");
        bar->setMinimum(0);
        bar->setMaximum(0);
    

    Now I have exactly, what I want, but I have 2 other problems:

    1. how to change speed of move blue rectangles in this progressBar?
    2. how to change the amount of blue rectangles in progressBar? I know that I can change width in styleSheet to 20 px, but I would like to have width = 10 px, but I would like to change percent of blue rectangles to 20% in progressBar.

  • Lifetime Qt Champion

    1. AFAIK you can't
    2. AFAIK the number is dependent on the width of the bar and the number of steps.


  • @qwe3 said in Is there a loading widget?:

    how to change speed of move blue rectangles in this progressBar?
    how to change the amount of blue rectangles in progressBar? I know that I can change width in styleSheet to 20 px, but I would like to have width = 10 px, but I would like to change percent of blue rectangles to 20% in progressBar.

    If you don't like the granularity of the QProgressBar then you'll have to design a custom widget that does what you need. Looks like the granularity of progress is fixed or precacluted by the stock widget.


Log in to reply