Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Change edges of QWidget

Change edges of QWidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgetqpushbuttonwidgetstyesheetgeneral problem
3 Posts 3 Posters 581 Views 1 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.
  • J Offline
    J Offline
    Joe von Habsburg
    wrote on last edited by
    #1

    Hello, I want to create a QWidget and style it the way I want. I want to change its appearance but I have no idea what to do. Can you help me?

    image_2025-05-20_132627110.png

    37cb8a35-1ebf-4cc1-879c-5d8d54a12502-image.png

    jsulmJ Pl45m4P 2 Replies Last reply
    0
    • J Joe von Habsburg

      Hello, I want to create a QWidget and style it the way I want. I want to change its appearance but I have no idea what to do. Can you help me?

      image_2025-05-20_132627110.png

      37cb8a35-1ebf-4cc1-879c-5d8d54a12502-image.png

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Joe-von-Habsburg You can override paintEvent and draw what ever you want there.
      See https://stackoverflow.com/questions/71131972/how-to-draw-custom-shape-in-qt-by-using-combining-many-shapes

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • J Joe von Habsburg

        Hello, I want to create a QWidget and style it the way I want. I want to change its appearance but I have no idea what to do. Can you help me?

        image_2025-05-20_132627110.png

        37cb8a35-1ebf-4cc1-879c-5d8d54a12502-image.png

        Pl45m4P Offline
        Pl45m4P Offline
        Pl45m4
        wrote on last edited by Pl45m4
        #3

        @Joe-von-Habsburg

        The bottom one is easy.
        Just subclass QPushButton, implement your own paintEvent and draw a circle that matches your specs.
        Done.

        For the top button, the "WiFi"/intensity button thing:
        [1] Either make a widget that internally holds three QPushButton widgets shaped in the way you need (also by implementing paintEvent)
        OR
        [2] you create your own button class that defines and draws these three areas and performs click-checks on them to emit your own signal depending on which section was clicked.
        Something like

        void IntensityButton::clicked(int intensity)
        

        where you pass 0, 1 or 2 or maybe even some enum class values (LOW, MEDIUM, HIGH) with your signal.

        The faster and simpler way is [1], [2] might take a little more effort to implement properly, but is more versatile and can be used in many ways to customize your widget even more.
        Personally, I would opt for approach [2].


        If debugging is the process of removing software bugs, then programming must be the process of putting them in.

        ~E. W. Dijkstra

        1 Reply Last reply
        2

        • Login

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