Hello!

I am with a problem to increment the QProgressBar before starting the DB connection. Cde below

Qt Code:
  1. void defConexao::criaArquivoConfServidor(QString host, QString porta)
  2. {
  3. funcoesDB = new bancoDados;
  4. bool retorno = true;
  5. caixaMensagens mensagem;
  6.  
  7. this->barraProgresso->setMaximum(2);
  8. this->barraProgresso->setMinimum(0);
  9. int valorProgresso = 0;
  10.  
  11. if(!DB.isOpen())
  12. {
  13. DB = funcoesDB->adicionarBancoDados(DB);
  14. valorProgresso = 1;
  15. this->barraProgresso->setValue(valorProgresso);
  16. }
  17.  
  18. if(funcoesDB->conectar(DB, host, porta))
  19. {
  20. qDebug() << "Conectou";
  21. funcoesDB->fechar(DB);
  22.  
  23. valorProgresso = 2;
  24. this->barraProgresso->setValue(valorProgresso);
  25. }
  26. else
  27. {
  28. mensagem.fecharMensagem("erro", "Banco de dados", "Não foi possÃ*vel conectar ao banco de dados");
  29. this->barraProgresso->reset();
  30. retorno = false;
  31. }
  32. }
To copy to clipboard, switch view to plain text mode 

The problem is that the progress bar does not set the value of the first function before it try to connect, that occurs in the second function. It sets all the values just before trying to connect. Why is that?

Thank you a lot.