Bug 427632

Summary: Wizard with steps doesn't update step status icons
Product: [openSUSE] openSUSE 11.1 Reporter: Lukas Ocilka <locilka>
Component: YaST2Assignee: Stefan Hundhammer <shundhammer>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Major    
Priority: P2 - High CC: bluedzins, coolo, dmacvicar, dmueller, fmfischer, guillaume.gardet, jack.hodge, schaefer.frank, tgoettlicher
Version: Beta 1   
Target Milestone: Beta 3   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: logs
Screenshot
Test case

Description Lukas Ocilka 2008-09-19 08:49:05 UTC
Created attachment 240486 [details]
logs

Even if SLES uses the openSUSE theme during installation, is still doesn't show the current steps and also doesn't show which steps have been already done.

I've used
http://dist.suse.de/install/SLP/SLES-11-Build0043/i386/DVD1/
Comment 1 Lukas Ocilka 2008-09-19 08:50:00 UTC
Created attachment 240487 [details]
Screenshot
Comment 2 Stefan Hundhammer 2008-09-19 10:01:12 UTC
Looks like that code that loads icons for the new and shiny installation via Qt style sheets never does any checking (!!!) if anything really could be loaded. It simply ignores any error and happily continues.

Even worse, it dumps misleading information (!) to the logs that normal people would interpret as "everything OK":

QYStyler.cc:

bool QY2Styler::updateRendering( QWidget *wid )
{
    if (!wid)
       return false;

    QString name = wid->objectName();

    if ( !_backgrounds.contains( name ) )
        return false;

    if (! wid->isVisible() || !wid->updatesEnabled() )
        return false;

    if ( _backgrounds[name].pix.isNull() )
    {
        QString back = _backgrounds[ name ].filename;
        _backgrounds[ name ].pix = QImage( back ); // Load image from file

        // Log message that looks like success (even if it failed)
        qDebug() << "loading " << qPrintable( back ) << " for " << qPrintable( name );

        // No check with QImage::isNull(), no error handling
    }
    ...
}
Comment 3 Stefan Hundhammer 2008-09-23 10:37:00 UTC
I just saw the same on openSUSE-11.1 Beta1, so it's not just a SLE-11 problem.

The theme is there allright, the installation.qss style sheet is there and looks good, the icons are referenced by their correct names in that style sheet, and the icons are there. Everything looks reasonable so far.

My (wild) guess is that the (very fragile IMHO) mechanism to make this work might not work any more in libqt4: 

When the status is to change, YQWizard::Step::setStatus() doesn't change the pixmap directly (QLabel::setPixmap()). Rather, it changes the widget's Qt class name via the QProperty mechanism, hoping that Qt will apply all styles defined in the current style sheet (installation.qss).


http://svn.opensuse.org/svn/yast/trunk/qt/src/YQWizard.cc

void YQWizard::Step::setStatus( Status s )
{
    if ( !_statusLabel || !_nameLabel || _status == s )
        return;

    _status = s;

    if ( s == Todo )
    {
        _statusLabel->setProperty( "class", "todo-step-status QLabel" );
        _nameLabel->setProperty( "class", "todo-step-name QLabel" );
    }

    if ( s == Done )
    {
        _statusLabel->setProperty( "class", "done-step-status QLabel" );
        _nameLabel->setProperty( "class", "done-step-name QLabel" );
    }

    if ( s == Current )
    {
        _statusLabel->setProperty( "class", "current-step-status QLabel" );
        _nameLabel->setProperty( "class", "current-step-name QLabel" );
    }

    _statusLabel->style()->polish( _statusLabel );
    _nameLabel->style()->polish( _nameLabel );
}



http://svn.opensuse.org/svn/yast/trunk/theme/openSUSE/wizard/installation.qss

.todo-step-status {
   qproperty-pixmap: url(white-step-todo.png);
   max-width: 14px;
   min-width: 14px;
}

.done-step-status {
   qproperty-pixmap: url(white-step-done.png);
   max-width: 14px;
   min-width: 14px;
}

.current-step-status {
   qproperty-pixmap: url(white-step-current.png);
   max-width: 14px;
   min-width: 14px;
}
Comment 4 Stefan Hundhammer 2008-09-23 16:13:45 UTC
Using the most recent version of the Qt-Libs from http://download.opensuse.org/repositories/KDE:/Qt/openSUSE_11.0/ , I can now reproduce the problem locally with the Wizard3.ycp example.

So this seems to be indeed a change in libqt4 that now does things slightly differently. I wonder if it is documented anywhere in the Qt reference documentation that changing a widget class property on the fly (ugh?!) should have any effect. I couldn't find anything in the docs about it.

I didn't even find any documentation of a Qt property "class" in the Qt4 ref docs.

That code in QY2Styler / YQWizard might rely on side effects that now behave differently. Will continue investigating.
Comment 5 Stefan Hundhammer 2008-09-23 16:38:34 UTC
Another examples for QObject::setProperty( "class" ):

http://doc.trolltech.com/4.4/widgets-stylesheet-mainwindow-cpp.html

    ui.nameLabel->setProperty("class", "mandatory QLabel");

Similar usage there.
Comment 6 Stefan Hundhammer 2008-09-23 17:34:35 UTC
The behaviour changed from libqt4-4.4.0 (openSUSE-11.0) to libqt4-4.4.2-1.1 (openSUSE-11.1 / SLE-11): QObject::setProperty("class", ...) and a subsequent mywidget->style()->polish( mywidget ) used to apply the style again in the old version, and it doesn't do it any longer in the new version.
Comment 7 Stefan Hundhammer 2008-09-23 17:39:49 UTC
Created attachment 241200 [details]
Test case

Test case, made from the Qt4 standard example under /usr/lib/qt4/examples/widgets/stylesheet :

Toggle the "accept license terms" check box. With the older libqt, it will change the color of the "age" spinbox's label immediately. With the newer libqt, it will only apply the change if you open the style sheet editor, apply another style and then apply the "coffee" style again.

Tested on snell.suse.de with libqt4-4.4.2 vs. belana.suse.de with libqt4-4.4.0 .
Comment 8 Stefan Hundhammer 2008-09-23 17:41:49 UTC
Relevant part of the test case:


void MainWindow::on_agreeCheckBox_stateChanged()
{
    bool mandatory = ! ui.agreeCheckBox->isChecked();
    
    qDebug() << "Mandatory age: " << mandatory;

    ui.ageLabel->setProperty( "class", 
        mandatory ? "mandatory QLabel" : "QLabel" );
    ui.ageLabel->style()->polish( ui.ageLabel );
}

Comment 9 Stefan Hundhammer 2008-09-23 17:47:43 UTC
IMHO this is a regression and needs to be addressed on the libqt4 level.

-> libqt4 maintainer (dmueller according to PDB)
Comment 10 Stephan Binner 2008-09-23 18:04:42 UTC
*** Bug 427947 has been marked as a duplicate of this bug. ***
Comment 11 Stephan Binner 2008-10-04 13:04:35 UTC
*** Bug 432297 has been marked as a duplicate of this bug. ***
Comment 12 Dirk Mueller 2008-10-07 14:44:03 UTC
*** Bug 432631 has been marked as a duplicate of this bug. ***
Comment 13 Dirk Mueller 2008-10-11 23:48:52 UTC
I can no longer replicate the issue with the Factory version of Qt (4.4.3)
Comment 14 Lukas Ocilka 2008-10-12 10:48:50 UTC
r
Comment 15 Lukas Ocilka 2008-10-12 10:49:33 UTC
So, it must have been FIXED, definitely not "WORKSFORME".
Comment 16 Stefan Hundhammer 2008-10-17 14:12:47 UTC
It's back. I can reproduce it on snell.suse.de with libqt4-4.4.3-11.1 .
Comment 17 Stefan Hundhammer 2008-10-17 14:16:03 UTC
*** Bug 436229 has been marked as a duplicate of this bug. ***
Comment 18 Stefan Hundhammer 2008-10-17 14:17:47 UTC
This can also be reproduced with the Wizard3.ycp UI example

http://svn.opensuse.org/svn/yast/trunk/ycp-ui-bindings/examples/Wizard3.ycp


    /usr/lib/YaST2/bin/y2base ./Wizard3.ycp qt

with default stylesheet (grey) or with

    export Y2STYLE="installation.qss"

(colored installation style).
Comment 19 Stefan Hundhammer 2008-10-17 14:46:53 UTC
Same problem with libqt4-4.4.3-15.1 from http://download.opensuse.org/repositories/KDE:/Qt/openSUSE_11.0/
Comment 20 Martin Schmidkunz 2008-10-23 12:13:10 UTC
*** Bug 431573 has been marked as a duplicate of this bug. ***
Comment 21 Stephan Kulow 2008-10-28 16:12:30 UTC
fixed in yast2-qt
Comment 22 Stefan Hundhammer 2008-10-28 16:15:45 UTC
Fixed in yast2-qt >= 2.17.17
Comment 23 Michal Seben 2008-10-29 15:20:16 UTC
*** Bug 439563 has been marked as a duplicate of this bug. ***
Comment 24 Guillaume GARDET 2008-11-04 16:07:31 UTC
Still in beta4 !! I have to reopen it or the fix was not integrated to beta4?
Comment 25 Stephan Kulow 2008-11-04 18:09:30 UTC
the fix was only checked in this sunday
Comment 26 Jiri Srain 2008-11-05 09:33:37 UTC
*** Bug 439034 has been marked as a duplicate of this bug. ***
Comment 27 Stefan Hundhammer 2008-11-26 13:08:25 UTC
*** Bug 445500 has been marked as a duplicate of this bug. ***