![laanwj@gmail.com](/assets/img/avatar_default.png)
15 changed files with 311 additions and 17 deletions
@ -1,6 +1,57 @@ |
|||
#include "addresstablemodel.h" |
|||
|
|||
const QString AddressTableModel::Send = "S"; |
|||
const QString AddressTableModel::Receive = "R"; |
|||
|
|||
AddressTableModel::AddressTableModel(QObject *parent) : |
|||
QAbstractTableModel(parent) |
|||
{ |
|||
|
|||
} |
|||
|
|||
int AddressTableModel::rowCount(const QModelIndex &parent) const |
|||
{ |
|||
return 5; |
|||
} |
|||
|
|||
int AddressTableModel::columnCount(const QModelIndex &parent) const |
|||
{ |
|||
return 3; |
|||
} |
|||
|
|||
QVariant AddressTableModel::data(const QModelIndex &index, int role) const |
|||
{ |
|||
if(!index.isValid()) |
|||
return QVariant(); |
|||
|
|||
if(role == Qt::DisplayRole) |
|||
{ |
|||
/* index.row(), index.column() */ |
|||
/* Return QString */ |
|||
if(index.column() == Address) |
|||
return "1PC9aZC4hNX2rmmrt7uHTfYAS3hRbph4UN"; |
|||
else |
|||
return "Description"; |
|||
} else if (role == Qt::UserRole) |
|||
{ |
|||
switch(index.row() % 2) |
|||
{ |
|||
case 0: return Send; |
|||
case 1: return Receive; |
|||
} |
|||
} |
|||
return QVariant(); |
|||
} |
|||
|
|||
QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation, int role) const |
|||
{ |
|||
return QVariant(); |
|||
} |
|||
|
|||
Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const |
|||
{ |
|||
if (!index.isValid()) |
|||
return Qt::ItemIsEnabled; |
|||
|
|||
return QAbstractTableModel::flags(index); |
|||
} |
|||
|
@ -0,0 +1,14 @@ |
|||
#include "editaddressdialog.h" |
|||
#include "ui_editaddressdialog.h" |
|||
|
|||
EditAddressDialog::EditAddressDialog(QWidget *parent) : |
|||
QDialog(parent), |
|||
ui(new Ui::EditAddressDialog) |
|||
{ |
|||
ui->setupUi(this); |
|||
} |
|||
|
|||
EditAddressDialog::~EditAddressDialog() |
|||
{ |
|||
delete ui; |
|||
} |
@ -0,0 +1,22 @@ |
|||
#ifndef EDITADDRESSDIALOG_H |
|||
#define EDITADDRESSDIALOG_H |
|||
|
|||
#include <QDialog> |
|||
|
|||
namespace Ui { |
|||
class EditAddressDialog; |
|||
} |
|||
|
|||
class EditAddressDialog : public QDialog |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit EditAddressDialog(QWidget *parent = 0); |
|||
~EditAddressDialog(); |
|||
|
|||
private: |
|||
Ui::EditAddressDialog *ui; |
|||
}; |
|||
|
|||
#endif // EDITADDRESSDIALOG_H
|
@ -0,0 +1,77 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>EditAddressDialog</class> |
|||
<widget class="QDialog" name="EditAddressDialog"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Dialog</string> |
|||
</property> |
|||
<layout class="QVBoxLayout" name="verticalLayout"> |
|||
<item> |
|||
<spacer name="verticalSpacer"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Vertical</enum> |
|||
</property> |
|||
<property name="sizeHint" stdset="0"> |
|||
<size> |
|||
<width>20</width> |
|||
<height>40</height> |
|||
</size> |
|||
</property> |
|||
</spacer> |
|||
</item> |
|||
<item> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>EditAddressDialog</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>EditAddressDialog</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
After Width: | Height: | Size: 968 B |
Loading…
Reference in new issue