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


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

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


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

示例1: updateTabs

void TabBarWidget::updateTabs(int index)
{
	if (index < 0 && sender() && sender()->inherits(QStringLiteral("Otter::Window").toLatin1()))
	{
		for (int i = 0; i < count(); ++i)
		{
			if (sender() == qvariant_cast<QObject*>(tabData(i)))
			{
				index = i;

				break;
			}
		}
	}

	const int limit = ((index >= 0) ? (index + 1) : count());

	for (int i = ((index >= 0) ? index : 0); i < limit; ++i)
	{
		const bool isLoading = getTabProperty(i, QLatin1String("isLoading"), false).toBool();
		QLabel *label = qobject_cast<QLabel*>(tabButton(i, QTabBar::LeftSide));

		if (label)
		{
			if (isLoading)
			{
				if (!label->movie())
				{
					QMovie *movie = new QMovie(QLatin1String(":/icons/loading.gif"), QByteArray(), label);
					movie->start();

					label->setMovie(movie);
				}
			}
			else
			{
				if (label->movie())
				{
					label->movie()->deleteLater();
					label->setMovie(NULL);
				}

				label->setPixmap(getTabProperty(i, QLatin1String("icon"), QIcon(getTabProperty(i, QLatin1String("isPrivate"), false).toBool() ? ":/icons/tab-private.png" : ":/icons/tab.png")).value<QIcon>().pixmap(16, 16));
			}
		}
	}

	showPreview(tabAt(mapFromGlobal(QCursor::pos())));
}
开发者ID:cgschwarz,项目名称:otter,代码行数:49,代码来源:TabBarWidget.cpp

示例2: playMovie

void tst_QMovie::playMovie()
{
    QFETCH(QString, fileName);
    QFETCH(int, frameCount);

    QMovie movie(fileName);

    QCOMPARE(movie.state(), QMovie::NotRunning);
    movie.setSpeed(1000);
    movie.start();
    QCOMPARE(movie.state(), QMovie::Running);
    movie.setPaused(true);
    QCOMPARE(movie.state(), QMovie::Paused);
    movie.start();
    QCOMPARE(movie.state(), QMovie::Running);
    movie.stop();
    QCOMPARE(movie.state(), QMovie::NotRunning);
    movie.jumpToFrame(0);
    QCOMPARE(movie.state(), QMovie::NotRunning);
    movie.start();
    QCOMPARE(movie.state(), QMovie::Running);

    connect(&movie, SIGNAL(finished()), this, SLOT(exitLoopSlot()));

    QLabel label;
    label.setMovie(&movie);
    label.show();

    QTestEventLoop::instance().enterLoop(20);
    QVERIFY2(!QTestEventLoop::instance().timeout(),
            "Timed out while waiting for finished() signal");

    QCOMPARE(movie.state(), QMovie::NotRunning);
    QCOMPARE(movie.frameCount(), frameCount);
}
开发者ID:Blizzard,项目名称:qt4,代码行数:35,代码来源:tst_qmovie.cpp

示例3: checkLogin

void LoginWidget::checkLogin()
{
  QString user = _editUsername->text();
  QString pass = _editPassword->text();
  QString ip = _editIp->text();
  QMovie *movie = new QMovie("./gui/ring.gif");
  QLabel *processLabel = new QLabel(this);

  processLabel->setMovie(movie);
  movie->start();

  _userString = user.toUtf8().constData();
  _passString = pass.toUtf8().constData();
  _ipString = ip.toUtf8().constData();

  if (_userString == "" || _passString == "" || _ipString == "")
    {
      QMessageBox *msgBox = new QMessageBox(this);

      msgBox->setText("Please fill the fields");
      msgBox->exec();
    }
  else
    {
      _editPassword->clear();

      this->clearLayout(_mainLayout);
      _mainLayout->addWidget(processLabel, 0, 0, Qt::AlignCenter);

      g_PTUser.logUser(_userString, _passString, _ipString);
    }
}
开发者ID:charvoa,项目名称:cpp_babel,代码行数:32,代码来源:LoginWidget.cpp

示例4: main

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QMovie *mov = new QMovie(":/img/pics/start.gif");
    QLabel *label = new QLabel("",0);
    label->setGeometry(450,200,500,300);
    label->setMovie(mov);
    mov->start();
    label->setWindowFlags(Qt::FramelessWindowHint);
    label->show();

    QTime t;
    t.start();
    while(t.elapsed() < 1500)
    {
        a.processEvents();
    }


    MainWindow w;
    w.show();
    w.move((QApplication::desktop()->width()-w.width())/2,(QApplication::desktop()->height()-w.height())/2);
    label->close();

    return a.exec();
}
开发者ID:chenliusuo,项目名称:Mobile_Assistant_For_Linux,代码行数:27,代码来源:main.cpp

示例5: infiniteLoop

void tst_QMovie::infiniteLoop()
{
    QLabel label;
    label.show();
    QMovie *movie = new QMovie(QLatin1String(":animations/corrupt.gif"), QByteArray(), &label);
    label.setMovie(movie);
    movie->start();

    QTestEventLoop::instance().enterLoop(1);
    QTestEventLoop::instance().timeout();
}
开发者ID:MarianMMX,项目名称:MarianMMX,代码行数:11,代码来源:tst_qmovie.cpp

示例6: setMovie

void ImageView::setMovie(QMovie *movie)
{
  reset();

  QLabel *label = new QLabel();
  label->setMovie(movie);
  movie->setParent(label);

  movie->start();

  m_proxy = m_scene->addWidget(label);
  m_scene->setSceneRect(0, 0, label->sizeHint().width(), label->sizeHint().height());
}
开发者ID:Artanomell,项目名称:schat,代码行数:13,代码来源:ImageView.cpp

示例7: createLoadingView

void CloudView::createLoadingView()
{
    loading_view_ = new QWidget(this);

    QVBoxLayout *layout = new QVBoxLayout;
    loading_view_->setLayout(layout);

    QMovie *gif = new QMovie(":/images/loading.gif");
    QLabel *label = new QLabel;
    label->setMovie(gif);
    label->setAlignment(Qt::AlignCenter);
    gif->start();

    layout->addWidget(label);
}
开发者ID:sebheitzmann,项目名称:seafile-client,代码行数:15,代码来源:cloud-view.cpp

示例8: QGraphicsProxyWidget

void ImageProxyItem::Private::onFinished(int /*id*/, QMovie * movie) {
    QLabel * label = new QLabel;
    label->setMovie(movie);
    movie->setParent(label);
    movie->start();
    label->resize(movie->frameRect().size());
    QGraphicsProxyWidget * item = new QGraphicsProxyWidget(this->owner);
    item->setWidget(label);
    // HACK workaround for https://bugreports.qt.io/browse/QTBUG-55070
    item->setOpacity(0.99);

    this->movie = movie;
    this->item = item;

    this->activity = Activity::Activated;

    emit this->owner->activated(this->owner);
}
开发者ID:legnaleurc,项目名称:komix,代码行数:18,代码来源:imageproxyitem.cpp

示例9: main

int main(int argc, char *argv[])
{
    Application app(argc, argv);

    QEventLoop loop;

    auto s(std::async(std::launch::async, [&loop]{ Datum::Solve solve(Datum::solve()); if (loop.isRunning()) { loop.quit(); } return std::move(solve); }));

    QLabel splash;
    splash.setMovie(new QMovie(([](){
        static const QString basePath(":/splash/busy/");
        const QStringList files(QDir(basePath).entryList(QStringList() << "*.gif"));

        std::random_device rd;
        std::mt19937 gen(rd());

        std::uniform_int_distribution<> d(0,files.size() - 1);
        const QString& result(files.at(d(gen)));
        return basePath + result;
    })()));
    splash.movie()->start();
    splash.show();
    splash.setWindowTitle("computing. . .");

    if (s.wait_until(std::chrono::system_clock::now()) != std::future_status::ready) {
        loop.exec();
    }
    splash.hide();
    app.showBarley();

    Datum::Solve solve(s.get());

    Datum d;
    while (!solve.empty()) {
        Application::showDatum(d);
        d = d.realize(solve.top());
        solve.pop();
    }
    Application::showDatum(d, false);

    app.quit();
    return 0;
}
开发者ID:BOPOHOB,项目名称:Breadth-first-search,代码行数:43,代码来源:main.cpp

示例10: QWidget

DemoWidget::DemoWidget(QWidget* _parent)
    : QWidget(_parent)
{
    QLightBoxWidget* lightBox = new QLightBoxWidget(this);

    QLabel* text = new QLabel("Some information in <b>html</b> format<br/>"
                              "<ul><li>one</li><li>two</li><li>three</li></ul>");
    QLabel* image = new QLabel;
    image->setPixmap(QPixmap(":/image.jpg"));
    QPushButton* showLB = new QPushButton(tr("Show"));

    QGridLayout* mainLayout = new QGridLayout;
    mainLayout->addWidget(text, 0, 0, Qt::AlignTop);
    mainLayout->addWidget(image, 0, 1);
    mainLayout->addWidget(showLB, 1, 1);

    this->setLayout(mainLayout);

    QLabel* lbTitle = new QLabel(tr("QLightBoxWidget"));
    lbTitle->setStyleSheet("font-size: 28px; font-weight: bold; color: white");
    QLabel* lbProgress = new QLabel;
    QMovie* progressMovie = new QMovie(":/loader.gif");
    lbProgress->setMovie(progressMovie);
    progressMovie->start();
    QLabel* lbDescription = new QLabel(tr("Example how to use QLightBoxWidget\n"
                                          "in your QtWidgets applications..."));
    lbDescription->setStyleSheet("color: white");
    QPushButton* lbClose = new QPushButton(tr("Close"));

    QGridLayout* lbLayout = new QGridLayout;
    lbLayout->setRowStretch(0, 1);
    lbLayout->setColumnStretch(0, 1);
    lbLayout->addWidget(lbTitle, 1, 1);
    lbLayout->addWidget(lbProgress, 1, 2, Qt::AlignRight);
    lbLayout->setColumnStretch(3, 1);
    lbLayout->addWidget(lbDescription, 2, 1, 1, 2);
    lbLayout->addWidget(lbClose, 3, 2);
    lbLayout->setRowStretch(4, 1);

    connect(showLB, SIGNAL(clicked()), lightBox, SLOT(show()));
    connect(lbClose, SIGNAL(clicked()), lightBox, SLOT(hide()));
    lightBox->setLayout(lbLayout);
}
开发者ID:Iownnoname,项目名称:qt,代码行数:43,代码来源:demowidget.cpp

示例11: Init

void BusyIndicator::Init(const QString& text) {
  movie_ = new QMovie(":spinner.gif"),
  label_ = new QLabel;

  QLabel* icon = new QLabel;
  icon->setMovie(movie_);
  icon->setMinimumSize(16, 16);

  label_->setWordWrap(true);
  label_->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);

  QHBoxLayout* layout = new QHBoxLayout(this);
  layout->setContentsMargins(0, 0, 0, 0);
  layout->addWidget(icon);
  layout->addSpacing(6);
  layout->addWidget(label_);

  set_text(text);
}
开发者ID:GitAnt,项目名称:Clementine,代码行数:19,代码来源:busyindicator.cpp

示例12: createDemoWidget

QWidget* createDemoWidget( const QString& movieFile )
{
    QLabel* label = new QLabel;
    QPushButton* playBtn = new QPushButton("Play");
    QPushButton* stopBtn = new QPushButton("Stop");
    
    QWidget* demo = new QWidget;
    demo->setGeometry( 1, 1, 450, 450 );
    demo->setLayout( new QVBoxLayout );
    demo->layout()->addWidget( label );
    demo->layout()->addWidget( playBtn );
    demo->layout()->addWidget( stopBtn );
    
    QMovie* movie = new QMovie(movieFile);
    label->setMovie( movie );
	label->setFixedHeight( 400 );
    QObject::connect( playBtn, SIGNAL(clicked()), movie, SLOT(start()) );
    QObject::connect( stopBtn, SIGNAL(clicked()), movie, SLOT(stop()) );
    return demo;
}
开发者ID:512400330,项目名称:osgRecipes,代码行数:20,代码来源:osg_qtwidgets.cpp

示例13: QWidget

WaterWaveBtn::WaterWaveBtn(const QString& pngFile, QWidget *parent)
    : QWidget(parent)
{
    m_Movie = new QMovie(":/Resource/waterWave.gif");
	m_Movie->setCacheMode(QMovie::CacheAll);
	QLabel*	waterWaveLabel = new QLabel(this);
	waterWaveLabel->setMovie(m_Movie);
	waterWaveLabel->setAttribute(Qt::WA_TranslucentBackground,true);
	m_Movie->start();
	m_Movie->setPaused(true);
    LabelBtn* labelBtn = new LabelBtn(pngFile,":/Resource/sound.wav",this);
    int size = QPixmap(":/Resource/waterWave.gif").width();
	int gap = (size - labelBtn->width())/2;
	labelBtn->move(gap,gap);
	this->setFixedSize(size,size);

	this->setAttribute(Qt::WA_TranslucentBackground);
//	this->setWindowFlags(Qt::FramelessWindowHint|Qt::Window|Qt::WindowSystemMenuHint|Qt::WindowMinimizeButtonHint|Qt::WindowMaximizeButtonHint);

	connect(labelBtn, SIGNAL(clicked()), this, SLOT(showWaterWave()));
}
开发者ID:Iownnoname,项目名称:qt,代码行数:21,代码来源:waterwavebtn.cpp

示例14: QDialog

MovieDisplay::MovieDisplay(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MovieDisplay)
{
    ui->setupUi(this);

    //This block of code displays Llama gif when a riddle is anwsered correctly
    QMovie *movie = new QMovie("://images/pm8gm.gif");
    QLabel *processLabel = new QLabel(this);
    processLabel->setGeometry(QRect(0,-75,300,300));
    processLabel->setMovie(movie);
    movie->start();

    //This block of code plays an audio file when a riddle is answered correctly.
    //IMPORTANT::Audio path must be hard coded to location of file!
    QMediaPlayer *player = new QMediaPlayer(this);
    player->setVolume(50);
    player->setMedia(QUrl("http://shredder.resnet.bju/sound/649341_SOUNDDOGS__an.mp3"));
    player->setVolume(100);
    player->play();
}
开发者ID:CKost,项目名称:undersea-llamas,代码行数:21,代码来源:moviedisplay.cpp

示例15: spawnObstacles

QLabel* Obstacle::spawnObstacles(QWidget *parent)
{
    Obstacle& o = Obstacle::instance();

    QLabel * enemyLabel = new QLabel(parent);
    Object * enemyObject;

    int enemySelect = rand() % 3;

    if(enemySelect==0){
        QMovie * dogMovie = new QMovie(":/dog.gif");
        enemyObject = new MadDog();
        enemyLabel->setMovie(dogMovie);
        enemyLabel->setGeometry(parent->width(),460,128,192);
        dogMovie->start();
    }else if(enemySelect == 1){
        enemyObject = new LawnMower;
        QPixmap mower(":/lawnmower2.png");
        enemyLabel->setPixmap(mower);
        enemyLabel->setGeometry(parent->width(), 514, 128,128);
    }else if(enemySelect==2){
        enemyObject =new Hole;
        QPixmap hole(":/hole.png");
        enemyLabel->setPixmap(hole);
        enemyLabel->setGeometry(parent->width(),615,128,768);
    }

    enemyLabel->setScaledContents(true);
    enemyLabel->show();

    objects.push_back(enemyObject);
    spawnedObstacles.push_back(enemyLabel);

    return enemyLabel;


}
开发者ID:ProjectAzariah,项目名称:tmproj,代码行数:37,代码来源:event.cpp


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