update model
This commit is contained in:
parent
94ccfa8c5d
commit
de11d82856
2 changed files with 18 additions and 8 deletions
|
@ -27,7 +27,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||
QMainWindow(parent)
|
||||
{
|
||||
resize(850, 550);
|
||||
setWindowTitle("Bitcoin");
|
||||
setWindowTitle(tr("Bitcoin"));
|
||||
setWindowIcon(QIcon(":icons/bitcoin"));
|
||||
|
||||
QAction *quit = new QAction(QIcon(":/icons/quit"), "&Quit", this);
|
||||
|
@ -70,7 +70,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||
hbox_balance->addWidget(new QLabel(tr("Balance:")));
|
||||
hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */
|
||||
|
||||
QLabel *label_balance = new QLabel(QLocale::system().toString(1345.54)); /* TODO: use locale to format amount */
|
||||
QLabel *label_balance = new QLabel(QLocale::system().toString(1345.54));
|
||||
label_balance->setFont(QFont("Teletype"));
|
||||
hbox_balance->addWidget(label_balance);
|
||||
hbox_balance->addStretch(1);
|
||||
|
@ -83,10 +83,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||
/* Transaction table:
|
||||
* TransactionView
|
||||
* TransactionModel
|
||||
* Selection behavior
|
||||
* selection mode
|
||||
* QAbstractItemView::SelectItems
|
||||
* QAbstractItemView::ExtendedSelection
|
||||
*/
|
||||
QTableView *transaction_table = new QTableView(this);
|
||||
|
||||
|
@ -105,13 +101,22 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||
TransactionTableModel::Debit, 79);
|
||||
transaction_table->horizontalHeader()->resizeSection(
|
||||
TransactionTableModel::Credit, 79);
|
||||
/* TODO: alignment; debit/credit columns must align right */
|
||||
|
||||
/* setupTabs */
|
||||
QTabBar *tabs = new QTabBar(this);
|
||||
tabs->addTab(tr("All transactions"));
|
||||
tabs->addTab(tr("Sent/Received"));
|
||||
tabs->addTab(tr("Sent"));
|
||||
tabs->addTab(tr("Received"));
|
||||
/* QSortFilterProxyModel
|
||||
setFilterRole : filter on user role
|
||||
setFilterKeyColumn
|
||||
setFilterRegExp / setFilterFixedString
|
||||
"^."
|
||||
"^[sr]"
|
||||
"^[s]"
|
||||
"^[r]"
|
||||
*/
|
||||
|
||||
vbox->addWidget(tabs);
|
||||
vbox->addWidget(transaction_table);
|
||||
|
|
|
@ -12,7 +12,7 @@ static Qt::AlignmentFlag column_alignments[] = {
|
|||
TransactionTableModel::TransactionTableModel(QObject *parent):
|
||||
QAbstractTableModel(parent)
|
||||
{
|
||||
columns << "Status" << "Date" << "Description" << "Debit" << "Credit";
|
||||
columns << tr("Status") << tr("Date") << tr("Description") << tr("Debit") << tr("Credit");
|
||||
}
|
||||
|
||||
int TransactionTableModel::rowCount(const QModelIndex &parent) const
|
||||
|
@ -41,6 +41,11 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
|||
{
|
||||
return column_alignments[index.column()];
|
||||
}
|
||||
/* user role: transaction type
|
||||
"s" (sent)
|
||||
"r" (received)
|
||||
"g" (generated)
|
||||
*/
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue