【问题标题】:How to Auto Hide a QWidget in QT5? [closed]如何在 QT5 中自动隐藏 QWidget? [关闭]
【发布时间】:2013-06-24 10:54:06
【问题描述】:

我已将 Qt5.0.1 与 Visual Studio 2010 集成。

我的 Qwidget 中的东西很少,它嵌入到我的父 QWidget 中。

我希望我的孩子 Widget 在大约 10 到 20 秒的时间间隔内自动隐藏。

我可以使用

QWidget::setvisible(true) 和 QWidget::setvisible(false) 通过从任何地方显式调用, 但我想自动隐藏我的孩子 QWidget。

【问题讨论】:

    标签: qt qt4 qt5


    【解决方案1】:

    您可以使用QTimer。

    QWidget *w = new QWidget(this);
    QTimer *t = new QTimer(this);
    connect(t, SIGNAL(timeout()), w, SLOT(hide()));
    t->start(10000);
    

    【讨论】:

    • 感谢您的友好回复,我会检查并回复您。
    • 另外,更简洁地说,QTimer::singleShot(10000, widget, SLOT(hide()));
    猜你喜欢
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-22
    • 1970-01-01
    • 2011-10-29
    相关资源
    最近更新 更多