本文整理汇总了C++中QLabel::movie方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::movie方法的具体用法?C++ QLabel::movie怎么用?C++ QLabel::movie使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::movie方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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())));
}
示例2: role
/*! \reimp */
QAccessible::Role Q3AccessibleDisplay::role(int child) const
{
QLabel *l = qobject_cast<QLabel*>(object());
if (l) {
if (l->pixmap() || l->picture())
return Graphic;
if (l->picture())
return Graphic;
if (l->movie())
return Animation;
}
return QAccessibleWidget::role(child);
}
示例3: animationLoading
QLabel* TabbedWebView::animationLoading(int index, bool addMovie)
{
if (index == -1) {
return 0;
}
QLabel* loadingAnimation = qobject_cast<QLabel*>(m_tabWidget->getTabBar()->tabButton(index, QTabBar::LeftSide));
if (!loadingAnimation) {
loadingAnimation = new QLabel();
}
if (addMovie && !loadingAnimation->movie()) {
QMovie* movie = new QMovie(":icons/other/progress.gif", QByteArray(), loadingAnimation);
movie->setSpeed(70);
loadingAnimation->setMovie(movie);
movie->start();
}
else if (loadingAnimation->movie()) {
loadingAnimation->movie()->stop();
}
m_tabWidget->getTabBar()->setTabButton(index, QTabBar::LeftSide, 0);
m_tabWidget->getTabBar()->setTabButton(index, QTabBar::LeftSide, loadingAnimation);
return loadingAnimation;
}
示例4: 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;
}
示例5: role
/*! \reimp */
QAccessible::Role QAccessibleDisplay::role(int child) const
{
QLabel *l = qobject_cast<QLabel*>(object());
if (l) {
if (l->pixmap())
return Graphic;
#ifndef QT_NO_PICTURE
if (l->picture())
return Graphic;
#endif
#ifndef QT_NO_MOVIE
if (l->movie())
return Animation;
#endif
#ifndef QT_NO_PROGRESSBAR
} else if (qobject_cast<QProgressBar*>(object())) {
return ProgressBar;
#endif
}
return QAccessibleWidgetEx::role(child);
}
示例6: 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 QSize size = tabSizeHint(count() - 1);
const int limit = ((index >= 0) ? (index + 1) : count());
const bool canResize = (m_tabSize > 0);
const bool isHorizontal = (shape() == QTabBar::RoundedNorth || shape() == QTabBar::RoundedSouth);
const bool isNarrow = ((isHorizontal ? size.width() : size.height()) < 60);
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));
}
}
if (canResize)
{
QWidget *button = tabButton(i, QTabBar::RightSide);
if (button)
{
button->setVisible((!isNarrow || (i == currentIndex())) && !getTabProperty(i, QLatin1String("isPinned"), false).toBool());
}
}
}
showPreview(tabAt(mapFromGlobal(QCursor::pos())));
}