本文整理汇总了C++中QList::pop_front方法的典型用法代码示例。如果您正苦于以下问题:C++ QList::pop_front方法的具体用法?C++ QList::pop_front怎么用?C++ QList::pop_front使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QList
的用法示例。
在下文中一共展示了QList::pop_front方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadEmptyModels
void Sonos::loadEmptyModels()
{
QList<QPair<ListModel*, SONOS::LockGuard> > left;
{
SONOS::Locked<ManagedContents>::pointer mc = m_library.Get();
for (ManagedContents::iterator it = mc->begin(); it != mc->end(); ++it)
if (!it->model->m_loaded)
left.push_back(qMakePair(it->model, SONOS::LockGuard(it->model->m_lock)));
}
emit loadingStarted();
if (!left.empty())
{
while (!left.isEmpty())
{
QPair<ListModel*, SONOS::LockGuard> item = left.front();
item.first->load();
left.pop_front();
}
}
emit loadingFinished();
}
示例2: readParameterCombination
void TestPJobFile::readParameterCombination(){
createTestParametercombinationFile("testReadParameterCombination.xml");
QList<PJobFileParameter> parameters = PJobFile::readParameterCombination("testReadParameterCombination.xml");
QFile::remove("testReadParameterCombination.xml");
QCOMPARE(parameters.size(), 2);
PJobFileParameter p1 = parameters.front();
parameters.pop_front();
PJobFileParameter p2 = parameters.front();
QCOMPARE(p1.name(), QString("length"));
QCOMPARE(p1.isVariation(), false);
QCOMPARE(p1.value(), 100.);
QCOMPARE(p2.name(), QString("power"));
QCOMPARE(p2.isVariation(), true);
QCOMPARE(p2.minValue(), 1.);
QCOMPARE(p2.maxValue(), 15.);
QCOMPARE(p2.step(), 1.);
}
示例3: clear
void TreeModel::clear()
{
if(_rootItem->childCount())
{
QList<TreeItem*> items = QList<TreeItem*>();
QList<TreeItem*> del = QList<TreeItem*>();
items << _rootItem;
del << _rootItem;
while(items.count()) {
TreeItem* parent = items.first();
for(int i = 0; i < parent->childCount(); i++) {
del << parent->child(i);
items << parent->child(i);
}
items.pop_front();
}
// удаляем начиная с конца, т.е. сначала удаляем наследников, потом,
// поднимаясь наверх - предков, пока не дойдем до rootItem
beginResetModel();
while(1) {
// qDebug() << del.last()->data(0).toString();
del.last()->removeChildren(0, del.last()->childCount());
if(_rootItem == del.last()) break;
del.pop_back();
}
// rootItem->removeChildren(0, 3/*rootItem->childCount()*/); //! !!!!!!!!!
endResetModel();
}
}
示例4: readResultDefinitions
void TestPJobFile::readResultDefinitions(){
createTestResultDefinitions("testReadResultDefinitions.xml");
QList<PJobResultFile> resultFiles = PJobFile::readResultDefintions("testReadResultDefinitions.xml");
QFile::remove("testReadResultDefinitions.xml");
QCOMPARE(resultFiles.size(), 1);
PJobResultFile p = resultFiles.front();
QList<PJobResult> results = p.results();
QCOMPARE(p.filename(), QString("ParameterVariation.txt"));
QCOMPARE(results.size(), 2);
PJobResult r1 = results.front();
results.pop_front();
PJobResult r2 = results.front();
QCOMPARE(r1.name(), QString("EOP"));
QCOMPARE(r1.unit(), QString(""));
QCOMPARE(r2.name(), QString("Q"));
QCOMPARE(r2.unit(), QString("dB"));
}
示例5: readParameterDefinitions
void TestPJobFile::readParameterDefinitions(){
createTestParameterdefinitionFile("testReadParameterDefinitions.xml");
QList<PJobFileParameterDefinition> parameters = PJobFile::readParameterDefinitions("testReadParameterDefinitions.xml");
QFile::remove("testReadParameterDefinitions.xml");
QCOMPARE(parameters.size(), 2);
PJobFileParameterDefinition p1 = parameters.front();
parameters.pop_front();
PJobFileParameterDefinition p2 = parameters.front();
QCOMPARE(p1.name(), QString("length"));
QCOMPARE(p1.defaultValue(), 100.);
QCOMPARE(p1.hasMinValue(), false);
QCOMPARE(p1.hasMaxValue(), false);
QCOMPARE(p2.name(), QString("power"));
QCOMPARE(p2.defaultValue(), 5.);
QCOMPARE(p2.hasMinValue(), true);
QCOMPARE(p2.hasMaxValue(), true);
QCOMPARE(p2.minValue(), 1.);
QCOMPARE(p2.maxValue(), 15.);
}
示例6: cast
QModelIndex cast( NifModel * nif, const QModelIndex & index ) override final
{
QModelIndex iData = getStripsData( nif, index );
QModelIndex iLength = nif->getIndex( iData, "Strip Lengths" );
QModelIndex iPoints = nif->getIndex( iData, "Points" );
if ( !( iLength.isValid() && iPoints.isValid() ) )
return index;
QList<QVector<quint16> > strips;
for ( int r = 0; r < nif->rowCount( iPoints ); r++ )
strips += nif->getArray<quint16>( iPoints.child( r, 0 ) );
if ( strips.isEmpty() )
return index;
QVector<quint16> strip = strips.first();
strips.pop_front();
for ( const QVector<quint16>& s : strips ) {
// TODO: optimize this
if ( strip.count() & 1 )
strip << strip.last() << s.first() << s.first() << s;
else
strip << strip.last() << s.first() << s;
}
nif->set<int>( iData, "Num Strips", 1 );
nif->updateArray( iLength );
nif->set<int>( iLength.child( 0, 0 ), strip.size() );
nif->updateArray( iPoints );
nif->updateArray( iPoints.child( 0, 0 ) );
nif->setArray<quint16>( iPoints.child( 0, 0 ), strip );
return index;
}
示例7: while
//-----------------------------------------------------------
CenaObjetos::~CenaObjetos(void)
{
QGraphicsItemGroup *item=NULL;
QList<QGraphicsItem *> itens;
TipoObjetoBase tipos[]={ OBJETO_RELACAO, OBJETO_CAIXA_TEXTO,
OBJETO_VISAO, OBJETO_TABELA };
unsigned i;
this->removeItem(ret_selecao);
this->removeItem(linha_rel);
//Remove os objetos em ordem conforme o vetor tipos[]
for(i=0; i < 4; i++)
{
itens=this->items();
while(!itens.isEmpty())
{
//Obtém o item e já tentando convertê-lo para QGraphicsItemGroup
item=dynamic_cast<QGraphicsItemGroup *>(itens.front());
/* Caso o objeto seja um grupo de itens e possa ser convertido para uma das
classes OGRelacionamento, OGTabela, OGCaixaTexto ou OGVisao, significa que
o item pode ser removido */
if(item && !item->parentItem() &&
((dynamic_cast<OGRelacionamento *>(item) && tipos[i]==OBJETO_RELACAO) ||
(dynamic_cast<OGCaixaTexto *>(item) && tipos[i]==OBJETO_CAIXA_TEXTO) ||
(dynamic_cast<OGVisao *>(item) && tipos[i]==OBJETO_VISAO) ||
(dynamic_cast<OGTabela *>(item) && tipos[i]==OBJETO_TABELA)))
{
this->removeItem(item);
}
itens.pop_front();
}
}
}
示例8: selectObjects
void DialogDistance::selectObjects() {
static bool select_allowed = true;
if (select_allowed == false)
return;
QList<QListWidgetItem*> selectedItems = objectList->selectedItems();
if (selectedItems.size() < 2)
return;
select_allowed = false;
while (selectedItems.size() > 2) {
selectedItems.front()->setSelected(false);
selectedItems.pop_front();
}
selectedNodes.clear();
selectedJoints.clear();
for (unsigned int i = 0 ; i < (unsigned int)selectedItems.size(); i++) {
int m = selectedItems[i]->text().indexOf(" ");
int n = selectedItems[i]->text().indexOf(":");
unsigned long object_id = selectedItems[i]->text().mid(m, n-m).toULong();
if (selectedItems[i]->text().left(m) == "Node")
selectedNodes.push_back(object_id);
else
selectedJoints.push_back(object_id);
}
updateProperties();
select_allowed = true;
}
示例9: selectActor
//.........这里部分代码省略.........
activeIndex = index;
}
++index;
}
ui.comboBoxAnimation->blockSignals(false);
if(activeIndex > 0){
ui.comboBoxAnimation->setCurrentIndex(activeIndex);
}
}
ui.stackedWidget->setCurrentIndex(0);
ui.comboBoxAnimation->blockSignals(false);
}
else if(actor->getActorType() == wt::ASceneActor::eTYPE_PARTICLE_EFFECT){
ui.stackedWidget->setCurrentIndex(1);
}
else if(actor->getActorType() == wt::ASceneActor::eTYPE_POINT_LIGHT){
ui.stackedWidget->setCurrentIndex(2);
const wt::PointLight* light = static_cast<const wt::PointLight*>(actor);
ui.lightAttenuation->setValue(glm::vec3(
light->getDesc().attenuation.constant,
light->getDesc().attenuation.linear,
light->getDesc().attenuation.quadratic
));
ui.lightColor->setColor(
light->getDesc().color
);
ui.lightAmbientIntensity->setValue(
light->getDesc().ambientIntensity
);
ui.lightDiffuseIntensity->setValue(
light->getDesc().diffuseIntensity
);
}
else if(actor->getActorType() == wt::ASceneActor::eTYPE_SOUND){
ui.stackedWidget->setCurrentIndex(3);
const wt::Sound* sound = dynamic_cast<const wt::Sound*>(actor);
ui.volume->setValue( sound->getSound()->getVolume()*100.0f );
ui.attenuation->setValue( sound->getSound()->getAttenuation() );
ui.minDistance->setValue( sound->getSound()->getMinimumDistance() );
ui.pitch->setValue( sound->getSound()->getPitch() );
}
else if(actor->getActorType() == wt::ASceneActor::eTYPE_COLLIDER){
ui.stackedWidget->setCurrentIndex(4);
}
else{
WT_THROW("Unsupported actor type");
}
// Update tarnsform information
updateSelectionStats();
}
else if(mState == eSTATE_PICK_ATTACH_ACTOR){
if(actor == NULL){
mAttachActor = NULL;
}
if(actor->getActorType() == wt::ASceneActor::eTYPE_MODELLED){
mAttachActor = dynamic_cast<wt::ModelledActor*>(actor);
if(mAttachActor->getModel()->hasSkeleton()){
QList<wt::SkeletonBone*> bones;
bones << mAttachActor->getModel()->getSkeleton();
ui.attachBone->clear();
while(!bones.empty()){
wt::SkeletonBone* bone = bones.front();
bones.pop_front();
for(uint32_t i=0; i<bone->getNumChildren(false); i++){
bones.push_back(bone->getChildAt(i));
}
QString boneName = QString(bone->getName().c_str());
ui.attachBone->addItem( boneName );
}
}
}
mState = eSTATE_NORMAL;
}
}
示例10: compareFiles
void MainWindow::compareFiles()
{
if(list_hist.size() != 0)
{
QDir dir;
QStringList filtros ;
filtros << "*.jpg" << ".*png" << "*.bmp";
QString fileName = QFileDialog::getOpenFileName(this,
tr("Load Image to Compare"),
QDir::currentPath(),
tr("Images (*.jpg *.png *.bmp)"));
QDir file = QFileInfo(fileName).absoluteDir();
if(fileName.toStdString() != "")
{
QString image = fileName.split( "/" ).back();
QString image_path = file.absolutePath() + "/" + image;
QString xml = "hist_"+ QString("%1").arg(this->imageID +1, 6, 10, QChar('0')) + ".xml";
QString xml_path = dir.absolutePath() + "/" + this->HistFolder+"/"+ xml;
// Extract HSV and compare.
Histogram *h = new Histogram(image.toStdString(), image_path.toStdString(), xml_path.toStdString());
// COMPARE HISTOGRAM
// PARALLEL CODE
int i;
QList<Histogram*> list_hist;
list_hist = this->list_hist;
#pragma omp parallel firstprivate(list_hist) shared(h)
{
#pragma omp for private(i)
for(i = 0; i < list_hist.length(); i++)
h->compareHistogram(h, list_hist.at(i), 1);
#pragma omp barrier
}
// END PARALLEL CODE
// SORT TOP 15
QList<Histogram*> ranking;
for(i = 0; i < list_hist.length(); i++)
{
if(ranking.length() < 15)
{
ranking.push_back(list_hist.at(i));
}
else
{
if(list_hist.at(i)->getCompare() > ranking.at(0)->getCompare())
{
ranking.pop_front();
ranking.push_back(list_hist.at(i));
}
}
qSort(ranking.begin(), ranking.end(), compLess<Histogram>());
}
this->edit->append("\nTOP 15:\n");
QList<QString> imagesToShow;
for(i = ranking.length() - 1; i >= 0 ; i--)
{
QString text = "Image: " + QString::fromStdString(ranking.at(i)->getName()) + " is " + QString::number(ranking.at(i)->getCompare()) + "% similar";
imagesToShow.append("images/" + QString::fromStdString(ranking.at(i)->getName()));
this->edit->append(text);
}
ShowImages showImages(imagesToShow);
showImages.setWindowTitle("View Images");
showImages.exec();
}
}
else
{
QMessageBox msgBox;
QString stringMsg = "No existe BBDD de imágenes para comparar.";
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText(stringMsg);
msgBox.exec();
}
}
示例11: buildForest
void BFSForest::buildForest() {
QList<RoadVertexDesc> seeds;
QList<int> groups;
QMap<RoadEdgeDesc, bool> visitedEdge;
QMap<RoadVertexDesc, bool> visitedVertex;
// ルートとして与えられた頂点について
for (int i = 0; i < roots.size() / 2; i++) {
RoadVertexDesc src = roots[i * 2];
RoadVertexDesc tgt = roots[i * 2 + 1];
// エッジの取得
RoadEdgeDesc e_desc = GraphUtil::getEdge(roads, src, tgt);
// エッジのグループ、seedフラグを設定
roads->graph[e_desc]->group = i;
roads->graph[e_desc]->seed = true;
// 頂点srcが既存のシードと重複している場合
if (seeds.contains(src)) {
// 頂点srcをコピーする
RoadVertex* v = new RoadVertex(roads->graph[src]->pt);
RoadVertexDesc new_src = boost::add_vertex(roads->graph);
roads->graph[new_src] = v;
// 古いエッジを削除
roads->graph[e_desc]->valid = false;
// 新しいエッジを追加
e_desc = GraphUtil::addEdge(roads, new_src, tgt, roads->graph[e_desc]);
src = new_src;
}
// 頂点tgtが既存のシードと重複している場合
if (seeds.contains(tgt)) {
// 頂点tgtをコピーする
RoadVertex* v = new RoadVertex(roads->graph[tgt]->pt);
RoadVertexDesc new_tgt = boost::add_vertex(roads->graph);
roads->graph[new_tgt] = v;
// 古いエッジを削除
roads->graph[e_desc]->valid = false;
// 新しいエッジを追加
e_desc = GraphUtil::addEdge(roads, src, new_tgt, roads->graph[e_desc]);
tgt = new_tgt;
}
// src、tgtが更新されたかも知れないので、おおもとのデータも更新しておく
roots[i * 2] = src;
roots[i * 2 + 1] = tgt;
// シードを登録する
seeds.push_back(src);
seeds.push_back(tgt);
groups.push_back(i);
groups.push_back(i);
// ルートエッジ・頂点を訪問済みとマークする
visitedEdge[e_desc] = true;
visitedVertex[src] = true;
visitedVertex[tgt] = true;
}
// ルート頂点リストからスタートして、BFSで全頂点を訪問する
while (!seeds.empty()) {
RoadVertexDesc parent = seeds.front();
seeds.pop_front();
int group = groups.front();
groups.pop_front();
std::vector<RoadVertexDesc> children;
// 隣接ノードリストを先に洗い出す
std::vector<RoadVertexDesc> nodes;
std::vector<RoadEdgeDesc> edges;
RoadOutEdgeIter ei, eend;
for (boost::tie(ei, eend) = boost::out_edges(parent, roads->graph); ei != eend; ++ei) {
if (!roads->graph[*ei]->valid) continue;
if (visitedEdge[*ei]) continue;
// 隣接ノードを取得
RoadVertexDesc child = boost::target(*ei, roads->graph);
if (!roads->graph[child]->valid) continue;
if (getParent(parent).contains(child)) continue;
nodes.push_back(child);
edges.push_back(*ei);
// 当該エッジを通過したとマークする
visitedEdge[*ei] = true;
}
// 洗い出した隣接ノードに対して、訪問する
for (int i = 0; i < nodes.size(); i++) {
//.........这里部分代码省略.........
示例12: run
void CacheThread::run()
{
while (!p->exit_)
{
// Wait until we're told there are images we need to request.
waiting_mutex_.lock();
// Next, get all of them and sort them by priority.
p->unprocessed_mutex_.lock();
QList<ImagePtr> images = p->unprocessed_.values();
p->unprocessed_mutex_.unlock();
qSort(images.begin(), images.end(), ComparePriority);
// Go through all of them and request them. Qt's network manager will
// only handle six simultaneous requests at once, so we use a semaphore
// to limit ourselves to that many.
// Each individual image will release the semaphore when it is done loading.
// Also, only load up to a certain number at a time in this loop. If there
// are more left afterward, we'll start over. This ensures that we
// concentrate on processing the highest-priority images.
int count = 0;
while (!p->exit_ && !images.empty() && count < MAXIMUM_SEQUENTIAL_REQUESTS)
{
p->network_request_semaphore_.acquire();
ImagePtr image = images.front();
p->unprocessed_mutex_.lock();
if (!image->Loading() && !image->Failed())
{
count++;
image->SetLoading(true);
images.pop_front();
QString uri = image->Uri();
size_t hash = p->uri_to_hash_map_[uri];
if (uri.startsWith(QString("file:///")))
{
image->InitializeImage();
QString filepath = uri.replace(QString("file:///"), QString("/"));
if (!image->GetImage()->load(filepath))
{
image->ClearImage();
image->AddFailure();
}
p->unprocessed_.remove(hash);
p->uri_to_hash_map_.remove(uri);
image->SetLoading(false);
p->network_request_semaphore_.release();
}
else
{
Q_EMIT RequestImage(image->Uri());
}
}
else
{
images.pop_front();
}
p->unprocessed_mutex_.unlock();
}
if (!images.empty())
{
waiting_mutex_.unlock();
}
}
}
示例13: generateSpell
Spell Magic::generateSpell(SpellField field)
{
QList<Position> list;
QList<ActiveEffect> effects;
QList<ActiveEffect>::iterator iter;
ActiveEffect* worker;
//crating mask for field
bool **mask = new bool*[field.size.x];
for (int i = 0; i < field.size.x; ++i){
mask[i] = new bool[field.size.y];
for(int n = 0; n < field.size.y; ++n)
if(field.map[i][n] != Runes::End)
mask[i][n] = true;
else
mask[i][n] = false;
}
if(field.mainRune.x > -1 && field.mainRune.y > -1 && field.map[field.mainRune.x][field.mainRune.y] != Runes::End){
Position current(field.mainRune.x,field.mainRune.y);
ActiveEffect work;
Effect effect;
int cost = 0;
Rune *mainRune = runes[field.map[current.x][current.y]];
work.effect = mainRune->combinationEffect(field.map[current.x][current.y]);
work.coefficient = 1;
effects.append(work);
cost += mainRune->getCost();
mask[current.x][current.y] = false;
//select next rune
if(current.x > 0 && mask[current.x-1][current.y]){
list.append(Position(current.x-1,current.y));
mask[current.x-1][current.y] = false;
}
if(current.x < field.size.x-1 && mask[current.x+1][current.y]){
list.append(Position(current.x+1,current.y));
mask[current.x+1][current.y] = false;
}
if(current.y > 0 && mask[current.x][current.y-1]){
list.append(Position(current.x,current.y-1));
mask[current.x][current.y-1] = false;
}
if(current.y < field.size.y-1 && mask[current.x][current.y+1]){
list.append(Position(current.x,current.y+1));
mask[current.x][current.y+1] = false;
}
while(!list.isEmpty()){
current = list.first();
//qDebug() << current.x << " " << current.y;
list.pop_front();
effect = mainRune->combinationEffect(field.map[current.x][current.y]);
bool flag = true;
for(iter = effects.begin(); iter != effects.end(); iter++){
if(iter->effect == effect)
{
iter->coefficient++;
flag = false;
break;
}
}
if(flag){
work.effect = effect;
effects.append(work);
}
cost += runes[field.map[current.x][current.y]]->getCost();
//select next rune
if(current.x > 0&& mask[current.x-1][current.y]){
list.append(Position(current.x-1,current.y));
mask[current.x-1][current.y] = false;
}
if(current.x < field.size.x-1 && mask[current.x+1][current.y]){
list.append(Position(current.x+1,current.y));
mask[current.x+1][current.y] = false;
}
if(current.y > 0 && mask[current.x][current.y-1]){
list.append(Position(current.x,current.y-1));
mask[current.x][current.y-1] = false;
}
if(current.y < field.size.y-1 && mask[current.x][current.y+1]){
list.append(Position(current.x,current.y+1));
mask[current.x][current.y+1] = false;
}
}
int size;
worker = new ActiveEffect[size = effects.size()];
for(int i = 0; i < size; i++){
worker[i] = effects.first();
effects.pop_front();
}
return Spell("Success", cost, worker, size);
}
//.........这里部分代码省略.........
示例14: exportPlot
//.........这里部分代码省略.........
if (c != nullptr) {
QPen p = c->pen();
qreal w = p.widthF();
qreal nw;
curvePenWidths.push_back(w);
nw = w - 1.0;
if (nw < 0.0)
nw = 0.0;
p.setWidthF(nw);
c->setPen(p);
}
i->attach(&exPlot);
}
/* Scale up from millimeters to centimeters*/
QSizeF dimensionsMM(p.dimensions.width() * 10.0, p.dimensions.height() * 10.0);
/* Store current properties of the plot as we need to change them for rendering */
QFont xBottomFont = plot->axisWidget(QwtPlot::xBottom)->font();
QFont xTopFont = plot->axisWidget(QwtPlot::xTop)->font();
QFont yLeftFont = plot->axisWidget(QwtPlot::yLeft)->font();
QFont yRightFont = plot->axisWidget(QwtPlot::yRight)->font();
QFont xBottomTitleFont = plot->axisTitle(QwtPlot::xBottom).font();
QFont xTopTitleFont = plot->axisTitle(QwtPlot::xTop).font();
QFont yLeftTitleFont = plot->axisTitle(QwtPlot::yLeft).font();
QFont yRightTitleFont = plot->axisTitle(QwtPlot::yRight).font();
QFont titleFont = plot->title().font();
const qreal xBottomPenWidth = plot->axisWidget(QwtPlot::xBottom)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::xBottom)->scaleDraw()->penWidth() : 1.0;
const qreal xTopPenWidth = plot->axisWidget(QwtPlot::xTop)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::xTop)->scaleDraw()->penWidth() : 1.0;
const qreal yLeftPenWidth = plot->axisWidget(QwtPlot::yLeft)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::yLeft)->scaleDraw()->penWidth() : 1.0;
const qreal yRightPenWidth = plot->axisWidget(QwtPlot::yRight)->scaleDraw()->penWidth() > 0 ? plot->axisWidget(QwtPlot::yRight)->scaleDraw()->penWidth() : 1.0;
/* Recalculate sizes by the DPI for every element that needs it */
const qreal outputInPixels = (static_cast<qreal>(p.dimensions.width()) / 2.54) * p.dpi;
const qreal scalingRatio = (static_cast<qreal>(qApp->desktop()->logicalDpiX()) / p.dpi) * (outputInPixels / plot->geometry().width());
const qreal _xBottomPenWidth = floor((xBottomPenWidth * scalingRatio) + 0.45);
const qreal _xTopPenWidth = floor((xTopPenWidth * scalingRatio) + 0.45);
const qreal _yLeftPenWidth = floor((yLeftPenWidth * scalingRatio) + 0.45);
const qreal _yRightPenWidth = floor((yRightPenWidth * scalingRatio) + 0.45);
xBottomFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
xTopFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
yLeftFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
yRightFont.setPointSizeF(p.axisNumbersFontSize * scalingRatio);
xBottomTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
xTopTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
yLeftTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
yRightTitleFont.setPointSizeF(p.axisTitlesFontSize * scalingRatio);
titleFont.setPointSizeF(p.chartTitleFontSize * scalingRatio);
exPlot.axisWidget(QwtPlot::xBottom)->scaleDraw()->setPenWidth(_xBottomPenWidth);
exPlot.axisWidget(QwtPlot::xTop)->scaleDraw()->setPenWidth(_xTopPenWidth);
exPlot.axisWidget(QwtPlot::yLeft)->scaleDraw()->setPenWidth(_yLeftPenWidth);
exPlot.axisWidget(QwtPlot::yRight)->scaleDraw()->setPenWidth(_yRightPenWidth);
exPlot.setPalette(m_plotPalette);
exPlot.axisWidget(QwtPlot::xBottom)->setPalette(m_plotPalette);
exPlot.axisWidget(QwtPlot::xTop)->setPalette(m_plotPalette);
exPlot.axisWidget(QwtPlot::yLeft)->setPalette(m_plotPalette);
exPlot.axisWidget(QwtPlot::yRight)->setPalette(m_plotPalette);
exPlot.axisWidget(QwtPlot::xBottom)->setFont(xBottomFont);
exPlot.axisWidget(QwtPlot::xTop)->setFont(xTopFont);
exPlot.axisWidget(QwtPlot::yLeft)->setFont(yLeftFont);
exPlot.axisWidget(QwtPlot::yRight)->setFont(yRightFont);
setAxisTitleFont(&exPlot, QwtPlot::xBottom, xBottomTitleFont);
setAxisTitleFont(&exPlot, QwtPlot::xTop, xTopTitleFont);
setAxisTitleFont(&exPlot, QwtPlot::yLeft, yLeftTitleFont);
setAxisTitleFont(&exPlot, QwtPlot::yRight, yRightTitleFont);
setTitleFont(&exPlot, titleFont);
exPlot.replot();
renderPlotToFile(&exPlot, path, p.format, dimensionsMM, p.dpi);
/* Reattach the plots back to the GUI plot */
for (QwtPlotItem *i : curves) {
QwtPlotCurve *c = dynamic_cast<QwtPlotCurve *>(i);
if (c != nullptr) {
QPen p = c->pen();
if (curvePenWidths.isEmpty())
break;
p.setWidthF(curvePenWidths.front());
curvePenWidths.pop_front();
c->setPen(p);
}
i->attach(plot);
}
break; /* Exit the while loop */
}
}
示例15: updateCache
void MainWindow::updateCache(QList<int> addr, QList<short> cMem, QList<int> bit, QList<int> hit)
{
int cL = this->ui->tableWidget->columnCount() - 2;
int iter = cMem.size() / cL;
QList<int> back = addr;
int n = 0;
if (!addr.isEmpty() && !cMem.isEmpty() && !bit.isEmpty())
{
for (int i = 0; i<iter; i++)
{
short base = log2(ui->tableWidget->columnCount() - 2);
int mask = -1 << (base-1);
int tag = addr[0] & mask;
QTableWidgetItem *item = new QTableWidgetItem;
QString num = QString::number(tag, 16);
item->setText(num);
this->ui->tableWidget->setItem(i,0,item);
for (int j = 0; j<cL; j++)
{
addr.pop_front();
}
for (int k = 0; k< cL; k ++)
{
QTableWidgetItem *item2 = new QTableWidgetItem;
QString num = QString::number(cMem[0], 10);
item2->setText(num);
item2->setTextColor(Qt::red);
if (hit.contains(back[n]))
{
item2->setTextColor(Qt::green);
}
this->ui->tableWidget->setItem(i,k+1,item2);
cMem.pop_front();
n++;
}
QTableWidgetItem *item4 = new QTableWidgetItem;
item4->setText("0");
this->ui->tableWidget->setItem(i,cL+1,item4);
for (int l = 0; l < cL; l ++)
{
if (bit[0] > 0)
{
QTableWidgetItem *item3 = new QTableWidgetItem;
item3->setText("1");
this->ui->tableWidget->setItem(i,cL+1,item3);
}
bit.pop_front();
}
}
}
else
{
this->ui->tableWidget->clearContents();
}
}