-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchatwidget.cpp
More file actions
48 lines (40 loc) · 889 Bytes
/
Copy pathchatwidget.cpp
File metadata and controls
48 lines (40 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "chatwidget.h"
ChatWidget::ChatWidget(QWidget *parent):
QWidget(parent)
{
setWindowTitle(tr("PartyZone chat"));
#if !WITHOUT_CHAT
browserView = new QWebView(this);
QGridLayout * la = new QGridLayout();
la->addWidget(browserView, 0, 0);
setLayout(la);
#endif
}
void ChatWidget::openUrl(const QUrl & url)
{
#if !WITHOUT_CHAT
browserView->load(url);
#endif
}
void ChatWidget::showDelayed(int timeout)
{
#if !WITHOUT_CHAT
QTimer::singleShot(timeout * 1000, this, &ChatWidget::show);
#endif
}
void ChatWidget::show()
{
#if !WITHOUT_CHAT
QWidget::show();
setFocus(Qt::OtherFocusReason);
#endif
}
void ChatWidget::keyPressEvent(QKeyEvent *event)
{
#if !WITHOUT_CHAT
/* Скрыть окно по нажатию на Alt+C */
if ((event->modifiers() & Qt::AltModifier) && event->key() == Qt::Key_C) {
hide();
}
#endif
}