This commit introduces a button to create a new contact because when the contact table is full of contacts, you cannot do 'right-click -> New contact'.

new-contact
dsc 2 years ago
parent fb32fa2fd2
commit 3051ce5118

@ -2,14 +2,9 @@ set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
# pthread
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if(QML)
# PNG
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
find_package(PNG REQUIRED) find_package(PNG REQUIRED)
endif()
# Compile these source files (.h/.cpp) # Compile these source files (.h/.cpp)
file(GLOB SOURCE_FILES file(GLOB SOURCE_FILES

@ -32,6 +32,10 @@ ContactsWidget::ContactsWidget(QWidget *parent) :
this->newContact(); this->newContact();
}); });
connect(ui->btn_addContact, &QPushButton::pressed, [this]{
this->newContact();
});
connect(ui->contacts, &QTreeView::customContextMenuRequested, [=](const QPoint & point){ connect(ui->contacts, &QTreeView::customContextMenuRequested, [=](const QPoint & point){
QModelIndex index = ui->contacts->indexAt(point); QModelIndex index = ui->contacts->indexAt(point);
if (index.isValid()) { if (index.isValid()) {

@ -6,17 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>589</width> <width>310</width>
<height>416</height> <height>283</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="spacing">
<number>9</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -29,6 +26,14 @@
<property name="bottomMargin"> <property name="bottomMargin">
<number>0</number> <number>0</number>
</property> </property>
<property name="verticalSpacing">
<number>9</number>
</property>
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>9</number>
</property>
<item> <item>
<widget class="QLineEdit" name="search"> <widget class="QLineEdit" name="search">
<property name="placeholderText"> <property name="placeholderText">
@ -37,6 +42,22 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_addContact">
<property name="text">
<string>New contact</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QTreeView" name="contacts"> <widget class="QTreeView" name="contacts">
<property name="rootIsDecorated"> <property name="rootIsDecorated">
<bool>false</bool> <bool>false</bool>

Loading…
Cancel
Save