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. Border-radius won't apply to the current widget
QtWS25 Last Chance

Border-radius won't apply to the current widget

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.2k Views
  • 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.
  • youzkingY Offline
    youzkingY Offline
    youzking
    wrote on last edited by
    #1

    hello,
    i want to set the border radius of the current widget by @setStylSheet("border-radius: 5px")@
    but nothing appear when showing the widget
    for information i set the @FramelessWindowHint@ Flag for my window
    it style a rectangle window , no radius :(

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      AFAIK this wont work for a top level window.
      As an alternative you can add a QWidget to the Window and set radius from the stylesheet to this QWidget and also need
      @
      setAttribute(Qt::WA_TranslucentBackground);
      setWindowFlags(Qt::FramelessWindowHint);
      @

      Tested above with a QDialog.

      157

      1 Reply Last reply
      0
      • youzkingY Offline
        youzkingY Offline
        youzking
        wrote on last edited by
        #3

        i want to apply this to my top level widget :(

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Styelsheets wont work here. Other than that you reimplement paintEvent and draw it all yourself. Have a look at "shapedclock":http://qt-project.org/doc/qt-5/qtwidgets-widgets-shapedclock-example.html

          157

          1 Reply Last reply
          0
          • youzkingY Offline
            youzkingY Offline
            youzking
            wrote on last edited by
            #5

            thanks , (y)
            this is a good idea , (y)

            1 Reply Last reply
            0

            • Login

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