所以我最近开始涉足 Qt 动画框架,我想说一切都很顺利,但是现在我想让它在动画完成后调用一个函数,这可能吗?
我已经尝试在动画开始后执行该函数,但这似乎不起作用(我认为是因为 Qt 动画是在单独的线程上运行的)
我试过的方法很简单:
AnimIn->setDuration(500);
AnimIn->setStartValue(0.f);
AnimIn->setEndValue(1.f);
AnimIn->setEasingCurve(QEasingCurve::InCubic);
AnimIn->start();
MyFunction();
Run Code Online (Sandbox Code Playgroud)
我试过查看 Qt 文档但无济于事,看到几乎所有关于动画和 Qt 的内容都在我不使用的 QML 中。
我已经熟悉 SFINAE 以及如何使用它根据传递的类型启用特定模板(通过使用 std::enable_if)。但是,我最近开始从事一个项目,我想在其中执行以下操作:在使用 SFINAE 时根据提供的枚举 VALUE 创建一个类专业化。现在,我知道考虑到我之前已经这样做过(像这样),可以根据枚举值进行专业化:
enum Specifier
{
One,
Two,
Three
}
template <Specifier>
class Foo
{
public:
void Bar();
}
template<>
void Foo<Specifier::One>::Bar()
{
}
Run Code Online (Sandbox Code Playgroud)
但是现在我想使用 SFINAEBar()对多个枚举值使用特定的专业化。像这样的东西:
template <Specifier Type>
class Foo
{
public:
template <typename std::enable_if<Type == Specifier::Two || Type == Specifier::One, void>::type>
void Bar();
template <typename std::enable_if<Type == Specifier::Three, void>::type>
void Bar();
}
Run Code Online (Sandbox Code Playgroud)
知道这是否可行,如果可以,我将如何进行?