#include "mymvc.h"
#include "myView.h"
#include "sbook.h"
#include "myModel.h"
#include "myHeaderView.h"
#include <QList>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QRadioButton>
MyMVC
::MyMVC(QList<MTR
::Book>
* list,
QWidget* parent
) { slist = new QList<MTR::SBook>();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
setFixedSize(590,400);
qcb->addItem(tr("filter by Title"));
qcb->addItem(tr("filter by Author"));
qcb->addItem(tr("filter by Publisher"));
qcb->setCurrentIndex(0);
model = new myModel(*slist,le,qcb);
model->filter();
qtv = new myView(model);
qtv->header()->setSortIndicator(0,Qt::DescendingOrder);
label
= new QLabel(tr
("Enter a character string below"));
//radioOne = new QRadioButton(tr("Case Sensitive - TRUE"));
//radioTwo = new QRadioButton(tr("Case Sensitive - FALSE"));
//radioOne->setChecked(true);
caseSensitive = true;
//connect(radioOne,SIGNAL(toggled(bool)),this,SLOT(setCaseSensitive(bool)));
connect(qcb,SIGNAL(currentIndexChanged(int)),le,SLOT(clear()));
connect(qcb,SIGNAL(currentIndexChanged(int)),qtv,SLOT(filter()));
connect(le,
SIGNAL(textChanged
(const QString &)),qtv,
SLOT(filter
()));
connect(model,SIGNAL(fromTVtoVM(int)),this,SIGNAL(doubleClickInTreeView(int)));
qvb->addWidget(label,0,0);
//qvb->addWidget(radioOne,0,1);
qvb->addWidget(le,1,0);
//qvb->addWidget(radioTwo,1,1);
qvb->addWidget(qcb,2,0,1,2);
qvb->addWidget(qtv,3,0,1,2);
setLayout(qvb);
}
void MyMVC::prodModel(QList<MTR::Book>* list) {
slist->clear();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
model->setInternalList(*slist);
qcb->setCurrentIndex(0);
qtv->filter();
}
#include "mymvc.h"
#include "myView.h"
#include "sbook.h"
#include "myModel.h"
#include "myHeaderView.h"
#include <QList>
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QRadioButton>
MyMVC::MyMVC(QList<MTR::Book>* list, QWidget* parent) {
slist = new QList<MTR::SBook>();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
setFixedSize(590,400);
le = new QLineEdit();
qcb = new QComboBox();
qcb->addItem(tr("filter by Title"));
qcb->addItem(tr("filter by Author"));
qcb->addItem(tr("filter by Publisher"));
qcb->setCurrentIndex(0);
model = new myModel(*slist,le,qcb);
model->filter();
qtv = new myView(model);
qtv->header()->setSortIndicator(0,Qt::DescendingOrder);
label = new QLabel(tr("Enter a character string below"));
//radioOne = new QRadioButton(tr("Case Sensitive - TRUE"));
//radioTwo = new QRadioButton(tr("Case Sensitive - FALSE"));
//radioOne->setChecked(true);
caseSensitive = true;
qvb = new QGridLayout();
//connect(radioOne,SIGNAL(toggled(bool)),this,SLOT(setCaseSensitive(bool)));
connect(qcb,SIGNAL(currentIndexChanged(int)),le,SLOT(clear()));
connect(qcb,SIGNAL(currentIndexChanged(int)),qtv,SLOT(filter()));
connect(le,SIGNAL(textChanged(const QString &)),qtv,SLOT(filter()));
connect(model,SIGNAL(fromTVtoVM(int)),this,SIGNAL(doubleClickInTreeView(int)));
qvb->addWidget(label,0,0);
//qvb->addWidget(radioOne,0,1);
qvb->addWidget(le,1,0);
//qvb->addWidget(radioTwo,1,1);
qvb->addWidget(qcb,2,0,1,2);
qvb->addWidget(qtv,3,0,1,2);
setLayout(qvb);
}
void MyMVC::prodModel(QList<MTR::Book>* list) {
slist->clear();
for(int i = 0;i<list->size();++i) {
slist->append(MTR::SBook(i,list->value(i)));
}
model->setInternalList(*slist);
qcb->setCurrentIndex(0);
qtv->filter();
}
To copy to clipboard, switch view to plain text mode
Bookmarks