Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

member access into incomplete type ‘QScrollBar’ [duplicate]

Tags:

qt

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?

like image 607
lll Avatar asked Oct 20 '25 23:10

lll


1 Answers

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.

like image 133
Zlatomir Avatar answered Oct 22 '25 20:10

Zlatomir