QTfrontend/pages.cpp
changeset 1889 b8590b604fdd
parent 1887 d68939b3f7f0
child 1891 47e832a88cbd
equal deleted inserted replaced
1888:e76274ce7365 1889:b8590b604fdd
   896 	pageLayout->addWidget(LE_name, 8, 1);
   896 	pageLayout->addWidget(LE_name, 8, 1);
   897 
   897 
   898 	mapper = new QDataWidgetMapper(this);
   898 	mapper = new QDataWidgetMapper(this);
   899 
   899 
   900 	BtnBack = addButton(":/res/Exit.png", pageLayout, 10, 0, true);
   900 	BtnBack = addButton(":/res/Exit.png", pageLayout, 10, 0, true);
   901 	BtnSave = addButton(":/res/Save.png", pageLayout, 10, 2, true);
   901 	BtnNew = addButton(tr("New"), pageLayout, 10, 1);
       
   902 	BtnPrev = addButton(tr("Prev"), pageLayout, 10, 2);
       
   903 	BtnNext = addButton(tr("Next"), pageLayout, 10, 3);
       
   904 	BtnSave = addButton(":/res/Save.png", pageLayout, 10, 4, true);
   902 
   905 
   903 	connect(BtnSave, SIGNAL(clicked()), mapper, SLOT(toFirst()));
   906 	connect(BtnSave, SIGNAL(clicked()), mapper, SLOT(toFirst()));
       
   907 	connect(BtnNew, SIGNAL(clicked()), this, SLOT(newRow()));
       
   908 	connect(BtnPrev, SIGNAL(clicked()), mapper, SLOT(toPrevious()));
       
   909 	connect(BtnNext, SIGNAL(clicked()), mapper, SLOT(toNext()));
   904 }
   910 }
   905 
   911 
   906 void PageScheme::setModel(QAbstractItemModel * model)
   912 void PageScheme::setModel(QAbstractItemModel * model)
   907 {
   913 {
   908 	mapper->setModel(model);
   914 	mapper->setModel(model);
   917 	mapper->addMapping(SB_SuddenDeath, 7);
   923 	mapper->addMapping(SB_SuddenDeath, 7);
   918 	mapper->addMapping(SB_CaseProb, 8);
   924 	mapper->addMapping(SB_CaseProb, 8);
   919 
   925 
   920 	mapper->toFirst();
   926 	mapper->toFirst();
   921 }
   927 }
       
   928 
       
   929 void PageScheme::newRow()
       
   930 {
       
   931 	QAbstractItemModel * model = mapper->model();
       
   932 	model->insertRow(model->rowCount());
       
   933 	mapper->toLast();
       
   934 }