[SOLVED] progress bar problem



  • hello , i want to update a progress bar from the function in a external file but i am unable to call the object and it says

    error: C2143: syntax error : missing ';' before '.'
    for code Ui::subwindow.progressbar.setValue(value+1) //can be seen below

    please guide how to solve the problem

    ---------file.cpp-----------------
    @include <otherfile.h>
    include ....

    subwindow::subwindow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::subwindow)
    {
    ui->setupUi(this);
    fxn();
    }

    int subwindow::fxn
    {
    ui->progress_bar->setMinimum(0);
    ui->progress_bar->setMaximum(100);
    abc(x,y);
    }@

    ---------------------------------otherfile.cpp---------
    @include <file.h>

    abc(int x,int y)
    {
    value = Ui::subwindow.progressbar->value();
    do {
    if (xxx == false)
    Ui::subwindow.progressbar->setValue(value+1)
    } while (xxx =! false);

    }@

    qxoz: code tags added



  • You are calling the class directly. You need to access your progress bar through object. In this example

    It should be like

    <object ofsubwindow class>.ui->progress_bar->setvalue(10)



  • You need fix compilation error at first. Add ; after Ui::subwindow.progressbar->setValue(value+1) .


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.