1 /* * Define two person's avatar */ 2 " " ; 3 QString Strhead = QString ("c:/users/tax10_000/desktop/ql_184555_828078.jpg" ); 4 Otherhead = QString (""). Arg (Strhead);
Loading HTML files
1 voidchatdemo::slot_btnpicclicked ()2 {3QString FilePath =qfiledialog::getopenfilename ();4 QFile file (FilePath);5 BOOLOK =File.Open (qiodevice::readonly);6 if(!ok) {return; }7QString msg = QString ("")8 . Arg (FilePath);9QString Myhead = QString (""). Arg (FilePath);TenQString MSG = QString (""); One sendmsgshow (msg,myhead); A revmsgshow (msg,otherhead); - -}1 the 2 - 3 - 4 - 5 + 6 - 7 + 8 A 9 at Ten - One - A - - - - - in - to The function below is that when there is content in Lineedit, the content in Lineedit is displayed on the interface and the content in the Lineedit is cleared, and if the message is "Hello" or "time", assume that the other person will answer you. + - voidchatdemo::slot_lineeditreturnpressed () the { * if(M_ui.lineedit->text () = =NULL) $ {Panax NotoginsengQmessagebox::warning ( This,"Warning","Can ' t send an empty msg!" ); - return; the } + /** Messages sent by yourself*/ ASendmsgshow (m_ui.lineedit->text (), myhead); the + if(M_ui.lineedit->text () = = Qstring::fromlocal8bit ("Hello") ) - { $Revmsgshow (Qstring::fromlocal8bit ("is there anything I can do to help you ?"), otherhead); $ } - Else if(M_ui.lineedit->text () = = Qstring::fromlocal8bit ("Time" ) ) - { theRevmsgshow (Qstring::fromlocal8bit ("Beijing time:%1" ) -. Arg (Qtime::currenttime (). ToString ("Hh:mm:ss") ), otherhead);Wuyi } the -M_ui.lineedit->Clear (); Wu}
c#+ HTML to implement the bubble effect like QQ chat interface