improve address book, add less conspicious toolbar icon
This commit is contained in:
parent
871f9979c6
commit
b8e302eb53
2
TODO
2
TODO
@ -60,3 +60,5 @@ AboutDialog
|
|||||||
- Address
|
- Address
|
||||||
- Delete / Copy to clipboard based on tab
|
- Delete / Copy to clipboard based on tab
|
||||||
|
|
||||||
|
- Make icon blend into taskbar and maybe silver/grey
|
||||||
|
Same for the other icons?
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
#include "addressbookdialog.h"
|
#include "addressbookdialog.h"
|
||||||
#include "ui_addressbookdialog.h"
|
#include "ui_addressbookdialog.h"
|
||||||
|
|
||||||
|
#include "addresstablemodel.h"
|
||||||
|
#include "editaddressdialog.h"
|
||||||
|
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
|
||||||
AddressBookDialog::AddressBookDialog(QWidget *parent) :
|
AddressBookDialog::AddressBookDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::AddressBookDialog)
|
ui(new Ui::AddressBookDialog),
|
||||||
|
model(0)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
model = new AddressTableModel(this);
|
||||||
|
setModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
AddressBookDialog::~AddressBookDialog()
|
AddressBookDialog::~AddressBookDialog()
|
||||||
@ -13,6 +22,41 @@ AddressBookDialog::~AddressBookDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddressBookDialog::setModel(AddressTableModel *model)
|
||||||
|
{
|
||||||
|
/* Receive filter */
|
||||||
|
QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this);
|
||||||
|
receive_model->setSourceModel(model);
|
||||||
|
receive_model->setDynamicSortFilter(true);
|
||||||
|
receive_model->setFilterRole(Qt::UserRole);
|
||||||
|
receive_model->setFilterKeyColumn(AddressTableModel::Type);
|
||||||
|
receive_model->setFilterFixedString(AddressTableModel::Receive);
|
||||||
|
ui->receiveTableView->setModel(receive_model);
|
||||||
|
|
||||||
|
/* Send filter */
|
||||||
|
QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this);
|
||||||
|
send_model->setSourceModel(model);
|
||||||
|
send_model->setDynamicSortFilter(true);
|
||||||
|
send_model->setFilterRole(Qt::UserRole);
|
||||||
|
send_model->setFilterKeyColumn(AddressTableModel::Type);
|
||||||
|
send_model->setFilterFixedString(AddressTableModel::Send);
|
||||||
|
ui->sendTableView->setModel(send_model);
|
||||||
|
|
||||||
|
/* Set column widths */
|
||||||
|
ui->receiveTableView->horizontalHeader()->resizeSection(
|
||||||
|
AddressTableModel::Address, 320);
|
||||||
|
ui->receiveTableView->horizontalHeader()->setResizeMode(
|
||||||
|
AddressTableModel::Label, QHeaderView::Stretch);
|
||||||
|
ui->sendTableView->horizontalHeader()->resizeSection(
|
||||||
|
AddressTableModel::Address, 320);
|
||||||
|
ui->sendTableView->horizontalHeader()->setResizeMode(
|
||||||
|
AddressTableModel::Label, QHeaderView::Stretch);
|
||||||
|
|
||||||
|
/* Hide "Type" column in both views as it is only used for filtering */
|
||||||
|
ui->receiveTableView->setColumnHidden(AddressTableModel::Type, true);
|
||||||
|
ui->sendTableView->setColumnHidden(AddressTableModel::Type, true);
|
||||||
|
}
|
||||||
|
|
||||||
void AddressBookDialog::setTab(int tab)
|
void AddressBookDialog::setTab(int tab)
|
||||||
{
|
{
|
||||||
ui->tabWidget->setCurrentIndex(tab);
|
ui->tabWidget->setCurrentIndex(tab);
|
||||||
@ -25,15 +69,18 @@ void AddressBookDialog::on_OKButton_clicked()
|
|||||||
|
|
||||||
void AddressBookDialog::on_copyToClipboard_clicked()
|
void AddressBookDialog::on_copyToClipboard_clicked()
|
||||||
{
|
{
|
||||||
|
/* Copy currently selected address to clipboard */
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookDialog::on_editButton_clicked()
|
void AddressBookDialog::on_editButton_clicked()
|
||||||
{
|
{
|
||||||
|
/* Double click should trigger edit button */
|
||||||
|
EditAddressDialog dlg;
|
||||||
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookDialog::on_newAddressButton_clicked()
|
void AddressBookDialog::on_newAddressButton_clicked()
|
||||||
{
|
{
|
||||||
|
EditAddressDialog dlg;
|
||||||
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AddressBookDialog;
|
class AddressBookDialog;
|
||||||
}
|
}
|
||||||
|
class AddressTableModel;
|
||||||
|
|
||||||
class AddressBookDialog : public QDialog
|
class AddressBookDialog : public QDialog
|
||||||
{
|
{
|
||||||
@ -20,9 +21,11 @@ public:
|
|||||||
ReceivingTab = 1
|
ReceivingTab = 1
|
||||||
} Tabs;
|
} Tabs;
|
||||||
|
|
||||||
|
void setModel(AddressTableModel *model);
|
||||||
void setTab(int tab);
|
void setTab(int tab);
|
||||||
private:
|
private:
|
||||||
Ui::AddressBookDialog *ui;
|
Ui::AddressBookDialog *ui;
|
||||||
|
AddressTableModel *model;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_newAddressButton_clicked();
|
void on_newAddressButton_clicked();
|
||||||
|
@ -25,7 +25,14 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="sendTableView"/>
|
<widget class="QTableView" name="sendTableView">
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -48,7 +55,14 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="receiveTableView"/>
|
<widget class="QTableView" name="receiveTableView">
|
||||||
|
<property name="selectionBehavior">
|
||||||
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
@ -102,5 +116,38 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>receiveTableView</sender>
|
||||||
|
<signal>doubleClicked(QModelIndex)</signal>
|
||||||
|
<receiver>editButton</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>334</x>
|
||||||
|
<y>249</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>333</x>
|
||||||
|
<y>326</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>sendTableView</sender>
|
||||||
|
<signal>doubleClicked(QModelIndex)</signal>
|
||||||
|
<receiver>editButton</receiver>
|
||||||
|
<slot>click()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>329</x>
|
||||||
|
<y>261</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>332</x>
|
||||||
|
<y>326</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -1,6 +1,57 @@
|
|||||||
#include "addresstablemodel.h"
|
#include "addresstablemodel.h"
|
||||||
|
|
||||||
|
const QString AddressTableModel::Send = "S";
|
||||||
|
const QString AddressTableModel::Receive = "R";
|
||||||
|
|
||||||
AddressTableModel::AddressTableModel(QObject *parent) :
|
AddressTableModel::AddressTableModel(QObject *parent) :
|
||||||
QAbstractTableModel(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);
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,20 @@ class AddressTableModel : public QAbstractTableModel
|
|||||||
public:
|
public:
|
||||||
explicit AddressTableModel(QObject *parent = 0);
|
explicit AddressTableModel(QObject *parent = 0);
|
||||||
|
|
||||||
|
enum {
|
||||||
|
Label = 0, /* User specified label */
|
||||||
|
Address = 1, /* Bitcoin address */
|
||||||
|
Type = 2 /* Send/Receive, used for filter */
|
||||||
|
} ColumnIndex;
|
||||||
|
|
||||||
|
static const QString Send; /* Send addres */
|
||||||
|
static const QString Receive; /* Receive address */
|
||||||
|
|
||||||
|
int rowCount(const QModelIndex &parent) const;
|
||||||
|
int columnCount(const QModelIndex &parent) const;
|
||||||
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -15,7 +15,8 @@ HEADERS += bitcoingui.h \
|
|||||||
mainoptionspage.h \
|
mainoptionspage.h \
|
||||||
sendcoinsdialog.h \
|
sendcoinsdialog.h \
|
||||||
addressbookdialog.h \
|
addressbookdialog.h \
|
||||||
aboutdialog.h
|
aboutdialog.h \
|
||||||
|
editaddressdialog.h
|
||||||
SOURCES += bitcoin.cpp bitcoingui.cpp \
|
SOURCES += bitcoin.cpp bitcoingui.cpp \
|
||||||
transactiontablemodel.cpp \
|
transactiontablemodel.cpp \
|
||||||
addresstablemodel.cpp \
|
addresstablemodel.cpp \
|
||||||
@ -23,7 +24,8 @@ SOURCES += bitcoin.cpp bitcoingui.cpp \
|
|||||||
mainoptionspage.cpp \
|
mainoptionspage.cpp \
|
||||||
sendcoinsdialog.cpp \
|
sendcoinsdialog.cpp \
|
||||||
addressbookdialog.cpp \
|
addressbookdialog.cpp \
|
||||||
aboutdialog.cpp
|
aboutdialog.cpp \
|
||||||
|
editaddressdialog.cpp
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
bitcoin.qrc
|
bitcoin.qrc
|
||||||
@ -31,4 +33,5 @@ RESOURCES += \
|
|||||||
FORMS += \
|
FORMS += \
|
||||||
sendcoinsdialog.ui \
|
sendcoinsdialog.ui \
|
||||||
addressbookdialog.ui \
|
addressbookdialog.ui \
|
||||||
aboutdialog.ui
|
aboutdialog.ui \
|
||||||
|
editaddressdialog.ui
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<file alias="bitcoin">res/icons/bitcoin.png</file>
|
<file alias="bitcoin">res/icons/bitcoin.png</file>
|
||||||
<file alias="quit">res/icons/quit.png</file>
|
<file alias="quit">res/icons/quit.png</file>
|
||||||
<file alias="send">res/icons/send.png</file>
|
<file alias="send">res/icons/send.png</file>
|
||||||
|
<file alias="toolbar">res/icons/toolbar.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/images">
|
<qresource prefix="/images">
|
||||||
<file alias="about">res/images/about.png</file>
|
<file alias="about">res/images/about.png</file>
|
||||||
|
@ -150,7 +150,7 @@ void BitcoinGUI::createTrayIcon()
|
|||||||
|
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
trayIcon->setIcon(QIcon(":/icons/bitcoin"));
|
trayIcon->setIcon(QIcon(":/icons/toolbar"));
|
||||||
trayIcon->show();
|
trayIcon->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,9 +158,9 @@ QWidget *BitcoinGUI::createTabs()
|
|||||||
{
|
{
|
||||||
QStringList tab_filters, tab_labels;
|
QStringList tab_filters, tab_labels;
|
||||||
tab_filters << "^."
|
tab_filters << "^."
|
||||||
<< "^[sr]"
|
<< "^["+TransactionTableModel::Sent+TransactionTableModel::Received+"]"
|
||||||
<< "^[s]"
|
<< "^["+TransactionTableModel::Sent+"]"
|
||||||
<< "^[r]";
|
<< "^["+TransactionTableModel::Received+"]";
|
||||||
tab_labels << tr("All transactions")
|
tab_labels << tr("All transactions")
|
||||||
<< tr("Sent/Received")
|
<< tr("Sent/Received")
|
||||||
<< tr("Sent")
|
<< tr("Sent")
|
||||||
@ -173,6 +173,7 @@ QWidget *BitcoinGUI::createTabs()
|
|||||||
proxy_model->setSourceModel(transaction_model);
|
proxy_model->setSourceModel(transaction_model);
|
||||||
proxy_model->setDynamicSortFilter(true);
|
proxy_model->setDynamicSortFilter(true);
|
||||||
proxy_model->setFilterRole(Qt::UserRole);
|
proxy_model->setFilterRole(Qt::UserRole);
|
||||||
|
proxy_model->setFilterKeyColumn(TransactionTableModel::Type);
|
||||||
proxy_model->setFilterRegExp(QRegExp(tab_filters.at(i)));
|
proxy_model->setFilterRegExp(QRegExp(tab_filters.at(i)));
|
||||||
|
|
||||||
QTableView *transaction_table = new QTableView(this);
|
QTableView *transaction_table = new QTableView(this);
|
||||||
@ -191,6 +192,7 @@ QWidget *BitcoinGUI::createTabs()
|
|||||||
TransactionTableModel::Debit, 79);
|
TransactionTableModel::Debit, 79);
|
||||||
transaction_table->horizontalHeader()->resizeSection(
|
transaction_table->horizontalHeader()->resizeSection(
|
||||||
TransactionTableModel::Credit, 79);
|
TransactionTableModel::Credit, 79);
|
||||||
|
transaction_table->setColumnHidden(TransactionTableModel::Type, true);
|
||||||
|
|
||||||
tabs->addTab(transaction_table, tab_labels.at(i));
|
tabs->addTab(transaction_table, tab_labels.at(i));
|
||||||
}
|
}
|
||||||
|
14
editaddressdialog.cpp
Normal file
14
editaddressdialog.cpp
Normal file
@ -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;
|
||||||
|
}
|
22
editaddressdialog.h
Normal file
22
editaddressdialog.h
Normal file
@ -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
|
77
editaddressdialog.ui
Normal file
77
editaddressdialog.ui
Normal file
@ -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>
|
BIN
res/icons/toolbar.png
Normal file
BIN
res/icons/toolbar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 968 B |
@ -2,19 +2,24 @@
|
|||||||
|
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
|
|
||||||
|
const QString TransactionTableModel::Sent = "s";
|
||||||
|
const QString TransactionTableModel::Received = "r";
|
||||||
|
const QString TransactionTableModel::Generated = "g";
|
||||||
|
|
||||||
/* Credit and Debit columns are right-aligned as they contain numbers */
|
/* Credit and Debit columns are right-aligned as they contain numbers */
|
||||||
static int column_alignments[] = {
|
static int column_alignments[] = {
|
||||||
Qt::AlignLeft|Qt::AlignVCenter,
|
Qt::AlignLeft|Qt::AlignVCenter,
|
||||||
Qt::AlignLeft|Qt::AlignVCenter,
|
Qt::AlignLeft|Qt::AlignVCenter,
|
||||||
Qt::AlignLeft|Qt::AlignVCenter,
|
Qt::AlignLeft|Qt::AlignVCenter,
|
||||||
Qt::AlignRight|Qt::AlignVCenter,
|
Qt::AlignRight|Qt::AlignVCenter,
|
||||||
Qt::AlignRight|Qt::AlignVCenter
|
Qt::AlignRight|Qt::AlignVCenter,
|
||||||
|
Qt::AlignLeft|Qt::AlignVCenter
|
||||||
};
|
};
|
||||||
|
|
||||||
TransactionTableModel::TransactionTableModel(QObject *parent):
|
TransactionTableModel::TransactionTableModel(QObject *parent):
|
||||||
QAbstractTableModel(parent)
|
QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit");
|
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit") << tr("Type");
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||||
|
@ -15,9 +15,15 @@ public:
|
|||||||
Date = 1,
|
Date = 1,
|
||||||
Description = 2,
|
Description = 2,
|
||||||
Debit = 3,
|
Debit = 3,
|
||||||
Credit = 4
|
Credit = 4,
|
||||||
|
Type = 5
|
||||||
} ColumnIndex;
|
} ColumnIndex;
|
||||||
|
|
||||||
|
/* Transaction type */
|
||||||
|
static const QString Sent;
|
||||||
|
static const QString Received;
|
||||||
|
static const QString Generated;
|
||||||
|
|
||||||
int rowCount(const QModelIndex &parent) const;
|
int rowCount(const QModelIndex &parent) const;
|
||||||
int columnCount(const QModelIndex &parent) const;
|
int columnCount(const QModelIndex &parent) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user