示例#1
0
int TextEdit::setCurrentCharFormat( lua_State * L )// ( const QTextCharFormat & format )
{
	QTextEdit* obj = ObjectHelper<QTextEdit>::check( L, 1);
	QTextCharFormat* modifier = ValueInstaller2<QTextCharFormat>::check( L, 2 );
	obj->setCurrentCharFormat( *modifier );
	return 0;
} 
示例#2
0
void ChatWidget::sendChat()
{
	QTextEdit *chatWidget = ui->chatTextEdit;

	if (chatWidget->toPlainText().isEmpty()) {
		// nothing to send
		return;
	}

	QString text;
	RsHtml::optimizeHtml(chatWidget, text);
	std::wstring msg = text.toStdWString();

	if (msg.empty()) {
		// nothing to send
		return;
	}

#ifdef CHAT_DEBUG
	std::cout << "ChatWidget:sendChat " << std::endl;
#endif

	if (rsMsgs->sendPrivateChat(peerId, msg)) {
		QDateTime currentTime = QDateTime::currentDateTime();
		addChatMsg(false, name, currentTime, currentTime, QString::fromStdWString(msg), TYPE_NORMAL);
	}

	chatWidget->clear();
	// workaround for Qt bug - http://bugreports.qt.nokia.com/browse/QTBUG-2533
	// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
	chatWidget->setCurrentCharFormat(QTextCharFormat ());
}
示例#3
0
void QTextEditProto::setCurrentCharFormat(const QTextCharFormat &format)
{
  QTextEdit *item = qscriptvalue_cast<QTextEdit*>(thisObject());
  if (item)
    item->setCurrentCharFormat(format);
}