示例#1
0
OneToOneRoom::OneToOneRoom(avc::ChatClient* client, const std::wstring& remote)
{
	remote_ = remote;
	client_ = client;
	setupUi(this);
	userInfoWidget->show();
	rightLayout->addWidget(new QSizeGrip(this), 0, Qt::AlignBottom | Qt::AlignRight);
	textBrowser->setFrameStyle(QFrame::NoFrame);
	textEdit->setFrameStyle(QFrame::NoFrame);

	QFile file(":/Resources/scrollbar.qss");
	file.open(QFile::ReadOnly | QFile::Text);
	QTextStream in(&file);
	QString content = in.readAll();
	textBrowser->verticalScrollBar()->setStyleSheet(content);
	textEdit->verticalScrollBar()->setStyleSheet(content);

	addPicBtn->setIcon(QIcon(":/Resources/image.png"));
	addVoiceBtn->setIcon(QIcon(":/Resources/voice.png"));
	sendFileBtn->setIcon(QIcon(":/Resources/file.png"));
	titleBar->setTitle(QString("%1@public chat room").arg(QString::fromStdWString(client_->getEmail())));
	textEdit->setFocus();
	titleBar->setTitle(QString("%1->%2").arg(QString::fromStdWString(client_->getEmail()), QString::fromStdWString(remote_)));


	new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_T), this, SLOT(test()));
	connect(pushButton, SIGNAL(clicked()), this, SLOT(onSendClicked()));
	connect(addPicBtn, SIGNAL(clicked()), this, SLOT(onAddPicClicked()));
	connect(sendFileBtn, SIGNAL(clicked()), this, SLOT(sendFile()));
	//connect(stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(stackedWidgetCurrentChanged(int)));
}
示例#2
0
ChatPage::ChatPage(QWidget *parent) :
    QWidget(parent)
{
    setupUi(this);
    connect(sendButton, &QPushButton::clicked, [this]() {
        emit onSendClicked();
    });
}