forked from blue/squawk
fancy shadows in conversations
This commit is contained in:
parent
b2699e0087
commit
3d15682b37
@ -21,6 +21,7 @@
|
||||
#include <QDebug>
|
||||
#include <QScrollBar>
|
||||
#include <QTimer>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
Conversation::Conversation(Models::Contact* p_contact, QWidget* parent):
|
||||
QWidget(parent),
|
||||
@ -63,12 +64,38 @@ Conversation::Conversation(Models::Contact* p_contact, QWidget* parent):
|
||||
vs->setBackgroundRole(QPalette::Base);
|
||||
vs->setAutoFillBackground(true);
|
||||
connect(vs, SIGNAL(valueChanged(int)), this, SLOT(onSliderValueChanged(int)));
|
||||
|
||||
applyVisualEffects();
|
||||
}
|
||||
|
||||
Conversation::~Conversation()
|
||||
{
|
||||
}
|
||||
|
||||
void Conversation::applyVisualEffects()
|
||||
{
|
||||
QGraphicsDropShadowEffect *e1 = new QGraphicsDropShadowEffect;
|
||||
e1->setBlurRadius(10);
|
||||
e1->setXOffset(0);
|
||||
e1->setYOffset(-2);
|
||||
e1->setColor(Qt::black);
|
||||
m_ui->bl->setGraphicsEffect(e1);
|
||||
|
||||
QGraphicsDropShadowEffect *e2 = new QGraphicsDropShadowEffect;
|
||||
e2->setBlurRadius(7);
|
||||
e2->setXOffset(0);
|
||||
e2->setYOffset(2);
|
||||
e2->setColor(Qt::black);
|
||||
m_ui->ul->setGraphicsEffect(e2);
|
||||
|
||||
QGraphicsDropShadowEffect *e3 = new QGraphicsDropShadowEffect;
|
||||
e3->setBlurRadius(10);
|
||||
e3->setXOffset(0);
|
||||
e3->setYOffset(2);
|
||||
e3->setColor(Qt::black);
|
||||
m_ui->ut->setGraphicsEffect(e3);
|
||||
}
|
||||
|
||||
void Conversation::setName(const QString& name)
|
||||
{
|
||||
m_ui->nameLabel->setText(name);
|
||||
|
@ -68,6 +68,7 @@ protected:
|
||||
void setState(Shared::Availability state);
|
||||
void setStatus(const QString& status);
|
||||
void setName(const QString& name);
|
||||
void applyVisualEffects();
|
||||
|
||||
protected slots:
|
||||
void onContactChanged(Models::Item* item, int row, int col);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>572</width>
|
||||
<height>377</height>
|
||||
<height>485</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
@ -70,7 +70,23 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_3" native="true">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<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>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="statusIcon">
|
||||
<property name="text">
|
||||
@ -120,6 +136,32 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="ul" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
@ -129,9 +171,18 @@
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="midLineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
@ -141,7 +192,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>572</width>
|
||||
<height>95</height>
|
||||
<height>111</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
@ -164,7 +215,42 @@
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="bl" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>scrollArea</zorder>
|
||||
<zorder>bl</zorder>
|
||||
<zorder>ul</zorder>
|
||||
<zorder>widget_3</zorder>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widget_2" native="true">
|
||||
<property name="sizePolicy">
|
||||
@ -173,6 +259,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
@ -190,7 +279,23 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="panel" native="true">
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<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>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="smilesButton">
|
||||
<property name="text">
|
||||
@ -267,6 +372,38 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="ut" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>2</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="messageEditor">
|
||||
@ -294,6 +431,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>messageEditor</zorder>
|
||||
<zorder>ut</zorder>
|
||||
<zorder>panel</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "messageline.h"
|
||||
#include <QDebug>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
MessageLine::MessageLine(QWidget* parent):
|
||||
QWidget(parent),
|
||||
@ -72,7 +73,7 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
|
||||
QWidget* message = new QWidget();
|
||||
message->setLayout(vBox);
|
||||
message->setBackgroundRole(QPalette::AlternateBase);
|
||||
message->setAutoFillBackground(true);;
|
||||
message->setAutoFillBackground(true);
|
||||
|
||||
QLabel* body = new QLabel(msg.getBody());
|
||||
body->setTextInteractionFlags(body->textInteractionFlags() | Qt::TextSelectableByMouse);
|
||||
@ -93,6 +94,14 @@ MessageLine::Position MessageLine::message(const Shared::Message& msg)
|
||||
vBox->addWidget(body);
|
||||
vBox->addWidget(time);
|
||||
|
||||
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
|
||||
effect->setBlurRadius(10);
|
||||
effect->setXOffset(1);
|
||||
effect->setYOffset(1);
|
||||
effect->setColor(Qt::black);
|
||||
|
||||
message->setGraphicsEffect(effect);
|
||||
|
||||
if (msg.getOutgoing()) {
|
||||
//body->setAlignment(Qt::AlignRight);
|
||||
sender->setAlignment(Qt::AlignRight);
|
||||
|
Loading…
Reference in New Issue
Block a user