-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
发送图片 #27
base: master
Are you sure you want to change the base?
发送图片 #27
Conversation
src/chatdialog.cpp
Outdated
insertOutMessage(ui->contentBox->toPlainText()); | ||
emit newMessage(sender,receiver,QDateTime::currentDateTime(),ui->contentBox->toPlainText()); | ||
QString text=ui->contentBox->toPlainText(); | ||
if(text!="") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里以及类似的用法都改成调用 isEmpty
判断
src/chatdialog.cpp
Outdated
|
||
void ChatDialog::on_photoBtn_clicked() | ||
{ | ||
strFilePath = QFileDialog::getOpenFileName(this, QString::fromLocal8Bit("选择上传图片"), "./", tr("Image files(*.bmp *.jpg *.pbm *.pgm *.png *.ppm *.xbm *.xpm *.jpeg);;All files (*.*)")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果能正确运用 QString
会更好。
src/chatdialog.h
Outdated
@@ -55,16 +68,28 @@ class ChatDialog : public NoweBaseWindow | |||
QTextCursor save; | |||
int savepos; | |||
|
|||
QString strFilePath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这三项不应该成为 ChatDialog
的类成员
src/chatdialog.h
Outdated
@@ -7,6 +7,14 @@ | |||
#include <QTextFrame> | |||
#include <QDateTime> | |||
#include <QXmppMessage.h> | |||
#include <QFileDialog> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
减少头文件中不必要的 #include
语句
另,建议不要在 master 分支上直接 commit,而是新建分支进行修改,以使 fork 仓库的 master 与源仓库的 master 保持一致。 |
当前实现中发送图片是发送 |
No description provided.