-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparcelysearchform.cpp
52 lines (43 loc) · 1.42 KB
/
parcelysearchform.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include "parcelysearchform.h"
ParcelySearchForm::ParcelySearchForm(QWidget *parent) :
QWidget(parent)
{
setupUi(this);
connect( typParcelyCombo, SIGNAL( currentIndexChanged( int ) ), this, SLOT( setDruhModel() ) );
QRegExp rx( "[0-9]*/?[0-9]*" );
QValidator *validator = new QRegExpValidator( rx, this );
parCisloLineEdit->setValidator( validator );
}
void ParcelySearchForm::setDruhPozemkuModel( QAbstractItemModel *model )
{
defaultModel = pozemkovaModel = stavebniModel = model;
druhPozemkuCombo->setModel( model );
druhPozemkuCombo->setModelColumn( 1 ); // FIXME: magic number
}
void ParcelySearchForm::setDruhModel()
{
if ( typParcelyCombo->currentIndex() == 1 )
druhPozemkuCombo->setModel( pozemkovaModel );
else if ( typParcelyCombo->currentIndex() == 2 )
druhPozemkuCombo->setModel( stavebniModel );
else
druhPozemkuCombo->setModel( defaultModel );
}
void ParcelySearchForm::setDruhPozemkuStavebniModel(QAbstractItemModel *model)
{
stavebniModel = model;
}
void ParcelySearchForm::setDruhPozemkuPozemkovaModel(QAbstractItemModel *model)
{
pozemkovaModel = model;
}
int ParcelySearchForm::typParcely()
{
return typParcelyCombo->currentIndex();
}
QString ParcelySearchForm::druhPozemkuKod()
{
int row = druhPozemkuCombo->currentIndex();
QModelIndex index = druhPozemkuCombo->model()->index( row, 0 ); // FIXME: magic number
return druhPozemkuCombo->model()->data( index ).toString();
}