1

How do I get a single text line with only a horizontal scollbar?

I think that's all there is to this question.

I've tried it with QLineEdit only or withing QScrollArea, with QTextEdit etc, and nothing was remotly close to working properly.

That's what I got so far:

enter image description here

It total it reads "Textexample", but the QLineEdit cuts it off and the QScrollArea doesn't provide a functional horizontal scrollbar.

In the end I'd like to have a single text line, with a horizontal scrollbar so with the scrollbar I can see everything that's inside the text line.

Thanks in advance. If more information is need, I'd be happy to help.

Cpt. Crazy
  • 115
  • 1
  • 11
  • Can you please add a minimal reproducible example (as code) to your question to make your efforts visible and reproducible for us? THX :-) – R Yoda Dec 01 '19 at 16:29
  • since I work with the qt creator designer i can only provide you with html code :/ – Cpt. Crazy Dec 01 '19 at 16:33
  • Fair point :-) Did you try to set the `horizontalScrollBarPolicy` property of the `QTextEdit` to `ScrollBarAlwaysOn` – R Yoda Dec 01 '19 at 16:38
  • ... and `lineWrapMode` to `NoWrap`? – R Yoda Dec 01 '19 at 16:40
  • I'll give it a try if i find it :D – Cpt. Crazy Dec 01 '19 at 16:41
  • @RYoda So if I had programmed everything with the creator itself, I coudl've just modified it with a single line in the code, but I can't find the option in the designer to do that and I don't think I can modify it in any other way :/ – Cpt. Crazy Dec 01 '19 at 16:51
  • 1
    @Cpt.Crazy he told about replacing `QLineEdit` by `QTextEdit` – Vladimir Bershov Dec 01 '19 at 16:56
  • I am confused. Without seeing your Object inspector it is difficult to say what's the problem... See may screen shot in the answer... – R Yoda Dec 01 '19 at 16:56
  • Thanks. I was an idiot and looked into the `QLineEdit` options and not `QTextEdit`, my bad :D But now that i changed it, it works perfectly :) – Cpt. Crazy Dec 01 '19 at 17:02

1 Answers1

2

See the fat properties of the QTextEdit:

enter image description here

R Yoda
  • 8,358
  • 2
  • 50
  • 87