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

Merge pull request #336 from krepa098/master

fixes #332, #334 and other visual glitches
This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-09-28 19:21:21 +02:00
commit c05497b420
13 changed files with 49 additions and 26 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 B

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/group_2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 671 B

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>541</height>
<width>712</width>
<height>539</height>
</rect>
</property>
<property name="minimumSize">
@ -2083,8 +2083,8 @@ QSplitter:handle{
<rect>
<x>0</x>
<y>0</y>
<width>262</width>
<height>375</height>
<width>261</width>
<height>373</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5"/>
@ -2587,7 +2587,7 @@ QSplitter:handle{
</property>
<property name="icon">
<iconset resource="res.qrc">
<normaloff>:/img/group.png</normaloff>:/img/group.png</iconset>
<normaloff>:/img/group_2x.png</normaloff>:/img/group_2x.png</iconset>
</property>
<property name="flat">
<bool>true</bool>
@ -3218,7 +3218,7 @@ QSplitter:handle{
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<width>712</width>
<height>25</height>
</rect>
</property>

View File

@ -143,5 +143,6 @@
<file>translations/fi.qm</file>
<file>translations/mannol.qm</file>
<file>img/avatar_mask.png</file>
<file>img/group_2x.png</file>
</qresource>
</RCC>

View File

@ -3,18 +3,16 @@ QScrollArea {
}
QScrollBar:vertical {
background: transparent;
width: 14px;
margin-top: 2px;
margin-bottom: 2px;
background: rgb(65,65,65);
width: 16px;
padding: 0px 3px 0px 3px;
}
QScrollBar:handle:vertical {
background: rgba(18, 18, 18, 204);
min-height: 20px;
border-radius: 3px;
margin-left: 3px;
margin-right: 1px;
border-radius: 5px;
margin: 3px 0px 3px 0px;
}
QScrollBar:handle:vertical:hover {

View File

@ -21,14 +21,19 @@
#include <QScrollBar>
#include <QDebug>
AdjustingScrollArea::AdjustingScrollArea(QWidget *parent) :
QScrollArea(parent)
AdjustingScrollArea::AdjustingScrollArea(QWidget *parent)
: QScrollArea(parent)
{
}
void AdjustingScrollArea::resizeEvent(QResizeEvent *ev)
{
int scrollBarWidth = verticalScrollBar()->isVisible() ? verticalScrollBar()->sizeHint().width() : 0;
if (layoutDirection() == Qt::RightToLeft)
setViewportMargins(-scrollBarWidth, 0, 0, 0);
updateGeometry();
QScrollArea::resizeEvent(ev);
}
@ -43,3 +48,16 @@ QSize AdjustingScrollArea::sizeHint() const
return QScrollArea::sizeHint();
}
bool AdjustingScrollArea::eventFilter(QObject *obj, QEvent *ev)
{
if (ev->type() == QEvent::Paint)
{
// workaround: sometimes a child widget gets drawn on top of the scrollbar
// so we trigger a repaint afterwards
verticalScrollBar()->update();
horizontalScrollBar()->update();
}
return QObject::eventFilter(obj, ev);
}

View File

@ -25,12 +25,9 @@ class AdjustingScrollArea : public QScrollArea
public:
explicit AdjustingScrollArea(QWidget *parent = 0);
virtual void resizeEvent(QResizeEvent *ev);
virtual void resizeEvent(QResizeEvent *ev) override;
virtual QSize sizeHint() const override;
signals:
public slots:
virtual bool eventFilter(QObject *obj, QEvent *ev) override;
};
#endif // ADJUSTINGSCROLLAREA_H

View File

@ -19,6 +19,7 @@
#include "group.h"
#include "settings.h"
#include "widget/form/groupchatform.h"
#include "widget/maskablepixmapwidget.h"
#include <QPalette>
#include <QMenu>
#include <QContextMenuEvent>
@ -38,7 +39,8 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
textLayout.setMargin(0);
setLayoutDirection(Qt::LeftToRight); // parent might have set Qt::RightToLeft
avatar.setPixmap(QPixmap(":img/group.png"));
avatar = new MaskablePixmapWidget(this, QSize(40,40), QString(), Qt::transparent);
avatar->setPixmap(QPixmap(":img/group.png"));
statusPic.setPixmap(QPixmap(":img/status/dot_online.png"));
name.setText(Name);
QFont small;
@ -65,7 +67,7 @@ GroupWidget::GroupWidget(int GroupId, QString Name)
textLayout.addStretch();
layout.addSpacing(20);
layout.addWidget(&avatar);
layout.addWidget(avatar);
layout.addSpacing(5);
layout.addLayout(&textLayout);
layout.addStretch();
@ -118,7 +120,7 @@ void GroupWidget::setAsActiveChatroom()
QPalette pal3;
pal3.setColor(QPalette::Background, Qt::white);
this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/group_dark.png"));
avatar->setPixmap(QPixmap(":img/group_dark.png"));
}
void GroupWidget::setAsInactiveChatroom()
@ -137,7 +139,7 @@ void GroupWidget::setAsInactiveChatroom()
QPalette pal3;
pal3.setColor(QPalette::Background, QColor(65,65,65,255));
this->setPalette(pal3);
avatar.setPixmap(QPixmap(":img/group.png"));
avatar->setPixmap(QPixmap(":img/group.png"));
}
void GroupWidget::updateStatusLight()

View File

@ -20,6 +20,8 @@
#include <QLabel>
#include "genericchatroomwidget.h"
class MaskablePixmapWidget;
class GroupWidget : public GenericChatroomWidget
{
Q_OBJECT
@ -39,7 +41,8 @@ signals:
public:
int groupId;
QLabel avatar, name, nusers, statusPic;
QLabel name, nusers, statusPic;
MaskablePixmapWidget* avatar;
};
#endif // GROUPWIDGET_H

View File

@ -23,6 +23,10 @@ MaskablePixmapWidget::MaskablePixmapWidget(QWidget *parent, QSize size, QString
, clickable(false)
{
setFixedSize(size);
QPixmap pmapMask = QPixmap(maskName);
if (!pmapMask.isNull())
mask = QPixmap(maskName).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}