Solved Fixed size of scrollbar in qscrollarea not fully show up.
-
code:
ui->scrollArea->verticalScrollBar()->setMinimumWidth(50); QWidget *cen = new QWidget; QVBoxLayout *layout = new QVBoxLayout(cen); layout->addWidget(plabela); layout->addWidget(plabelb); ui->scrollArea->setWidget(cen); ui->scrollArea->setWidgetResizable(true);
result:
https://drive.google.com/file/d/1jzXNbhqDqHKCuItitUy_EgCnh_wVkJ6I/view?usp=sharing -
Hi
I just did it with stylesheet
QScrollBar::vertical{width:50px;} -
Thanks!
It's so convinent with stylesheet. -
@doodle
Hi
Yes often yes. :)
Not sure the scrollArea->verticalScrollBar() is in a layout or why setMinimumWidth
have no effect. -
By the way, what's the situation of stylesheet in qt? I found that the qt creator not support it very well.
-
@doodle
Hi
What you mean , not support in what way.?
Creator even has a build in stylesheet editor :)
-
I mean syntax completion and validation.
-
@doodle
Well the editor does syntax check but it has no code completion. But does open
webpage with help on F1. There is still no API to ask for values from stylesheet (in code) and
Creator cant auto apply stylesheets when u create say a new form.
But other than that , its ok supported. -
Got it, thank you for your details.
-
@doodle
np. as a final note.
Since stylesheets are cascading.
It works best setting stylesheet on QApplication as then
all forms and Widgets t are created are affected.
Also keeps stylesheet as one file and much easier to
maintain than setting stylesheet many places.