Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Unsolved QTextEdit doesn't display its corner with border-radius

    General and Desktop
    qtextedit border-radius
    3
    8
    4962
    Loading More Posts
    • 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.
    • T
      Toufi last edited by

      Hello,
      My problem is that I can't make my subclass of QTextEdit have rounded borders.
      Because when I use the stylesheet property border-radius, the corners are not displayed.

      // In my TextEdit constructor :
      setStyleSheet("border: 1px solid; border-radius:10px;");
      

      ScreenShot
      I use Windows 10 with Qt5.5.1
      I hope you will be able to help me...
      (and sorry for the bad english, I'm french ^^)

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        Hi, welcome to devnet.

        Looks like a small bug in the way stylesheets are applied. You can workaround it by explicitly setting a background color:

        setStyleSheet("border: 1px solid; border-radius:10px; background-color: palette(base); ");
        
        T Gaobo 2 Replies Last reply Reply Quote 3
        • T
          Toufi @Chris Kawa last edited by

          @Chris-Kawa It works ! Thanks for all ^^

          1 Reply Last reply Reply Quote 0
          • Gaobo
            Gaobo @Chris Kawa last edited by

            @Chris-Kawa Why is it useless to set border-radius for QTextEdit without setting a background? It's confusing to me.

            1 Reply Last reply Reply Quote 0
            • Chris Kawa
              Chris Kawa Moderators last edited by

              Apparently changing just border radius does not internally trigger changing a style from the native one to stylesheets. Like I said - could be a bug. Have a look at the source code of QWidget and setStyleSheet if you're interested.

              Gaobo 1 Reply Last reply Reply Quote 0
              • Gaobo
                Gaobo @Chris Kawa last edited by

                @Chris-Kawa Thanks. But why it is useful for QLabel.

                Chris Kawa 1 Reply Last reply Reply Quote 0
                • Chris Kawa
                  Chris Kawa Moderators @Gaobo last edited by

                  @Gaobo Sorry, I don't understand the question. Why is it useful? It's your label. How should I know why it is useful to you?

                  Gaobo 1 Reply Last reply Reply Quote 0
                  • Gaobo
                    Gaobo @Chris Kawa last edited by

                    @Chris-Kawa Sorry for my poor expresson. I mean, it's useful that I only set the border-radius for QLabel and not the background.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post