3 InfoTab::InfoTab(QWidget *parent)
4 : QWidget(parent, Qt::FramelessWindowHint)
6 layout = new QGridLayout(this);
7 userPicture = new QLabel;
8 userNameLabel = new QLabel;
9 messageLabel = new QLabel;
10 addressLabel = new QLabel;
11 timeLabel = new QLabel;
12 QLabel *clockLabel = new QLabel;
13 QLabel *envelopeLabel = new QLabel;
14 QLabel *compassLabel = new QLabel;
15 QToolButton *sendLocationButton = new QToolButton;
16 QToolButton *updateStatusMessageButton = new QToolButton;
18 sendLocationButton->setIcon(QIcon(QPixmap(":/resources/reload_icon.png")));
19 updateStatusMessageButton->setIcon(QIcon(QPixmap(":/resources/sendPosition_icon.png")));
21 clockLabel->setPixmap(QPixmap(":/resources/clock_small.png"));
22 envelopeLabel->setPixmap(QPixmap(":/resources/list_small.png"));
23 compassLabel->setPixmap(QPixmap(":/resources/compas_small.png"));
24 layout->addWidget(userPicture,0,0,4,1);
25 layout->addWidget(userNameLabel,0,2,1,2);
26 layout->addWidget(clockLabel,1,1,1,1);
27 layout->addWidget(envelopeLabel,2,1,1,1);
28 layout->addWidget(compassLabel,3,1,1,1);
29 layout->addWidget(timeLabel,1,2,1,1);
30 layout->addWidget(messageLabel,2,2,1,1);
31 layout->addWidget(addressLabel,3,2,1,1);
32 layout->addWidget(sendLocationButton,0,3,2,1);
33 layout->addWidget(updateStatusMessageButton,1,3,2,1);
59 void InfoTab::paintEvent(QPaintEvent *aPaintEvent)
61 //Look and feel settings
63 QColor myColor(Qt::black);
65 qpalette.setColor(QPalette::Background,myColor);
69 QRect widgetRect = this->rect();
70 QPainter painter(this);
73 painter.setRenderHint(QPainter::Antialiasing);
74 QPainterPath roundedRect;
75 roundedRect.addRoundedRect(1,1,widgetRect.width() - 2, widgetRect.height()-2,roundness,roundness);
77 painter.setClipPath(roundedRect);
78 QRegion maskRegion = painter.clipRegion();
82 painter.fillPath(roundedRect,QBrush(myColor));
86 void InfoTab::setAvatar(const QPixmap &avat)
89 userPicture->setPixmap(avat);
92 void InfoTab::setUserName(const QString &usernam)
94 if(userName == usernam)
97 userNameLabel->setText(userName);
100 void InfoTab::setMessageText(const QString &text)
102 if(messageText == text)
105 messageLabel->setText(messageText);
108 void InfoTab::setAddress(const QString &addr)
113 addressLabel->setText(address);
116 void InfoTab::setTime(const QString &tim)
121 timeLabel->setText(time);