1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

consider scrollbar's width

This commit is contained in:
krepa098 2014-08-11 17:06:57 +02:00
parent 6bb85c65b8
commit 0d748b93d6
2 changed files with 5 additions and 2 deletions

View File

@ -18,6 +18,7 @@
#include <QEvent>
#include <QLayout>
#include <QScrollBar>
#include <QDebug>
AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) :
@ -35,7 +36,10 @@ void AdjustingScrollArea::resizeEvent(QResizeEvent *ev)
QSize AdjustingScrollArea::sizeHint() const
{
if (widget())
return widget()->sizeHint();
{
int scrollbarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->width() : 0;
return widget()->sizeHint() + QSize(scrollbarWidth, 0);
}
return QScrollArea::sizeHint();
}

View File

@ -113,7 +113,6 @@ Widget::Widget(QWidget *parent)
ui->mainHead->layout()->setSpacing(0);
QWidget* friendListWidget = new QWidget();
//friendListWidget->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
friendListWidget->setLayout(new QVBoxLayout());
friendListWidget->layout()->setSpacing(0);
friendListWidget->layout()->setMargin(0);