Skip to content

Commit

Permalink
dashboard sort tx by amount or date.
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Aug 28, 2019
1 parent 9509843 commit b213f21
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/qt/pivx/dashboardwidget.cpp
Expand Up @@ -112,15 +112,14 @@ DashboardWidget::DashboardWidget(PIVXGUI* _window, QWidget *parent) :
lineEdit->setReadOnly(true);
lineEdit->setAlignment(Qt::AlignRight);
ui->comboBoxSort->setLineEdit(lineEdit);
ui->comboBoxSort->setStyleSheet("selection-background-color:transparent; selection-color:transparent;");
connect(lineEdit, SIGNAL(Mouse_Pressed()), this, SLOT(onSortTxPressed()));

QListView * listView = new QListView();

ui->comboBoxSort->addItem("Amount");
ui->comboBoxSort->setView(new QListView());
ui->comboBoxSort->addItem("Date");
ui->comboBoxSort->addItem("Sent");

ui->comboBoxSort->setView(listView);
ui->comboBoxSort->addItem("Amount");
//ui->comboBoxSort->addItem("Sent");
//ui->comboBoxSort->addItem("Received");
connect(ui->comboBoxSort, SIGNAL(currentIndexChanged(const QString&)), this,SLOT(onSortChanged(const QString&)));

// transactions
ui->listTransactions->setProperty("cssClass", "container");
Expand Down Expand Up @@ -324,6 +323,16 @@ void DashboardWidget::onSortTxPressed(){
ui->comboBoxSort->showPopup();
}

void DashboardWidget::onSortChanged(const QString& value){
if(!value.isNull()) {
if (value == "Amount")
filter->sort(TransactionTableModel::Amount, Qt::DescendingOrder);
else if (value == "Date")
filter->sort(TransactionTableModel::Date, Qt::DescendingOrder);
ui->listTransactions->update();
}
}

void DashboardWidget::changeTheme(bool isLightTheme, QString& theme){
// Change theme in all of the childs here..
this->setStyleSheet(theme);
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/dashboardwidget.h
Expand Up @@ -61,6 +61,7 @@ private slots:
void changeTheme(bool isLightTheme, QString &theme);
void changeChartColors();
void onSortTxPressed();
void onSortChanged(const QString&);
void updateDisplayUnit();
void showList();
void openFAQ();
Expand Down

0 comments on commit b213f21

Please sign in to comment.