qDebug()<<view_->horizontalScrollBar()->height(); //30
view_->resize(
200 + view_->horizontalScrollBar()->height(),
200+view_->horizontalScrollBar()->height()
);
view_->setScene(scene_);
rect->setBrush(Qt::red);
rect->setPos(0,0);
scene_->addItem(rect);
bt->move(15,15);
view_ = new QGraphicsView(this);
qDebug()<<view_->horizontalScrollBar()->height(); //30
view_->resize(
200 + view_->horizontalScrollBar()->height(),
200+view_->horizontalScrollBar()->height()
);
scene_ = new QGraphicsScene(0,0,200,200,this);
view_->setScene(scene_);
QGraphicsRectItem *rect = new QGraphicsRectItem(QRect(0,0,20,20));
rect->setBrush(Qt::red);
rect->setPos(0,0);
scene_->addItem(rect);
QPushButton *bt=new QPushButton("ok",this);
bt->move(15,15);
To copy to clipboard, switch view to plain text mode
Bookmarks