本文整理汇总了C++中QLabel::y方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::y方法的具体用法?C++ QLabel::y怎么用?C++ QLabel::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::y方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: furTimeHit
void MainWindow::furTimeHit()
{
Obstacle& o = Obstacle::instance();
for (unsigned int i = 0 ; i < furBalls.size(); i++)
{
QLabel * ball = furBalls[i];
ball->move(ball->x() + 2 , ball->y());
/*if (enemyExists == false)
{
}
else if (enemyExists)
{*/
for (unsigned int j = 0; j < o.spawnedObstacles.size(); j++)
{
QLabel * badGuy = new QLabel;
badGuy = o.spawnedObstacles[i];
if (/*enemyExists &&*/ ball->geometry().intersects(badGuy->geometry()))
{
//delete ball;
delete badGuy;
o.spawnedObstacles.erase(o.spawnedObstacles.cbegin());
furBalls.erase(furBalls.cbegin());
//ball = new QLabel(this);
badGuy = new QLabel(this);
delete ball;
ball = new QLabel(this);
}
else if (/*enemyExists && */badGuy->x() < -75)
{
delete badGuy;
o.spawnedObstacles.erase(o.spawnedObstacles.cbegin());
badGuy = new QLabel(this);
}
else if (ball->x() > this->width())
{
delete ball;
furBalls.erase(furBalls.cbegin());
ball = new QLabel(this);
}
}
// }
/*else if (ball->geometry().intersects(dog->geometry()))
{
delete dog;
//dog->deleteLater();
dog = new QLabel(this);
}*/
}
}
示例2: obstacleTimerHit
void MainWindow::obstacleTimerHit()
{
Obstacle& o = Obstacle::instance();
for (unsigned int i = 0; i < o.spawnedObstacles.size(); i++)
{
QLabel * obst = new QLabel;
obst = o.spawnedObstacles[i];
obst->move(obst->x() - 1, obst->y());
}
}
示例3: addCopy
void Progression::addCopy(QString src, QString){
QLabel * label = new QLabel(src, this);
label->setObjectName(src);
label->setMaximumSize(780, 30);
label->setGeometry(label->x(), label->y(), 780, label->height());
QProgressBar * prog = new QProgressBar(this);
prog->setObjectName(src);
prog->setMaximum(QFile(src).size());
vbl->addWidget(label);
vbl->addWidget(prog);
ProgressBars[label->text()] = prog;
qDebug() << label->text();
this->adjustSize();
}
示例4: refresh
void HudScheduling::refresh()
{
int highestPriority = findHighestPriority();
int lowestCycles = findLowestCycles();
int highestCycles = findHighestCycles();
// Update progressbar
const int kPrecition = 500;
float timeUntilScheduling = SETTINGS->timeUntilScheduling;
if(timeUntilScheduling < 0.0f)
timeUntilScheduling = 0.0f;
float schedulerTime = SETTINGS->schedulerTime;
float schedulingRatio = timeUntilScheduling /schedulerTime;
int test = timeUntilScheduling /schedulerTime * kPrecition;
int schedulingProgressbarRatio = kPrecition - test;
if(progressbar->value() != schedulingProgressbarRatio)
{
progressbar->setValue(schedulingProgressbarRatio);
progressbar->update();
// Turn bar red if at scheduling
if(schedulingProgressbarRatio == kPrecition)
{
if(!isScheduling)
{
isScheduling = true;
progressbar->setStyleSheet("QProgressBar::chunk{background-color: rgba(255, 0, 0, 75);}");
}
}
else if(isScheduling)
{
isScheduling = false;
progressbar->setStyleSheet("");
}
}
// Put each item (player) into the correct place relative
// to each other based on their priority
int labelSize = subWindow->height();
int areaWidth = subWindow->width() - itemWidth;
float sectionSize = 0;
if(highestPriority > 0)
sectionSize = areaWidth/highestPriority;
// Determine size and location for each label
for(int i=0; i<items.size(); i++)
{
HudScheduling_Item* item = &items[i];
int priority = item->ptr_player->priority;
int cycles = item->ptr_player->cycles;
// Find our relative index and number of neighbours
CountAndIndex countAndIndex = findRelativeIndex(priority, i);
int numNeighbours = countAndIndex.count;
int relativeIndex = countAndIndex.index;
// Compute size
float cycleRatio = 1.0f;
int deltaCycles = highestCycles - lowestCycles;
if(deltaCycles > 0)
cycleRatio = ((float)(cycles - lowestCycles)) / deltaCycles;
const float kCycleRatioInfluence = 0.4f;
int newItemHeight = itemHeight * (1.0f - kCycleRatioInfluence) + itemHeight * kCycleRatioInfluence * cycleRatio;
if(item->label->height() != newItemHeight)
item->label->resize(itemWidth, newItemHeight);
// Compute location
int index = item->ptr_player->priority;
if(index < 0)
index = 0;
// Make sure all indicators fits by
// flipping them if they reach the left
// edge (reaches max priority)
if(priority > 0 && priority == highestPriority)
relativeIndex = -relativeIndex;
float crowdOffset = relativeIndex * itemWidth;
int offset = (int)(sectionSize * index + crowdOffset);
Float2 target;
target.x = subWindow->x() + offset;
target.y = subWindow->y() + (itemHeight - newItemHeight);
item->targetPosition = target;
}
// Update labels so they can
// interpolate to the correct
// position
for(int i=0; i<items.size(); i++)
{
HudScheduling_Item* item = &items[i];
//.........这里部分代码省略.........
示例5: cloudAntimation
void FCenterWindow::cloudAntimation(animation_Direction direction)
{
QLabel* circle = new QLabel(stackWidget->currentWidget());
QLabel* line = new QLabel(this);
line->setObjectName(QString("AntimationLine"));
line->resize(0, 2);
line->show();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
circle->setPixmap(QPixmap::grabWidget(stackWidget->widget(preindex), stackWidget->widget(preindex)->geometry()));
#else
circle->setPixmap(stackWidget->widget(preindex)->grab());
#endif
// circle->setScaledContents(true);
circle->show();
circle->resize(stackWidget->currentWidget()->size());
QPropertyAnimation *animation = new QPropertyAnimation(circle, "geometry");
animation->setDuration(500);
animation->setStartValue(circle->geometry());
// QPropertyAnimation* animation_line = new QPropertyAnimation(line, "size");
// animation_line->setDuration(500);
// animation_line->setEasingCurve(QEasingCurve::OutQuart);
switch (direction) {
case animationTop:
animation->setEndValue(QRect(circle->x(), circle->y() - 10, circle->width(), 0));
break;
case animationTopRight:
animation->setEndValue(QRect(circle->width(), 0, 0, 0));
break;
case animationRight:
line->move(0, stackWidget->y() - 2);
animation->setEndValue(QRect(circle->width() + 3, 0, 0, circle->height()));
// animation_line->setStartValue(QSize(0, 2));
// animation_line->setEndValue(QSize(stackWidget->width(), 2));
break;
case animationBottomRight:
animation->setEndValue(QRect(circle->width(), circle->height(), 0, 0));
break;
case animationBottom:
animation->setEndValue(QRect(0, circle->height() + 10, circle->width(), 0));
break;
case animationBottomLeft:
animation->setEndValue(QRect(0, circle->height(), 0, 0));
break;
case animationLeft:
animation->setEndValue(QRect(-3, 0, 0, circle->height()));
line->move(stackWidget->x(), stackWidget->y() - 2);
// animation_line->setStartValue(QSize(0, 2));
// animation_line->setEndValue(QSize(stackWidget->width(), 2));
break;
case animationTopLeft:
animation->setEndValue(QRect(0, 0, 0, 0));
break;
case animationCenter:
animation->setEndValue(QRect(circle->width()/2, circle->height()/2, 0, 0));
break;
default:
break;
}
animation->setEasingCurve(QEasingCurve::OutQuart);
QPropertyAnimation* animation_opacity = new QPropertyAnimation(circle, "windowOpacity");
animation_opacity->setDuration(500);
animation_opacity->setStartValue(1);
animation_opacity->setEndValue(0);
animation_opacity->setEasingCurve(QEasingCurve::OutQuart);
QParallelAnimationGroup *group = new QParallelAnimationGroup;
connect(group,SIGNAL(finished()), circle, SLOT(hide()));
connect(group,SIGNAL(finished()), circle, SLOT(deleteLater()));
connect(group,SIGNAL(finished()), line, SLOT(deleteLater()));
connect(group,SIGNAL(finished()), group, SLOT(deleteLater()));
connect(group,SIGNAL(finished()), animation, SLOT(deleteLater()));
connect(group,SIGNAL(finished()), animation_opacity, SLOT(deleteLater()));
// connect(group,SIGNAL(finished()), animation_line, SLOT(deleteLater()));
group->addAnimation(animation);
group->addAnimation(animation_opacity);
// group->addAnimation(animation_line);
group->start();
}