Aditya Kulkarni
5 years ago
9 changed files with 219 additions and 4 deletions
@ -0,0 +1,37 @@ |
|||
#include "validateaddress.h" |
|||
|
|||
|
|||
ValidateAddressesModel::ValidateAddressesModel(QTableView *parent, QList<QPair<QString, QString>> props) |
|||
: QAbstractTableModel(parent) { |
|||
headers << tr("Property") << tr("Value"); |
|||
this->props = props; |
|||
} |
|||
|
|||
|
|||
int ValidateAddressesModel::rowCount(const QModelIndex&) const { |
|||
return props.size(); |
|||
} |
|||
|
|||
int ValidateAddressesModel::columnCount(const QModelIndex&) const { |
|||
return headers.size(); |
|||
} |
|||
|
|||
QVariant ValidateAddressesModel::data(const QModelIndex &index, int role) const { |
|||
QPair<QString, QString> p = props.at(index.row()); |
|||
if (role == Qt::DisplayRole) { |
|||
switch(index.column()) { |
|||
case 0: return p.first; |
|||
case 1: return p.second; |
|||
} |
|||
} |
|||
return QVariant(); |
|||
} |
|||
|
|||
|
|||
QVariant ValidateAddressesModel::headerData(int section, Qt::Orientation orientation, int role) const { |
|||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { |
|||
return headers.at(section); |
|||
} |
|||
|
|||
return QVariant(); |
|||
} |
@ -0,0 +1,23 @@ |
|||
#ifndef VALIDATEADDRESS_H |
|||
#define VALIDATEADDRESS_H |
|||
|
|||
#include "precompiled.h" |
|||
|
|||
class ValidateAddressesModel : public QAbstractTableModel { |
|||
|
|||
public: |
|||
ValidateAddressesModel(QTableView* parent, QList<QPair<QString, QString>> props); |
|||
~ValidateAddressesModel() = default; |
|||
|
|||
int rowCount(const QModelIndex &parent) const; |
|||
int columnCount(const QModelIndex &parent) const; |
|||
QVariant data(const QModelIndex &index, int role) const; |
|||
QVariant headerData(int section, Qt::Orientation orientation, int role) const; |
|||
|
|||
private: |
|||
QList<QPair<QString, QString>> props; |
|||
QStringList headers; |
|||
}; |
|||
|
|||
|
|||
#endif // VALIDATEADDRESS_H
|
@ -0,0 +1,85 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>ValidateAddress</class> |
|||
<widget class="QDialog" name="ValidateAddress"> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>400</width> |
|||
<height>300</height> |
|||
</rect> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Validate Address</string> |
|||
</property> |
|||
<layout class="QGridLayout" name="gridLayout"> |
|||
<item row="0" column="1"> |
|||
<widget class="QLabel" name="lblAddress"> |
|||
<property name="text"> |
|||
<string>TextLabel</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="0" column="0"> |
|||
<widget class="QLabel" name="label"> |
|||
<property name="text"> |
|||
<string>Address:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="1" column="0" colspan="2"> |
|||
<widget class="QTableView" name="tblProps"> |
|||
<attribute name="horizontalHeaderStretchLastSection"> |
|||
<bool>true</bool> |
|||
</attribute> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="0" colspan="2"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Close</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>ValidateAddress</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>ValidateAddress</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
Loading…
Reference in new issue