Skip to content

Commit

Permalink
Merge #2353: [GUI] Add search option to My Addresses list in receive …
Browse files Browse the repository at this point in the history
…widget (PicklesRcool)

274fb26 Add search option to My Addresses list in receive widget (Volodia)

Pull request description:

  This is an updated version of #2250 :
  - remove un-needed width increment in receivewidget.ui
  - squashed the commits down to one
  - push under @PicklesRcool's authorship

ACKs for top commit:
  furszy:
    Tested ACK 274fb26 .

Tree-SHA512: fe6aa6def3525c8c60b9f425e5e60f223d8cbbca7ee109fab98ba572a0306a2dd9df85d157232668f2549e90045f2996ecbfcf40ab87e31b8736912316727685
  • Loading branch information
random-zebra committed Apr 30, 2021
2 parents 470f955 + 274fb26 commit ee9f73c
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 1 deletion.
36 changes: 35 additions & 1 deletion src/qt/pivx/forms/receivewidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,45 @@
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QLineEdit" name="lineEditFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="maxLength">
<number>40</number>
</property>
<property name="placeholderText">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
Expand Down Expand Up @@ -556,6 +587,9 @@
</widget>
</item>
</layout>
<zorder>comboBoxSort</zorder>
<zorder>comboBoxSortOrder</zorder>
<zorder>lineEditFilter</zorder>
</widget>
</item>
<item>
Expand Down
10 changes: 10 additions & 0 deletions src/qt/pivx/receivewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ ReceiveWidget::ReceiveWidget(PIVXGUI* parent) :
ui->container_right->addItem(spacer);
ui->listViewAddress->setVisible(false);

// My Address search filter
initCssEditLine(ui->lineEditFilter, true);
ui->lineEditFilter->setStyleSheet("font: 14px;");

// Sort Controls
SortEdit* lineEdit = new SortEdit(ui->comboBoxSort);
connect(lineEdit, &SortEdit::Mouse_Pressed, [this](){ui->comboBoxSort->showPopup();});
Expand All @@ -108,6 +112,7 @@ ReceiveWidget::ReceiveWidget(PIVXGUI* parent) :
connect(ui->listViewAddress, &QListView::clicked, this, &ReceiveWidget::handleAddressClicked);
connect(ui->btnRequest, &OptionButton::clicked, this, &ReceiveWidget::onRequestClicked);
connect(ui->btnMyAddresses, &OptionButton::clicked, this, &ReceiveWidget::onMyAddressesClicked);
connect(ui->lineEditFilter, &QLineEdit::textChanged, [this](){filterChanged(ui->lineEditFilter->text());});

ui->pushLeft->setChecked(true);
connect(ui->pushLeft, &QPushButton::clicked, [this](){onTransparentSelected(true);});
Expand Down Expand Up @@ -336,6 +341,11 @@ void ReceiveWidget::onSortOrderChanged(int idx)
sortAddresses();
}

void ReceiveWidget::filterChanged(const QString& str)
{
this->filter->setFilterRegExp(str);
}

void ReceiveWidget::sortAddresses()
{
if (this->filter)
Expand Down
2 changes: 2 additions & 0 deletions src/qt/pivx/receivewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ private Q_SLOTS:
void handleAddressClicked(const QModelIndex &index);
void onSortChanged(int idx);
void onSortOrderChanged(int idx);
void filterChanged(const QString& str);

private:
Ui::ReceiveWidget *ui{nullptr};

Expand Down

0 comments on commit ee9f73c

Please sign in to comment.