fixed color Buttons with basic html functions

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@406 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-23 14:55:05 +00:00
parent 06cb4cf01f
commit ba87009a25
3 changed files with 17 additions and 4 deletions

View File

@ -72,7 +72,10 @@ ChatDialog::ChatDialog(QWidget *parent)
/* to hide the header */
ui.msgSendList->header()->hide();
textColor = Qt::black;
textColor = Qt::black;
QPixmap pxm(24,24);
pxm.fill(textColor);
ui.colorChatButton->setIcon(pxm);
/* Hide platform specific features */
@ -277,7 +280,10 @@ void ChatDialog::setColor()
{
textColor = QColorDialog::getColor(Qt::black, this);
QPixmap pxm(24,24);
pxm.fill(textColor);
pxm.fill(textColor);
ui.lineEdit->setText(QString(tr("<a style=\"color:")) + (textColor.name()));
this->insertAutour(tr("\">"), tr("</style>"));
this->ui.lineEdit->setFocus();
ui.colorChatButton->setIcon(pxm);
}

View File

@ -97,7 +97,8 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
fontmenu->addAction(ui.actionUnderline);
fontmenu->addAction(ui.actionItalic);
fontmenu->addAction(ui.actionStrike);
ui.fontButton->setMenu(fontmenu);
ui.fontButton->setMenu(fontmenu);
}
@ -117,7 +118,7 @@ void PopupChatDialog::show()
if(!this->isVisible()) {
QMainWindow::show();
} else {
//QMainWindow::activateWindow();
QMainWindow::activateWindow();
setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
QMainWindow::raise();
}
@ -136,6 +137,9 @@ void PopupChatDialog::setColor()
if (col.isValid()) {
ui.colorButton->setPalette(QPalette(col));
ui.lineEdit->setText(QString(tr("<a style=\"color:")) + (col.name()));
this->insertAutour(tr("\">"), tr("</style>"));
this->ui.lineEdit->setFocus();
QTextCharFormat fmt;
fmt.setForeground(col);
colorChanged(col);
@ -316,3 +320,5 @@ void PopupChatDialog::insertAutour(QString leftTruc,QString rightTruc)
}

View File

@ -61,6 +61,7 @@ public slots:
void insertStrike();
void insertAutour(QString leftTruc,QString rightTruc);
protected:
void closeEvent (QCloseEvent * event);