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,50 +504,27 @@
<property name="windowIcon" > <property name="windowIcon" >
<iconset/> <iconset/>
</property> </property>
<widget class="QWidget" name="" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>463</width>
<height>403</height>
</rect>
</property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item row="0" column="0" >
<widget class="QSplitter" name="splitter" >
<property name="baseSize" >
<size>
<width>2</width>
<height>0</height>
</size>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QWidget" name="layoutWidget" >
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="horizontalSpacing" > <property name="horizontalSpacing" >
<number>0</number> <number>-1</number>
</property> </property>
<property name="verticalSpacing" > <property name="verticalSpacing" >
<number>0</number> <number>1</number>
</property> </property>
<item row="0" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="leftMargin" >
@ -568,19 +545,6 @@
<property name="verticalSpacing" > <property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>181</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="leftMargin" >
@ -627,6 +591,19 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>360</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout> </layout>
</item> </item>
<item row="1" column="0" > <item row="1" column="0" >
@ -649,12 +626,110 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</widget>
</item> </item>
<item row="1" column="0" > <item row="1" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<item row="1" column="0" > <property name="verticalSpacing" >
<number>1</number>
</property>
<item row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>355</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" colspan="2" >
<widget class="QPushButton" name="boldBtn" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip" >
<string>Bold</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-bold.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QPushButton" name="underlineBtn" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="toolTip" >
<string>Italic</string>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="images.qrc" >:/images/edit-underline.png</iconset>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QPushButton" name="italicBtn" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</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" > <widget class="QTextEdit" name="lineEdit" >
<property name="sizePolicy" > <property name="sizePolicy" >
<sizepolicy vsizetype="Maximum" hsizetype="Expanding" > <sizepolicy vsizetype="Maximum" hsizetype="Expanding" >
@ -682,11 +757,7 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item row="2" column="0" colspan="2" >
</item>
<item row="2" column="0" >
<layout class="QGridLayout" >
<item row="0" column="0" >
<spacer> <spacer>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
@ -699,8 +770,8 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="0" column="1" > <item row="2" column="2" colspan="3" >
<widget class="QPushButton" name="Sendbtn" > <widget class="QPushButton" name="sendBtn" >
<property name="text" > <property name="text" >
<string>Send</string> <string>Send</string>
</property> </property>
@ -709,6 +780,7 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</widget>
<action name="actionSend" > <action name="actionSend" >
<property name="text" > <property name="text" >
<string>Send</string> <string>Send</string>