Qt World Summit: Register Today!

XPM Icons Work in Designer but not in App

  • I have some old XPMs I would like to use as icons. When I set the pixmap to an XPM for a QLabel in designer, it works fine. When I build my App (using cmake), and run, the icons don't show up. I don't have this problem with PNGs. Any ideas? As a workaround, I used GIMP to create snapshots of these XPMs and saved them as PNGs. However, I work like to know how to get XPMs work in an App.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    How are you trying to load your XPM images ?

  • Using the generated code (ui_MyGUI.h):

        QLabel *myXpmLabel;
           myXpmLabel = new QLabel(myTab);
            gridLayout_3->addWidget(myXpmLabel, 12, 5, 1, 1);

  • @DougyDrumz Hi this code is working for me, so your should work too:

    void MainWindow::on_toolButton_clicked()
    QLabel *myLabel = new QLabel();

    What's your Qt version?

  • It is 4.6.2.

  • Lifetime Qt Champion

    And does it work when you give to full path to the file ?

Log in to reply