Important: Please read the Qt Code of Conduct -

Doesn't know what to use

  • Hi, thanks for taking the time to instruct me.

    I would like to create a widget for my QTabWidget. I would like something like this


    I tried with QPushButton (QHBoxLayout, QVBoxLayout) ans QAction (QMenu, QMenuBar) but the I can't manage to create an harmony AND the last 2 button doenst appear (I made the image with paint)

    For QPushButton, here the result :


    For some reason the two bottom button sprite doesn't appear.

    QPixmap *pixUpMap = new QPixmap("upMap.png");
    upMap = new QPushButton;

    Did QPushButton only accept square image?

    Is there some class I don't know yet that could help me with that?

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    First thing: there's no need in your case to allocate your QPixmap on the heap.

    Now your real problem is that you are using a relative path for your upMap.png file. Since by default Qt Creator uses shadow build (which is a good thing), the file won't be found at execution time. Either integrate your images using Qt's resource system or use the full path to them.

  • Thanks for the tips. It didn't work but I have found a way to make it work. The two image I was trying to use were created by a "right-clic, new, bitmap" and I changed their extention in ".png".
    So I re-create them and now, it works out well :


  • @DPixel if your issue is solved, please don't forget to mark your post as such. Thanks

Log in to reply