void MainWindow::testFileChosen(const QString& fileName) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) { QMessageBox::critical(this, tr("Error"), tr("Cannot open the file %1.").arg(fileName)); return; } QTextStream stream(&file); ltf::Document doc; ltf::Parser parser; try { doc = parser.parse(&stream); } catch (const ltf::ParserError& error) { QMessageBox::critical(this, tr("Error"), tr("An error was encountered when reading the test file:\n%1").arg(error.message())); return; } QFileInfo fileInfo(file); Model* model = new Model(doc, fileInfo.dir()); clearContent(); testView = new TestView(model); setCentralWidget(testView); testView->show(); setWindowTitle(windowTitle() + " - " + fileInfo.absoluteFilePath()); showMaximized(); }
SE_PropertySet::~SE_PropertySet() { PropertyMap::iterator it; for(it = mPropertyMap.begin() ; it != mPropertyMap.end(); it++) { clearContent(it); } }
void ViewLevelHistogram::drawStatic() { clearContent(); _painter.setFont(Painter::Font::Large); _painter.setTextColor(WHITE); _painter.printAligned(0, 0, 20, 160, Painter::HAlignment::Center, Painter::VAlignment::Center, "1"); _painter.printAligned(128 - 20, 0, 20, 160, Painter::HAlignment::Center, Painter::VAlignment::Center, "2"); for (int i = -1; i <= 1; i += 2) { int16_t x = 64 + i * 26; Painter::TickPosition tickPosition = i == -1 ? Painter::TickPosition::Left : Painter::TickPosition::Right; switch (_state.level.histogram.range) { case State::Range::Bipolar6V: _painter.drawVerticalScale(Point(x, 80), -6, 6, 10, 1, 2, tickPosition, [] (int16_t value, bool &drawTick, char *label) { drawTick = true; if (value % 5 == 0 || value == -6 || value == 6) { sprintf(label, "%+d", value); } } ); break; case State::Range::Bipolar12V: _painter.drawVerticalScale(Point(x, 80), -12, 12, 5, 1, 2, tickPosition, [] (int16_t value, bool &drawTick, char *label) { drawTick = true; if (value % 5 == 0 || value == -12 || value == 12) { sprintf(label, "%+d", value); } } ); break; case State::Range::Unipolar6V: _painter.drawVerticalScale(Point(x, 140), 0, 6, 20, 1, 2, tickPosition, [] (int16_t value, bool &drawTick, char *label) { drawTick = true; sprintf(label, "%+d", value); } ); break; case State::Range::Unipolar12V: _painter.drawVerticalScale(Point(x, 140), 0, 12, 10, 1, 2, tickPosition, [] (int16_t value, bool &drawTick, char *label) { drawTick = true; if (value % 2 == 0) { sprintf(label, "%+d", value); } } ); break; default: break; } } }
void SE_PropertySet::setContent(const char* name, const _Property& p) { PropertyMap::iterator it = mPropertyMap.find(name); if(it == mPropertyMap.end()) { mPropertyMap[name] = p; return; } clearContent(it); it->second.type = p.type; it->second.prop = p.prop; }
void LoginDialog::validateLogin() { if(ui->userNameLineEdit->text() == "alwindoss" && ui->passwordLineEdit->text() == "OpenSesame") { std::cout << "Login successful\n"; this->setVisible(false); mainWindow->showMaximized(); } else { clearContent(); ui->loginNotificationLabel->setText("User Name or Password mismatch"); } }
bool CFileReader::reload() { if (m_file) { clearContent(); _load(); return true; } else { return open(m_filename.c_str(), true); } }
void Chest::receiveChestInfo(int chestType){ clearContent(); if (chestType == 1){ Item item1("Mace of destruction","mace","none",12,2); Item item2("Small health potion","health potion","none",50,1); addContent(item1); addContent(item2); } else if (chestType == 2){ Item item1("Savage axe","axe","none",18,4); Item item2("Small health potion","health potion","none",50,1); addContent(item1); addContent(item2); } }
void Chest::receiveUseRequest(){ QString output; QTextStream os(&output); os << "Obtained:\n"; for (int i = 0; i < m_itemLimit; ++i){ if (m_contents[i].getType() != "none"){ sendItem(m_contents[i]); os << "* " << m_contents[i].getName() << "\n"; } else { break; } } clearContent(); sendUseReport(output); }
void StatisticsDisplayWidget::_updateStats() { if(!_updatePending) return ; this->setWindowTitle(QString("StatisticsDisplay [") + _title + QString("]") ) ; //rember the current index and set it again if possible once the new Stats have been entered int index = _tabWidget->currentIndex() ; clearContent() ; //create a tab for every Statistics object std::vector<Statistics>::const_iterator it1 = _stats.begin() ; for(; it1 != _stats.end() ; it1++) { QWidget* tab = new QWidget ; QVBoxLayout* vLayout = new QVBoxLayout ; vLayout->setContentsMargins(1,1,1,1) ; QGridLayout* layout = new QGridLayout ; layout->setContentsMargins(1,1,1,1) ; //create a caption-label and a value-LineEdit for every pair in a Statistics Object const Statistics& s = (*it1) ; std::map<std::string, double>::const_iterator it = s.stats.begin() ; int row = 0 ; for(; it != s.stats.end() ; it++) { QLabel* label = new QLabel(QString::fromStdString(it->first), tab) ; //use a line edit for the values to make select-and-copy possible QLineEdit* line = new QLineEdit(QString("%2").arg(it->second), tab) ; line->setReadOnly(true) ; line->setFrame(false) ; layout->addWidget(label, row, 0) ; layout->addWidget(line, row++, 1) ; } //set the layout so it does not spread over the whole available size vLayout->addLayout(layout) ; vLayout->addStretch() ; tab->setLayout(vLayout) ; _tabWidget->addTab(tab, QString::fromStdString(s.origin)) ; } if(index < _tabWidget->count()) { _tabWidget->setCurrentIndex(index) ; } _updatePending = false ; }
void AXmlElement::_addData( const AEmittable& value, AXmlElement::Encoding encoding, bool overwrite // = false ) { AASSERT(this, m_Content.size() < DEBUG_MAXSIZE_AXmlElement); //Debug only limit AXmlData *p = new AXmlData(value, encoding); p->setParent(this); //a_Overwrite clears existing content if (overwrite) clearContent(); m_Content.push_back(p); }
void CDCTableWidget::setNoteItemList(const QList<CNoteItem*>& lstNoteItems) { clearContent(); m_lstNoteItems = lstNoteItems; foreach(CNoteItem* pNoteItem, m_lstNoteItems) { connect(pNoteItem, SIGNAL(dataChanged()), this, SLOT(onNoteItemDataChanged())); connect(pNoteItem, SIGNAL(selectedChanged()), this, SLOT(onNoteItemSelectedChanged())); connect(pNoteItem, SIGNAL(itemStateChanged()), this, SLOT(onNoteItemStateChanged())); int nRowIdx = rowCount(); insertRow(nRowIdx); QTableWidgetItem* pTypeWidgetItem = new QTableWidgetItem(pNoteItem->getIcon(), QString()); pTypeWidgetItem->setData(Qt::UserRole, (qulonglong)pNoteItem); pTypeWidgetItem->setTextAlignment(Qt::AlignCenter); setItem(nRowIdx, 0, pTypeWidgetItem); if(pNoteItem->isNote()) { pTypeWidgetItem->setData(Qt::ToolTipRole, tr("Note")); QTableWidgetItem* pDateWidgetItem = new QTableWidgetItem(pNoteItem->getSetAt().toString(DATE_FORMAT)); pDateWidgetItem->setData(Qt::ToolTipRole, pNoteItem->getSetAt().toString(DATE_FORMAT)); setItem(nRowIdx, 1, pDateWidgetItem); } else { pTypeWidgetItem->setData(Qt::ToolTipRole, tr("Schedule")); QTableWidgetItem* pDateWidgetItem = new QTableWidgetItem(pNoteItem->getSetAt().toString(DATE_TIME_FORMAT)); pDateWidgetItem->setData(Qt::ToolTipRole, pNoteItem->getSetAt().toString(DATE_TIME_FORMAT)); setItem(nRowIdx, 1, pDateWidgetItem); } QTableWidgetItem* pTitleWidgetItem = new QTableWidgetItem(pNoteItem->getTitle()); pTitleWidgetItem->setData(Qt::ToolTipRole, pNoteItem->getTitle()); setItem(nRowIdx, 2, pTitleWidgetItem); }
void ViewScopeXY::drawStatic() { clearContent(); }
void View::drawStatic() { clearContent(); }
MainWindow::~MainWindow() { clearContent(); }
void LoginDialog::on_clearPushButton_clicked() { clearContent(); }
void AXmlElement::clear() { clearContent(); m_Attributes.clear(); mp_Parent = NULL; }