Important: Please read the Qt Code of Conduct -

QtScrollBar right border in QTextEdit is not shown

  • Hi everyone,

    I want a QTextEdit with a scroll bar as shown in the picture below, but I am not able to display the
    right border of the QTextEdit and it looks like the scroll bar is covering it. Has someone an idea,
    how I can make the border on the right hand side appear again?

    0_1552328829524_ScrollBar border.png

  • Lifetime Qt Champion

    Could you post the stylesheet code as text so one can try it out?

  • Ye, sorry for that:

    QTextEdit  {
        background-color: white;
        border-style: outset;
        border-width: 2px;
        border-radius: 16px;
        border-color: black;
        font: bold 12px;
        min-width: 1em;
    QScrollBar:vertical {
    	background: transparent;
    	background-color: transparent;
    	width: 15px; 
    	margin: 10px 10px 0px -5px;
    QScrollBar::handle {
    	background: rgb(211,211, 211);;
    	border: 2px solid black;
       border-radius: 6px;
    	margin: 0px 2px 0px 2px;
    QScrollBar::add-line:vertical {
       height: 0px;
    	subcontrol-position: bottom;
    	subcontrol-origin: margin;
    QScrollBar::sub-line:vertical {
    	height: 0 px;
    	subcontrol-position: top;
    	subcontrol-origin: margin;

  • Lifetime Qt Champion

    Np. its just with stylesheet its often impossible to just guess :)

    Anyway, i get another result than you.
    alt text
    So i wonder if you have some stylesheet on the parent ( blue box) that target QWidget and also
    affect the scrollbar/text edit also.

  • Thank you, indeed it was a scroll area in the background, that leaded to this behaviour.
    I put it now in a QGroupBox and everything works fine.

Log in to reply