Stylesheet using a network paste.



  • Hi, i am triyng change a style sheet of one widget mine. After 2 seconds a background image have to change. The images is in a network paste, but they don't change. Somebody can help me?

    @ QString path = "\\192.168.6.33\conciliacao\Monitor\Imagens";
    QDir imagens;
    imagens.setPath(path);
    imagens.setFilter(QDir::Files | QDir::NoDotAndDotDot);
    for(int y = 0; y < imagens.entryList().size(); y++){
    QString astyle = "background-image: url(" + path + imagens.entryList().at(y) + ");";
    ui->widgetImagens->setStyleSheet(astyle);
    Sleep(2000);
    }@



  • Hi,

    this line
    @QString + imagens.entryList().at(y) + ");";@

    looks strange. I think you should mend it first=)



  • haha the Qt project dont let my variable show(the name was just "style").



  • indeed my problem is that i want use a image that was not include in resource, can i do that?


  • Moderators

    Make sure the path is OK. Print it after adding to the QDir. Also, consider using one of QUrl static methods.

    QDir expects paths given in Unix notation (forward slash as separator).


Log in to reply
 

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