QStackedWidget Background Image problem
-
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..)