[SOLVED] QAction don't show the icons

  • I have the problem, and previously i have tried to find a solution but can't solve the problem.

    I found in the web, than the problem is the xubuntu used on my pc.
    Then recomend me configure the gnome with:
    gconftool-2 --type Boolean --set /desktop/gnome/interface/menus_have_icons True
    but all are equall.
    I have a doubt with where establish the files ".png" if it should be on "sources" or "Other Files".
    I did put on "Other Files", but.... Is this correct?
    it seems to had read that I should put it under source, if this is right, could you explain me, how do i put
    the files ".png" under "source"?

    the program is:

    @#ifndef ANOTHERMENU_H
    #define ANOTHERMENU_H

    #include <QMainWindow>
    #include <QApplication>

    class AnotherMenu : public QMainWindow
    AnotherMenu(QWidget *parent = 0);

    #endif // ANOTHERMENU_H
    @#include "anothermenu.h"
    #include <QMenu>
    #include <QMenuBar>

    AnotherMenu::AnotherMenu(QWidget *parent)
    : QMainWindow(parent)
    QPixmap newpix("new.png");
    QPixmap openpix("open.png");
    QPixmap quitpix("quit.png");

    QAction *newa = new QAction(newpix, "&New", this);
    QAction *open = new QAction(openpix, "&Open", this);
    QAction *quit = new QAction(quitpix, "&Quit", this);
    QMenu *file;
    file = menuBar()->addMenu("&File");
    connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()) );



    @#include "anothermenu.h"

    int main(int argc, char *argv[])
    QApplication a(argc, argv);

    AnotherMenu window;
    window.resize(550, 400);
    window.move(300, 300);
    window.setWindowTitle("Another Menu");
    return a.exec(&#41;;


    All function Ok, less appear the icons.
    Thanks in advance

  • Lifetime Qt Champion


    Are you sure your images are found ? Giving only the name of the file implies that they reside in the same folder as the application

  • When i start a project and in my case named : menus_toolbars2; Creator create two carpets:

    When i pasted the 3 files ".png" in the carpet menus_toolbars, i did this initially; and compile/run the program, do not appear the icons in menus.

    But When i pasted the 3 files ".png" in the second carpet, and compile/run the program, NOW already appear the icons in menus

    Thanks Sgaist for help me

Log in to reply

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