change datetime format in chatmodel
This commit is contained in:
@@ -117,27 +117,22 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
|
|||||||
(p.getPartnerAddress() == c.second.getAddress())
|
(p.getPartnerAddress() == c.second.getAddress())
|
||||||
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
// for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
|
||||||
|
|
||||||
|
|
||||||
// {
|
|
||||||
// if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid()))
|
|
||||||
|
|
||||||
// {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
QStandardItem* Items = new QStandardItem(c.second.toChatLine());
|
QStandardItem* Items = new QStandardItem(c.second.toChatLine());
|
||||||
Items->setData("Incoming", Qt::UserRole +1);
|
Items->setData("Incoming", Qt::UserRole +1);
|
||||||
myModel->appendRow(Items);
|
myModel->appendRow(Items);
|
||||||
qDebug()<<Items->text();
|
|
||||||
ui->listChat->setModel(myModel);
|
|
||||||
ui->listChat->setMinimumSize(200,350);
|
ui->listChat->setResizeMode(QListView::Adjust);
|
||||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
ui->listChat->setWordWrap(true);
|
||||||
ui->listChat->show();
|
ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||||
|
ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
ui->listChat->setModel(myModel);
|
||||||
|
ui->listChat->setMinimumSize(200,350);
|
||||||
|
ui->listChat->setItemDelegate(new ListViewDelegate());
|
||||||
|
ui->listChat->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -155,6 +150,12 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
|
|||||||
myModel->appendRow(Items1);
|
myModel->appendRow(Items1);
|
||||||
qDebug()<<Items1->text();
|
qDebug()<<Items1->text();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->listChat->setResizeMode(QListView::Adjust);
|
||||||
|
ui->listChat->setWordWrap(true);
|
||||||
|
ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
|
||||||
|
ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
|
ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
ui->listChat->setModel(myModel);
|
ui->listChat->setModel(myModel);
|
||||||
ui->listChat->setMinimumSize(200,350);
|
ui->listChat->setMinimumSize(200,350);
|
||||||
ui->listChat->setItemDelegate(new ListViewDelegate());
|
ui->listChat->setItemDelegate(new ListViewDelegate());
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "camount.h"
|
#include "camount.h"
|
||||||
|
|
||||||
|
|
||||||
class ListViewDelegate : public QAbstractItemDelegate
|
class ListViewDelegate : public QAbstractItemDelegate
|
||||||
{
|
{
|
||||||
int d_radius;
|
int d_radius;
|
||||||
@@ -267,8 +268,8 @@ class ChatItem
|
|||||||
{
|
{
|
||||||
QDateTime myDateTime;
|
QDateTime myDateTime;
|
||||||
myDateTime.setTime_t(_timestamp);
|
myDateTime.setTime_t(_timestamp);
|
||||||
QString line = QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] ");
|
QString line = QString("[") + myDateTime.toString("d.M.yy hh:mm") + QString("] ") ;
|
||||||
line += QString(_memo) + QString("\n");
|
line += QString("") + QString(_memo) + QString("\n\n");
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1484,19 +1484,6 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="Line" name="line_6">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>340</x>
|
|
||||||
<y>430</y>
|
|
||||||
<width>911</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
Reference in New Issue
Block a user