Solved scroll of the textBrowser
-
I created a textBrowser dynamically, but the scroll graphically is different of the scroll that I create in ui:
How I can do for do them equal
-
Hi
Make them same size ? -
@vale88
make sure you are previewing it in the same style as you are actually using.
if you don't know which style your app is using set it with the app->setStyle("fusion"); function.
The "fusion" style is the one they recommend for cross platform consistency. -
@mrjj No, the same style, if you see, the style in the two photos is different
-
@kenchan in the code how must I write?
-
@vale88
Usually after you have created the instance of the QApplication object, then call the setStyle("fusion"); of the app object.
something like myapp->setStyle("fusion");
see it in the docs here -
@kenchan it doesn't work
-
Hi! If you just want to set the default style for scrollbar, then put this code in your stylesheet and add to
qApp->setStyleSheet()
or set it to the widget usingsetStyleSheet
method:QScrollBar:horizontal { background-color: none; } QScrollBar::add-page:horizontal, QScrollBar::sub-page:horizontal { background: none; } QScrollBar:vertical { background-color: none; } QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical { background: none; }
This will be the default scrollbar.
-
@Cobra91151 yes but this code how must I write it?Because I have a textBrowser
-
I just described above, there are two options:
- Make it global for all scrollbars across your app using
qApp->setStyleSheet()
- Make it only for the
textBrowser
(textBrowser->setStyleSheet()
)
Choose what you want.
- Make it global for all scrollbars across your app using
-
@Cobra91151 but all the code with ""?
-
@Cobra91151 thanks a lot, it works
-
Ok. So, make it solved then.