Added the ability to have bold, underlined or font in italics.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@529 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
rwoodruff91 2008-04-29 19:19:07 +00:00
parent a282b9fa74
commit 2d40e6cef4
3 changed files with 308 additions and 207 deletions

View File

@ -29,7 +29,12 @@ BlogDialog::BlogDialog(QWidget *parent)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
setupUi(this); setupUi(this);
connect(Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg())); connect(sendBtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
connect(boldBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(underlineBtn, SIGNAL(clicked()), this, SLOT(setFont()));
connect(italicBtn, SIGNAL(clicked()), this, SLOT(setFont()));
mCurrentFont = QFont("Comic Sans MS", 8);
} }
@ -37,9 +42,25 @@ void BlogDialog::sendMsg()
{ {
QString msg = lineEdit->toPlainText(); QString msg = lineEdit->toPlainText();
msgText->setCurrentFont(mCurrentFont);
/* Write text into windows */ /* Write text into windows */
msgText->append(msg); msgText->append(msg);
/* Clear lineEdit */ /* Clear lineEdit */
lineEdit->clear(); lineEdit->clear();
} }
void BlogDialog::setFont()
{
mCurrentFont.setUnderline(underlineBtn->isChecked());
mCurrentFont.setItalic(italicBtn->isChecked());
mCurrentFont.setBold(boldBtn->isChecked());
lineEdit->setFont(mCurrentFont);
lineEdit->setFocus();
}

View File

@ -39,6 +39,14 @@ public:
public slots: public slots:
void sendMsg(); void sendMsg();
void setFont();
private slots:
/*nothing here yet */
private:
QFont mCurrentFont;
}; };
#endif #endif

View File

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>479</width> <width>471</width>
<height>320</height> <height>418</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
@ -504,211 +504,283 @@
<property name="windowIcon" > <property name="windowIcon" >
<iconset/> <iconset/>
</property> </property>
<layout class="QGridLayout" > <widget class="QWidget" name="" >
<property name="leftMargin" > <property name="geometry" >
<number>6</number> <rect>
<x>0</x>
<y>0</y>
<width>463</width>
<height>403</height>
</rect>
</property> </property>
<property name="topMargin" > <layout class="QGridLayout" >
<number>0</number> <property name="leftMargin" >
</property> <number>0</number>
<property name="rightMargin" > </property>
<number>6</number> <property name="horizontalSpacing" >
</property> <number>-1</number>
<property name="bottomMargin" > </property>
<number>0</number> <property name="verticalSpacing" >
</property> <number>1</number>
<item row="0" column="0" > </property>
<widget class="QSplitter" name="splitter" > <item row="0" column="0" >
<property name="baseSize" > <layout class="QGridLayout" >
<size> <item row="0" column="0" >
<width>2</width> <layout class="QGridLayout" >
<height>0</height> <property name="leftMargin" >
</size> <number>0</number>
</property> </property>
<property name="orientation" > <property name="topMargin" >
<enum>Qt::Horizontal</enum> <number>0</number>
</property> </property>
<widget class="QWidget" name="layoutWidget" > <property name="rightMargin" >
<layout class="QGridLayout" > <number>0</number>
<property name="leftMargin" > </property>
<number>0</number> <property name="bottomMargin" >
</property> <number>0</number>
<property name="topMargin" > </property>
<number>0</number> <property name="horizontalSpacing" >
</property> <number>6</number>
<property name="rightMargin" > </property>
<number>0</number> <property name="verticalSpacing" >
</property> <number>6</number>
<property name="bottomMargin" > </property>
<number>0</number> <item row="0" column="0" >
</property> <layout class="QGridLayout" >
<property name="horizontalSpacing" > <property name="leftMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="verticalSpacing" > <property name="topMargin" >
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0" > <property name="rightMargin" >
<layout class="QGridLayout" > <number>0</number>
<property name="leftMargin" > </property>
<number>0</number> <property name="bottomMargin" >
</property> <number>0</number>
<property name="topMargin" > </property>
<number>0</number> <property name="horizontalSpacing" >
</property> <number>6</number>
<property name="rightMargin" > </property>
<number>0</number> <property name="verticalSpacing" >
</property> <number>6</number>
<property name="bottomMargin" > </property>
<number>0</number> <item row="0" column="0" >
</property> <widget class="QLabel" name="label" >
<property name="horizontalSpacing" > <property name="text" >
<number>6</number> <string/>
</property> </property>
<property name="verticalSpacing" > <property name="pixmap" >
<number>6</number> <pixmap resource="images.qrc" >:/images/chat.png</pixmap>
</property> </property>
<item row="0" column="1" > </widget>
<spacer> </item>
<property name="orientation" > <item row="0" column="1" >
<enum>Qt::Horizontal</enum> <widget class="QLabel" name="label_12" >
</property> <property name="font" >
<property name="sizeHint" > <font>
<size> <pointsize>10</pointsize>
<width>181</width> <weight>75</weight>
<height>20</height> <bold>true</bold>
</size> </font>
</property> </property>
</spacer> <property name="text" >
</item> <string>Blog Feed:</string>
<item row="0" column="0" > </property>
<layout class="QGridLayout" > </widget>
<property name="leftMargin" > </item>
<number>0</number> </layout>
</property> </item>
<property name="topMargin" > <item row="0" column="1" >
<number>0</number> <spacer>
</property> <property name="orientation" >
<property name="rightMargin" > <enum>Qt::Horizontal</enum>
<number>0</number> </property>
</property> <property name="sizeHint" >
<property name="bottomMargin" > <size>
<number>0</number> <width>360</width>
</property> <height>16</height>
<property name="horizontalSpacing" > </size>
<number>6</number> </property>
</property> </spacer>
<property name="verticalSpacing" > </item>
<number>6</number> </layout>
</property> </item>
<item row="0" column="0" > <item row="1" column="0" >
<widget class="QLabel" name="label" > <widget class="QTextBrowser" name="msgText" >
<property name="text" > <property name="sizePolicy" >
<string/> <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
</property> <horstretch>0</horstretch>
<property name="pixmap" > <verstretch>0</verstretch>
<pixmap resource="images.qrc" >:/images/chat.png</pixmap> </sizepolicy>
</property> </property>
</widget> <property name="contextMenuPolicy" >
</item> <enum>Qt::DefaultContextMenu</enum>
<item row="0" column="1" > </property>
<widget class="QLabel" name="label_12" > <property name="undoRedoEnabled" >
<property name="font" > <bool>false</bool>
<font> </property>
<pointsize>10</pointsize> <property name="readOnly" >
<weight>75</weight> <bool>true</bool>
<bold>true</bold> </property>
</font> </widget>
</property> </item>
<property name="text" > </layout>
<string>Blog Feed:</string> </item>
</property> <item row="1" column="0" >
</widget> <layout class="QGridLayout" >
</item> <property name="verticalSpacing" >
</layout> <number>1</number>
</item> </property>
</layout> <item row="0" column="0" >
</item> <spacer>
<item row="1" column="0" > <property name="orientation" >
<widget class="QTextBrowser" name="msgText" > <enum>Qt::Horizontal</enum>
<property name="sizePolicy" > </property>
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" > <property name="sizeHint" >
<horstretch>0</horstretch> <size>
<verstretch>0</verstretch> <width>355</width>
</sizepolicy> <height>20</height>
</property> </size>
<property name="contextMenuPolicy" > </property>
<enum>Qt::DefaultContextMenu</enum> </spacer>
</property> </item>
<property name="undoRedoEnabled" > <item row="0" column="1" colspan="2" >
<bool>false</bool> <widget class="QPushButton" name="boldBtn" >
</property> <property name="minimumSize" >
<property name="readOnly" > <size>
<bool>true</bool> <width>24</width>
</property> <height>24</height>
</widget> </size>
</item> </property>
</layout> <property name="maximumSize" >
</widget> <size>
</widget> <width>24</width>
</item> <height>24</height>
<item row="1" column="0" > </size>
<layout class="QGridLayout" > </property>
<item row="1" column="0" > <property name="toolTip" >
<widget class="QTextEdit" name="lineEdit" > <string>Bold</string>
<property name="sizePolicy" > </property>
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" > <property name="text" >
<horstretch>0</horstretch> <string/>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="icon" >
</property> <iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
<property name="maximumSize" > </property>
<size> <property name="checkable" >
<width>16777215</width> <bool>true</bool>
<height>100</height> </property>
</size> </widget>
</property> </item>
<property name="sizeIncrement" > <item row="0" column="3" >
<size> <widget class="QPushButton" name="underlineBtn" >
<width>0</width> <property name="minimumSize" >
<height>0</height> <size>
</size> <width>24</width>
</property> <height>24</height>
<property name="baseSize" > </size>
<size> </property>
<width>0</width> <property name="maximumSize" >
<height>0</height> <size>
</size> <width>24</width>
</property> <height>24</height>
</widget> </size>
</item> </property>
</layout> <property name="toolTip" >
</item> <string>Italic</string>
<item row="2" column="0" > </property>
<layout class="QGridLayout" > <property name="text" >
<item row="0" column="0" > <string/>
<spacer> </property>
<property name="orientation" > <property name="icon" >
<enum>Qt::Horizontal</enum> <iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
</property> </property>
<property name="sizeHint" > <property name="checkable" >
<size> <bool>true</bool>
<width>321</width> </property>
<height>20</height> </widget>
</size> </item>
</property> <item row="0" column="4" >
</spacer> <widget class="QPushButton" name="italicBtn" >
</item> <property name="minimumSize" >
<item row="0" column="1" > <size>
<widget class="QPushButton" name="Sendbtn" > <width>24</width>
<property name="text" > <height>24</height>
<string>Send</string> </size>
</property> </property>
</widget> <property name="maximumSize" >
</item> <size>
</layout> <width>24</width>
</item> <height>24</height>
</layout> </size>
</property>
<property name="toolTip" >
<string>Underline</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-italic.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="5" >
<widget class="QTextEdit" name="lineEdit" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>100</height>
</size>
</property>
<property name="sizeIncrement" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>321</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2" colspan="3" >
<widget class="QPushButton" name="sendBtn" >
<property name="text" >
<string>Send</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<action name="actionSend" > <action name="actionSend" >
<property name="text" > <property name="text" >
<string>Send</string> <string>Send</string>