Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QStackedWidget Background Image problem
Forum Updated to NodeBB v4.3 + New Features

QStackedWidget Background Image problem

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 3.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zgulser
    wrote on last edited by
    #1

    Hi,

    After I migrated from Qt 4.4 to Qt 4.8, I'm experiencing with the following problem regarding css I suppose.

    For your information, nothing changed in the name of code in my project including my qss file during migration.

    The problem is related with the following code segments;

    @
    void GuiManager::switchView(int viewType) {
    if(viewType == LOGIN_VIEW) {
    this->setObjectName("LoginMainWindow");
    _currentView = viewType;
    _ui.stackedWidget->setCurrentIndex(LOGIN_VIEW);
    } else if(viewType == MAIN_VIEW) {
    this->setObjectName("MainWindow");
    QString name = _ui.stackedWidget->currentWidget()->objectName();
    _currentView = viewType;
    _ui.stackedWidget->setCurrentIndex(MAIN_VIEW);
    }

    }

    @

    This is where I set the GUIManager object name and set the current stack widget.

    and the qss regarding the issue is;

    @
    QWidget#LoginMainWindow > .QWidget {
    background-image: url(:/images/loginBg.png) ;
    background-color: #f5f5f5;
    background-position: left top;
    background-repeat: no-repeat;
    }

    QWidget#MainWindow > .QWidget {
    background-image: url(:/images/bg.png);
    background-color: #f5f5f5;
    background-position: left top;
    background-repeat: no-repeat;
    }

    @

    LoginMainWindow is working just perfect. But after I logged in and view control passed to MainWindow, background doesn't change and remains the same(LoginMainWindow's background keeps staying at the background.)

    I just didn't understand the situation since these piece of codes worked OK in Qt 4.4 .

    Any ideas?

    PS: I also noticed that QTabWidget's style seemed a bit changed after the migration, but fortunately it was managable..)

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved