Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Doesn't know what to use
Forum Updated to NodeBB v4.3 + New Features

Doesn't know what to use

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 3 Posters 764 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DPixel
    wrote on 27 May 2018, 18:40 last edited by DPixel
    #1

    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

    0_1527446068971_WhatIWant.png

    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 :

    :0_1527454053277_WhatIWant2.png

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

    QPixmap *pixUpMap = new QPixmap("upMap.png");
    upMap = new QPushButton;
    upMap->setIcon(*pixUpMap);
    upMap->setIconSize(pixUpMap->size());

    Did QPushButton only accept square image?

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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 27 May 2018, 21:34 last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      4
      • D Offline
        D Offline
        DPixel
        wrote on 27 May 2018, 22:02 last edited by
        #3

        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 :

        0_1527458492974_final.png

        P 1 Reply Last reply 28 May 2018, 15:17
        0
        • D DPixel
          27 May 2018, 22:02

          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 :

          0_1527458492974_final.png

          P Offline
          P Offline
          Pablo J. Rogina
          wrote on 28 May 2018, 15:17 last edited by
          #4

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

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          2

          1/4

          27 May 2018, 18:40

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved