0

As the title says, I set the indeterminate property of the ProgressBar to True, but he doesn't have any animation.

Just like this:

enter image description here

But: I use the default project and the code is very simple.

I would like to know if the indeterminate itself does not have any animation or what is wrong with it?

Thanks for your help.

By the way, this is the first time I'm looking for answers here, so I hope it will be a pleasant experience :)

version: Qt6.1.1 MinGW 64-bit (default Debug Version)

The code is as follows:

import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    ProgressBar{
        id: proBar
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: parent.top
        height: 20
        from: 1
        to: 1
        indeterminate: true
    }
}

Yes, that's all the code in my qml. The rest of the file did not change a word

  • I would try with another style (e.g. Material): https://doc.qt.io/qt-5/qtquickcontrols2-styles.html#using-styles-in-qt-quick-controls. If it works with another style, then it's probably a bug, and can be reported here: bugreports.qt.io – Mitch Jul 08 '21 at 16:17

1 Answers1

0

I think it relates to your Qt version , I test your code in my Qt . I use Qt5.14 and GCC compiler, the result is this :

enter image description here

For adding Style :

in main.cpp put this

QQuickStyle::setStyle("Universal");

like this :

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickStyle>

int  main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication  app(argc, argv);

    QQuickStyle::setStyle("Universal");

    QQmlApplicationEngine  engine;
    const QUrl             url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl)
    {
        if (!obj && (url == objUrl))
        {
          QCoreApplication::exit(-1);
        }
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}

and in .pro file add this :

QT += quick quickcontrols2

Edited code

import QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Universal 2.12

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")

    Universal.theme: Universal.Dark
    Universal.accent: Universal.Red
    ProgressBar{
        id: proBar
        anchors.left: parent.left
        anchors.right: parent.right
        anchors.top: parent.top
        height: 70
        from: 1
        to: 1
        indeterminate: true
    }
}

enter image description here

Parisa.H.R
  • 3,303
  • 3
  • 19
  • 38
  • Thank you for your answer. Now the empty project is fine, but after I add the style he doesn't work ...... After adding the style, should I implement this effect myself? – MoEvilHeart Jul 09 '21 at 02:03
  • How did you set your style? And which style did you set? – Parisa.H.R Jul 09 '21 at 08:07