mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-11 15:27:57 +00:00
update model
This commit is contained in:
parent
94ccfa8c5d
commit
de11d82856
@ -27,7 +27,7 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
QMainWindow(parent)
|
QMainWindow(parent)
|
||||||
{
|
{
|
||||||
resize(850, 550);
|
resize(850, 550);
|
||||||
setWindowTitle("Bitcoin");
|
setWindowTitle(tr("Bitcoin"));
|
||||||
setWindowIcon(QIcon(":icons/bitcoin"));
|
setWindowIcon(QIcon(":icons/bitcoin"));
|
||||||
|
|
||||||
QAction *quit = new QAction(QIcon(":/icons/quit"), "&Quit", this);
|
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->addWidget(new QLabel(tr("Balance:")));
|
||||||
hbox_balance->addSpacing(5);/* Add some spacing between the label and the text */
|
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"));
|
label_balance->setFont(QFont("Teletype"));
|
||||||
hbox_balance->addWidget(label_balance);
|
hbox_balance->addWidget(label_balance);
|
||||||
hbox_balance->addStretch(1);
|
hbox_balance->addStretch(1);
|
||||||
@ -83,10 +83,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
/* Transaction table:
|
/* Transaction table:
|
||||||
* TransactionView
|
* TransactionView
|
||||||
* TransactionModel
|
* TransactionModel
|
||||||
* Selection behavior
|
|
||||||
* selection mode
|
|
||||||
* QAbstractItemView::SelectItems
|
|
||||||
* QAbstractItemView::ExtendedSelection
|
|
||||||
*/
|
*/
|
||||||
QTableView *transaction_table = new QTableView(this);
|
QTableView *transaction_table = new QTableView(this);
|
||||||
|
|
||||||
@ -105,13 +101,22 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
TransactionTableModel::Debit, 79);
|
TransactionTableModel::Debit, 79);
|
||||||
transaction_table->horizontalHeader()->resizeSection(
|
transaction_table->horizontalHeader()->resizeSection(
|
||||||
TransactionTableModel::Credit, 79);
|
TransactionTableModel::Credit, 79);
|
||||||
/* TODO: alignment; debit/credit columns must align right */
|
|
||||||
|
|
||||||
|
/* setupTabs */
|
||||||
QTabBar *tabs = new QTabBar(this);
|
QTabBar *tabs = new QTabBar(this);
|
||||||
tabs->addTab(tr("All transactions"));
|
tabs->addTab(tr("All transactions"));
|
||||||
tabs->addTab(tr("Sent/Received"));
|
tabs->addTab(tr("Sent/Received"));
|
||||||
tabs->addTab(tr("Sent"));
|
tabs->addTab(tr("Sent"));
|
||||||
tabs->addTab(tr("Received"));
|
tabs->addTab(tr("Received"));
|
||||||
|
/* QSortFilterProxyModel
|
||||||
|
setFilterRole : filter on user role
|
||||||
|
setFilterKeyColumn
|
||||||
|
setFilterRegExp / setFilterFixedString
|
||||||
|
"^."
|
||||||
|
"^[sr]"
|
||||||
|
"^[s]"
|
||||||
|
"^[r]"
|
||||||
|
*/
|
||||||
|
|
||||||
vbox->addWidget(tabs);
|
vbox->addWidget(tabs);
|
||||||
vbox->addWidget(transaction_table);
|
vbox->addWidget(transaction_table);
|
||||||
|
@ -12,7 +12,7 @@ static Qt::AlignmentFlag column_alignments[] = {
|
|||||||
TransactionTableModel::TransactionTableModel(QObject *parent):
|
TransactionTableModel::TransactionTableModel(QObject *parent):
|
||||||
QAbstractTableModel(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
|
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()];
|
return column_alignments[index.column()];
|
||||||
}
|
}
|
||||||
|
/* user role: transaction type
|
||||||
|
"s" (sent)
|
||||||
|
"r" (received)
|
||||||
|
"g" (generated)
|
||||||
|
*/
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user