当前位置: 首页>>代码示例>>C++>>正文


C++ QLabel::objectName方法代码示例

本文整理汇总了C++中QLabel::objectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::objectName方法的具体用法?C++ QLabel::objectName怎么用?C++ QLabel::objectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QLabel的用法示例。


在下文中一共展示了QLabel::objectName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: onRemoveLabel

void Progression::onRemoveLabel(QString name)
{
	qDebug() << "trying to remove label and progress bar for :" << name;
	for(int i = 0; i < vbl->count(); i++)
	{
		QLayoutItem* item = vbl->itemAt(i);
		QWidget* widget = item->widget();
		if (widget) {
			QLabel *label = qobject_cast<QLabel *>(widget);

			if(label and label->objectName() == name )
			{
				label->hide();
				vbl->removeItem(item);
				qDebug() << "Remove Label";
				i--;
			}

			QProgressBar * pb = qobject_cast<QProgressBar *>(widget);
			if(pb and pb->objectName() == name)
			{
				pb->hide();
				vbl->removeItem(item);
				qDebug() << "Remove Progbar";
				i--;
			}

		}
	}
	this->adjustSize();
}
开发者ID:ThomasAy,项目名称:Duplicateur,代码行数:31,代码来源:Progression.cpp

示例2: incrementProgressBar

void Progression::incrementProgressBar(QString file, QString currentFile){
	//qDebug() << "The value was" << ProgressBars[file]->value();
	if(ProgressBars[file]->value() < ProgressBars[file]->maximum())
		ProgressBars[file]->setValue(ProgressBars[file]->value() + 1);
	//qDebug() << "The value is" << ProgressBars[file]->value();

	if(currentFile != "")
	{
		for(int i = 0; i < vbl->count(); i++)
		{
			QLayoutItem* item = vbl->itemAt(i);
			QWidget* widget = item->widget();
			if (widget) {
				QLabel *label = qobject_cast<QLabel *>(widget);
				if(label)
				{
					if(label->objectName() == file)
					{
						label->setText("Copy " + currentFile.split("/").last() + " to " + currentFile);
					}
				}
			}
		}
	}
	this->adjustSize();
}
开发者ID:ThomasAy,项目名称:Duplicateur,代码行数:26,代码来源:Progression.cpp

示例3: setFilm

void FilmPreviewer::setFilm(FilmListItem *value)
{
  if (!value) {
    static FilmListItem hideitem(0);
    value = & hideitem;
  }
  ffilm = value;
  QList<QLabel *> list = findChildren<QLabel *>();
  for(QList<QLabel*>::Iterator labIter = list.begin(); labIter!=list.end(); ++labIter) {
    QLabel *lab = *labIter;
    static QRegExp rxStaticText = QRegExp("^statictext[\\d]+$");
    QString name = lab->objectName();
    if (rxStaticText.indexIn( name ) >=0 ) continue;
    int baseProp = FilmListItem::jsonNames().indexOf(name);
    switch (baseProp) {
    case FilmListItem::JsonNPoster:
      if (ffilm->poster().isNull()) lab->setText(FilmListItem::noposter());
      else lab->setPixmap(ffilm->poster());
      break;
    case FilmListItem::JsonNTitle:
      lab->setText(ffilm->title);
      break;
    case FilmListItem::JsonNGenres:
      lab->setText("\""+ffilm->genres.join("\", \"")+"\"");
      break;
    case FilmListItem::JsonNOverview:
      lab->setText(ffilm->overview);
      break;
    default:
      lab->setText(ffilm->property.value(name).toString());
    }
  }
  ui->player_content->playMedia(ffilm->video);
}
开发者ID:fenicsant,项目名称:restream_quest,代码行数:34,代码来源:filmpreviewer.cpp

示例4: dropEvent

void CompareDialog::dropEvent(QDropEvent *event)
{
  QLabel * child = qobject_cast<QLabel*>(childAt(event->pos()));
  if (!child) return;
  if (child->objectName().contains("label_1")) {   
    model1Valid = handleDroppedModel(event->mimeData(), model1, ui->label_1);
  }
  else if (child->objectName().contains("label_2")) {
    model2Valid = handleDroppedModel(event->mimeData(), model2, ui->label_2);
  }
  event->accept();
  if (model1Valid && model2Valid) {
    multimodelprinter.setModel(0, model1);
    multimodelprinter.setModel(1, model2);
    ui->textEdit->setHtml(multimodelprinter.print(ui->textEdit->document()));
  }
}
开发者ID:BenZoFly,项目名称:opentx,代码行数:17,代码来源:comparedialog.cpp

示例5: mousePressEvent

void MainWindow::mousePressEvent(QMouseEvent *event){

    // imprimindo mensagem de debug
    qDebug()<<"MainWindow::mousePressEvent(QMouseEvent *event)";

    QLabel *label = static_cast<QLabel*>(childAt(event->pos()));
    if (!label || label->objectName()=="centralWidget"
            || label->objectName()==""
            || label->objectName()=="diagrama"){
        return;
    }

    // imprimindo mensagem para debug
    qDebug()<<label->objectName();

    QPixmap pixmap = *label->pixmap();
    QByteArray itemData;
    QDataStream dataStream(&itemData, QIODevice::WriteOnly);
    dataStream << pixmap << QPoint(event->pos() - label->pos());
    QMimeData *mimeData = new QMimeData();
    mimeData->setData("application/x-dnditemdata", itemData);
    QDrag *drag = new QDrag(this);
    drag->setMimeData(mimeData);
    drag->setPixmap(pixmap);
    drag->setHotSpot(event->pos() - label->pos());
    QPoint pointAtual = event->pos();

    if(pointAtual.x() > ui->diagrama->geometry().x()
            && pointAtual.y() > ui->diagrama->geometry().y()
            && pointAtual.x() < ui->diagrama->width()) {
        label->close();
    }

    if (drag->exec(Qt::CopyAction | Qt::MoveAction, Qt::CopyAction) == Qt::MoveAction) {
        label->show();
        label->setPixmap(pixmap);
    }
}
开发者ID:ederschramm,项目名称:network-simulation,代码行数:38,代码来源:mainwindow.cpp

示例6: initialLayout

void Combat::initialLayout()
{
    vertical_layout = new QGridLayout;
    playerCount = detectWhichPlayer();
    for(int i = 0; i < playerCount.size(); i++)
    {
        switch (playerCount.at(i)) {
        case 1:
            vertical_layout->addWidget(createPlayerBox(PlayerOneThing,1),i,0);
            break;
        case 2:
            vertical_layout->addWidget(createPlayerBox(PlayerTwoThing,2),i,0);
            break;
        case 3:
            vertical_layout->addWidget(createPlayerBox(PlayerThreeThing,3),i,0);
            break;
        case 4:
            vertical_layout->addWidget(createPlayerBox(PlayerFourThing,4),i,0);
            break;
        default:
            break;
        }
        //initial the hitpoint for each player
        QLabel *hitPoint = new QLabel;
        hitPoint->setObjectName("0");
        QString temp ="Player " + QString::number(playerCount.at(i)) + " HitPoint : " + hitPoint->objectName();
        hitPoint->setText(temp);
        playerHitPoint.push_back(hitPoint);
        vertical_layout->addWidget(hitPoint,i,1);
        //initial the building if owerner have one
        if(ownPlayer == playerCount.at(i))
        {
            if(HexBuilding)
            {

                buildingButton = new QPushButton;
                buildingButton->setObjectName(QString::number(getHexBuilding()->getID()));
                QString temp = "border-image: url(" + getHexBuilding()->getUrl();
                buildingButton->setStyleSheet(temp + ")");
                buildingButton->setFixedSize(80,80);
                connect(buildingButton,SIGNAL(clicked()),this,SLOT(buildingButtonClickSlot()));
                vertical_layout->addWidget(buildingButton,i,2);
                //initial the building value
                buildingValue = getHexBuilding()->getIncome();
            }
        }
    }
    //roll the dice first
    rollDice = true;
    //initial the dice widget
    dice = new DiceWidget(this);
    vertical_layout->addWidget(dice,0,3);
    dice->setFixedSize(100,100);
    connect(dice, SIGNAL(updateDiceValueSignal(int)), this, SLOT(updateDiceValueSlot(int)));
    dice->show();
    //set the player turn label
    playerTurnLabel = new QLabel;
    playerTurnLabel->setStyleSheet("background-color: white;");
    setPlayerTurn(playerCount.at(0));
    vertical_layout->addWidget(playerTurnLabel,0,4);
    //initial the button
    button = new QPushButton;
    button2 = new QPushButton;
    button->setText("Continue");
    button2->setText("Retreats");
    vertical_layout->addWidget(button,1,3);
    vertical_layout->addWidget(button2,1,4);
    connect(button,SIGNAL(clicked()),this,SLOT(continueButtonSlot()));
    connect(button2,SIGNAL(clicked()),this,SLOT(retreatButtonSlot()));
    button->hide();
    button2->hide();
    //add the globalwidget
    globalWidget = new QWidget(this);
    globalWidget->setLayout(vertical_layout);
}
开发者ID:xinhaowang,项目名称:King-new,代码行数:75,代码来源:combat.cpp


注:本文中的QLabel::objectName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。