void Xvtr::buildMenu(QMenu* menu) { XvtrEntry* xvtr; QAction* action; menu->clear(); for(int i=0;i<xvtrs.size();++i) { xvtr=xvtrs.at(i); action=new QAction(xvtr->getTitle(),this); menu->addAction(action); //need an event for the new action connect(action,SIGNAL(triggered()),this,SLOT(triggered())); } }
void Xvtr::saveSettings(QSettings* settings) { QString s; XvtrEntry* entry; settings->beginGroup("XVTR"); settings->setValue("count",xvtrs.count()); for(int i=0;i<xvtrs.count();i++) { entry=xvtrs.at(i); s.sprintf("title.%d",i); settings->setValue(s,entry->getTitle()); s.sprintf("minFrequency.%d",i); settings->setValue(s,entry->getMinFrequency()); s.sprintf("maxFrequency.%d",i); settings->setValue(s,entry->getMaxFrequency()); s.sprintf("ifFrequency.%d",i); settings->setValue(s,entry->getIFFrequency()); } settings->endGroup(); }
void Configure::updateXvtrList(Xvtr* xvtr) { // update the list of XVTR entries XvtrEntry* entry; QStringList headings; QString title; QString minFrequency; QString maxFrequency; QString ifFrequency; widget.XVTRTableWidget->clear(); widget.XVTRTableWidget->setRowCount(xvtr->count()); widget.XVTRTableWidget->setColumnCount(4); headings<< "Title" << "Min Frequency" << "Max Frequency" << "IF Frequency"; widget.XVTRTableWidget->setHorizontalHeaderLabels(headings); for(int i=0;i<xvtr->count();i++) { entry=xvtr->getXvtrAt(i); QTableWidgetItem *titleItem=new QTableWidgetItem(entry->getTitle()); titleItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); widget.XVTRTableWidget->setItem(i, 0, titleItem); minFrequency.sprintf("%lld",entry->getMinFrequency()); QTableWidgetItem *minFrequencyItem=new QTableWidgetItem(minFrequency); minFrequencyItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); widget.XVTRTableWidget->setItem(i, 1, minFrequencyItem); maxFrequency.sprintf("%lld",entry->getMaxFrequency()); QTableWidgetItem *maxFrequencyItem=new QTableWidgetItem(maxFrequency); maxFrequencyItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); widget.XVTRTableWidget->setItem(i, 2, maxFrequencyItem); ifFrequency.sprintf("%lld",entry->getIFFrequency()); QTableWidgetItem *ifFrequencyItem=new QTableWidgetItem(ifFrequency); ifFrequencyItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); widget.XVTRTableWidget->setItem(i, 3, ifFrequencyItem); } widget.XVTRTableWidget->resizeColumnsToContents(); }