[Solved] The Qt classwizard example can't display image under windows7



  • It seems that
    @
    setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark1.png"));
    @

    doesn't work properly under win7, I compile and run this example under xp, it works as expected and displays the image, when I copy the classwizard.exe back to win7, it can't still display the image. I add the following code:

    @
    QLabel *label2 = new QLabel;
    label2->setPixmap(QPixmap(":/images/background.png"));
    label2->show();
    @

    lable2 can display the image properly. So what's wrong with it? Thanks in advance.



  • Hi,

    first of all, please use the @-tags for code highlighting.
    did you try to diosplay the watermark1.png in the label? just to ensure, this image works?



  • Sorry, that was my first post and I didn't konw that.
    Yes, the code
    @
    QLabel *label2 = new QLabel;
    label2->setPixmap(QPixmap(":/images/watermark1.png"));
    label2->show();
    @
    can display the image waermark1.png properly under win7 in label2.
    None of the pictures of this example can display in any pages of classwizard example under win7, when I copy the classwizard.exe from win7 to xp, the program works fine and all the pictures can display properly. I'm wondering what prevents the pictures from displaying in win7.
    Anyone else has tested it?
    Thank you.



  • Do you have the same environment in win7 (dll, qt plugins, etc.) there on win7 as on win XP?



  • [quote author="Gerolf" date="1304750586"]Do you have the same environment in win7 (dll, qt plugins, etc.) there on win7 as on win XP?[/quote]

    I built this example statically so it's a stand-alone executable and doesn't rely on libgcc_s_dw2-1.dll, mingwm10.dll,QtCore4.dll,QtGui4.dll .
    Besides, the picture's format is png, so it doesn't need any plugin, right?
    Despite of whether the example is built in win7 or xp, the result is the same. I run it on other's pc(win7), the picture won't appear, but in xp, everything is right. Is this a bug?
    Or, something wrong with my system?



  • Hi CrazyWind,

    I just tried out the example and had a look at the docs. The wizard behaves exaclty as described :-)
    If you set the style to Classic, it shows the pixmaps:

    @
    setWizardStyle(QWizard::ClassicStyle);
    @

    have a look at the "docs of QWizard":http://doc.qt.nokia.com/4.7/qwizard.html#wizard-look-and-feel

    On Win7, it hase Aero style by default, as all other things on winb7 get the win7 style :-)

    bq. wizardStyle
    This property holds the look and feel of the wizard.
    By default, QWizard uses the AeroStyle on a Windows Vista system with alpha compositing enabled, regardless of the current widget style. If this is not the case, the default wizard style depends on the current widget style as follows: MacStyle is the default if the current widget style is QMacStyle, ModernStyle is the default if the current widget style is QWindowsStyle, and ClassicStyle is the default in all other cases.



  • [quote author="Gerolf" date="1304756083"]Hi CrazyWind,

    I just tried out the example and had a look at the docs. The wizard behaves exaclty as described :-)
    If you set the style to Classic, it shows the pixmaps:

    @
    setWizardStyle(QWizard::ClassicStyle);
    @

    have a look at the "docs of QWizard":http://doc.qt.nokia.com/4.7/qwizard.html#wizard-look-and-feel

    On Win7, it hase Aero style by default, as all other things on winb7 get the win7 style :-)

    [/quote]

    Yeah, you got the point! It works now. ^^ Thank you!
    PS: I prefer to use @setWizardStyle(QWizard::ModernStyle);@ instead of @setWizardStyle(QWizard::ClassicStyle);@
    otherwise the code @setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));@ may still fail. ^
    ^


Log in to reply
 

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