3
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->verticalScrollBar()->width();

Im trying to get the width of verticalScrollBar of QScrollArea. So I ran the code above and I got “member access into incomplete type QScrollBar error”. What did I do wrong? and How can i get the width of verticalScrollBar?

lll
  • 302
  • 3
  • 13

1 Answers1

5

The solution is to #include <QScrollBar> because verticalScrollBar() returns a QScrollBar* and you de-reference that pointer and call width(), for that to work you need to include QScrollBar header file.

Zlatomir
  • 6,964
  • 3
  • 26
  • 32