Fix chat scroll bar widget jumping

Hovering over the chat window's scroll bar was causing it to jump
around. Replaced the 12px style spacing that was causing the problem
with a widget-based solution.
This commit is contained in:
David Rowe 2014-05-25 16:41:01 -07:00
parent 6bb933996f
commit 97e5c928a4
2 changed files with 34 additions and 10 deletions

View file

@ -80,7 +80,7 @@ ChatWindow::ChatWindow(QWidget* parent) :
} else { } else {
ui->numOnlineLabel->hide(); ui->numOnlineLabel->hide();
ui->closeButton->hide(); ui->closeButton->hide();
ui->usersWidget->hide(); ui->usersArea->hide();
ui->messagesScrollArea->hide(); ui->messagesScrollArea->hide();
ui->messagePlainTextEdit->hide(); ui->messagePlainTextEdit->hide();
connect(&XmppClient::getInstance(), SIGNAL(joinedPublicChatRoom()), this, SLOT(connected())); connect(&XmppClient::getInstance(), SIGNAL(joinedPublicChatRoom()), this, SLOT(connected()));
@ -208,7 +208,7 @@ void ChatWindow::connected() {
ui->connectingToXMPPLabel->hide(); ui->connectingToXMPPLabel->hide();
ui->numOnlineLabel->show(); ui->numOnlineLabel->show();
ui->closeButton->show(); ui->closeButton->show();
ui->usersWidget->show(); ui->usersArea->show();
ui->messagesScrollArea->show(); ui->messagesScrollArea->show();
ui->messagePlainTextEdit->show(); ui->messagePlainTextEdit->show();
ui->messagePlainTextEdit->setFocus(); ui->messagePlainTextEdit->setFocus();

View file

@ -128,19 +128,43 @@ QPushButton:pressed {
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QWidget" name="usersWidget" native="true"> <widget class="QWidget" name="usersArea" native="true">
<property name="styleSheet"> <property name="sizePolicy">
<string notr="true">#usersWidget { <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
margin-right: 20px; <horstretch>0</horstretch>
}</string> <verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<item>
<widget class="QWidget" name="usersWidget" native="true"/>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QScrollArea" name="messagesScrollArea"> <widget class="QScrollArea" name="messagesScrollArea">
<property name="styleSheet">
<string notr="true">margin-top: 12px;</string>
</property>
<property name="horizontalScrollBarPolicy"> <property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum> <enum>Qt::ScrollBarAlwaysOff</enum>
</property> </property>