added clear button to chat dialog, improvements for accessiblity for chat dialog

This commit is contained in:
Volker Fischer 2009-11-30 22:16:31 +00:00
parent 278a252822
commit 7156763e4b
3 changed files with 41 additions and 20 deletions

View file

@ -31,17 +31,26 @@ CChatDlg::CChatDlg ( QWidget* parent, Qt::WindowFlags f ) :
{
setupUi ( this );
// add help text to controls -----------------------------------------------
lineEditLocalInputText->setAccessibleName ( "New chat text edit box" );
TextViewChatWindow->setAccessibleName ( "Chat history" );
// clear chat window and edit line
TextViewChatWindow->clear();
lineEditLocalInputText->clear();
// Connections -------------------------------------------------------------
QObject::connect ( lineEditLocalInputText, SIGNAL ( textChanged ( const QString& ) ),
QObject::connect ( lineEditLocalInputText,
SIGNAL ( textChanged ( const QString& ) ),
this, SLOT ( OnChatTextChanged ( const QString& ) ) );
QObject::connect ( lineEditLocalInputText, SIGNAL ( returnPressed() ),
this, SLOT ( OnNewLocalInputText() ) );
QObject::connect ( pbClear, SIGNAL ( pressed() ),
this, SLOT ( OnClearButtonPressed() ) );
}
void CChatDlg::OnChatTextChanged ( const QString& strNewText )
@ -61,8 +70,18 @@ void CChatDlg::OnNewLocalInputText()
lineEditLocalInputText->clear();
}
void CChatDlg::OnClearButtonPressed()
{
// clear chat window
TextViewChatWindow->clear();
}
void CChatDlg::AddChatText ( QString strChatText )
{
// add new text in chat window
TextViewChatWindow->append ( strChatText );
// notify accessibility plugin that text has changed
QAccessible::updateAccessibility ( TextViewChatWindow, 0,
QAccessible::ValueChanged );
}

View file

@ -28,6 +28,7 @@
#include <qpushbutton.h>
#include <qwhatsthis.h>
#include <qlayout.h>
#include <qaccessible.h>
#include "global.h"
#ifdef _WIN32
# include "../windows/moc/chatdlgbase.h"
@ -49,6 +50,7 @@ public:
public slots:
void OnNewLocalInputText();
void OnChatTextChanged ( const QString& strNewText );
void OnClearButtonPressed();
signals:
void NewLocalInputText ( QString strNewText );

View file

@ -26,28 +26,17 @@
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QTextBrowser" name="TextViewChatWindow" />
<widget class="QTextBrowser" name="TextViewChatWindow" >
<property name="textInteractionFlags" >
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEditLocalInputText" />
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<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>
</property>
<item>
<spacer>
<property name="orientation" >
@ -58,12 +47,22 @@
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>20</height>
<width>181</width>
<height>27</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pbClear" >
<property name="text" >
<string>Cl&amp;ear</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonClose" >
<property name="text" >
@ -83,8 +82,9 @@
</widget>
<tabstops>
<tabstop>lineEditLocalInputText</tabstop>
<tabstop>buttonClose</tabstop>
<tabstop>TextViewChatWindow</tabstop>
<tabstop>pbClear</tabstop>
<tabstop>buttonClose</tabstop>
</tabstops>
<resources>
<include location="resources.qrc" />