history: add options button

This commit is contained in:
tobtoht
2025-03-26 05:51:46 +01:00
parent 48cc0f0aad
commit cdc7918825
4 changed files with 57 additions and 8 deletions
+3 -1
View File
@@ -61,10 +61,12 @@ HistoryWidget::HistoryWidget(Wallet *wallet, QWidget *parent)
if (!historyViewState.isEmpty()) {
ui->history->setViewState(historyViewState);
}
ui->btn_options->setMenu(ui->history->getMenu());
}
void HistoryWidget::setSearchbarVisible(bool visible) {
ui->search->setVisible(visible);
ui->frame_search->setVisible(visible);
}
void HistoryWidget::focusSearchbar() {
+47 -7
View File
@@ -27,19 +27,57 @@
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="search">
<property name="placeholderText">
<string>Search txid, description..</string>
<widget class="QFrame" name="frame_search">
<property name="frameShape">
<enum>QFrame::Shape::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="search">
<property name="placeholderText">
<string>Search txid, description..</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="btn_options">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="assets.qrc">
<normaloff>:/assets/images/preferences.svg</normaloff>:/assets/images/preferences.svg</iconset>
</property>
<property name="popupMode">
<enum>QToolButton::ToolButtonPopupMode::InstantPopup</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="syncNotice">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
@@ -58,7 +96,7 @@
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
@@ -122,6 +160,8 @@
<header>model/HistoryView.h</header>
</customwidget>
</customwidgets>
<resources/>
<resources>
<include location="assets.qrc"/>
</resources>
<connections/>
</ui>
+5
View File
@@ -75,6 +75,11 @@ TransactionHistoryModel* HistoryView::sourceModel()
return dynamic_cast<TransactionHistoryModel *>(m_model->sourceModel());
}
QMenu* HistoryView::getMenu()
{
return m_headerMenu;
}
void HistoryView::setSearchMode(bool mode) {
if (!m_inSearchMode) {
m_showTxidColumn = !header()->isSectionHidden(TransactionHistoryModel::TxID);
+2
View File
@@ -25,6 +25,8 @@ public:
QModelIndex getCurrentIndex();
TransactionHistoryModel* sourceModel();
QMenu* getMenu();
private slots:
void showHeaderMenu(const QPoint& position);
void toggleColumnVisibility(QAction* action);