Contacts: add contact button

This commit is contained in:
tobtoht 2021-10-13 15:55:07 +02:00
parent 3deaa1bc1d
commit ca641d6530
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
3 changed files with 24 additions and 7 deletions

View file

@ -18,6 +18,11 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
m_btn_addContact = new QPushButton(this);
m_btn_addContact->setIcon(icons()->icon("localMonero_register.svg"));
ui->searchLayout->addWidget(m_btn_addContact, 0, Qt::AlignRight);
connect(m_btn_addContact, &QPushButton::clicked, [this]{this->newContact();});
m_model = m_ctx->wallet->addressBookModel(); m_model = m_ctx->wallet->addressBookModel();
m_proxyModel = new AddressBookProxyModel; m_proxyModel = new AddressBookProxyModel;
m_proxyModel->setSourceModel(m_model); m_proxyModel->setSourceModel(m_model);

View file

@ -4,6 +4,7 @@
#ifndef FEATHER_CONTACTSWIDGET_H #ifndef FEATHER_CONTACTSWIDGET_H
#define FEATHER_CONTACTSWIDGET_H #define FEATHER_CONTACTSWIDGET_H
#include <QPushButton>
#include <QWidget> #include <QWidget>
#include <QMenu> #include <QMenu>
@ -51,6 +52,7 @@ private:
QMenu *m_headerMenu; QMenu *m_headerMenu;
AddressBookModel * m_model; AddressBookModel * m_model;
AddressBookProxyModel * m_proxyModel; AddressBookProxyModel * m_proxyModel;
QPushButton *m_btn_addContact;
}; };
#endif // FEATHER_CONTACTSWIDGET_H #endif // FEATHER_CONTACTSWIDGET_H

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>589</width> <width>914</width>
<height>416</height> <height>763</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -29,6 +29,8 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<item>
<layout class="QHBoxLayout" name="searchLayout">
<item> <item>
<widget class="QLineEdit" name="search"> <widget class="QLineEdit" name="search">
<property name="placeholderText"> <property name="placeholderText">
@ -36,8 +38,16 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item> <item>
<widget class="QTreeView" name="contacts"> <widget class="QTreeView" name="contacts">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="rootIsDecorated"> <property name="rootIsDecorated">
<bool>false</bool> <bool>false</bool>
</property> </property>