FreeDebks  1.0.3
 All Classes Files Functions Variables Friends Pages
FdJournalFactory.cpp
Go to the documentation of this file.
1 #include "FdJournalFactory.hpp"
2 
3 #include "FdTabCoa.hpp"
4 
5 FdJournalFactory::FdJournalFactory(EntryItemType type, const FdTabCoa* coa) : mType(type), mCoa(coa)
6 {
7 }
8 
12 QWidget* FdJournalFactory::createEditor(QVariant::Type type, QWidget* parent) const
13 {
14  QStringList list;
15 
17  if(mType == DebitAccIdType || mType == CreditAccIdType)
18  list = mCoa->getAccountsIds();
19  else if(mType == DebitAccLabelType || mType == CreditAccLabelType)
20  list = mCoa->getAccountsLabels();
21 
23  QLineEdit* line = new QLineEdit(parent);
24  QCompleter* completer = new QCompleter(list, line);
25  line->setCompleter(completer);
26  return line;
27 }