qtquick: Implement and test View::hide() too
This commit is contained in:
@@ -145,10 +145,12 @@ public:
|
||||
|
||||
void show() override
|
||||
{
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void hide() override
|
||||
{
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
void update() override
|
||||
|
||||
@@ -144,10 +144,6 @@ QWidgetAdapter::QWidgetAdapter(QQuickItem *parent, Qt::WindowFlags flags)
|
||||
setSize(QSize(800, 800));
|
||||
}
|
||||
|
||||
QWidgetAdapter::~QWidgetAdapter()
|
||||
{
|
||||
}
|
||||
|
||||
void QWidgetAdapter::raiseAndActivate()
|
||||
{
|
||||
if (QWindow *w = windowHandle()) {
|
||||
@@ -370,10 +366,6 @@ QPoint QWidgetAdapter::pos() const
|
||||
return geometry().topLeft();
|
||||
}
|
||||
|
||||
void QWidgetAdapter::show()
|
||||
{
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
void QWidgetAdapter::setFixedHeight(int height)
|
||||
{
|
||||
|
||||
@@ -126,7 +126,6 @@ public:
|
||||
void setNormalGeometry(QRect);
|
||||
QRect rect() const;
|
||||
QPoint pos() const;
|
||||
void show();
|
||||
void setFixedHeight(int);
|
||||
void setFixedWidth(int);
|
||||
void raise();
|
||||
@@ -177,11 +176,7 @@ public:
|
||||
void updateGeometry();
|
||||
void resize(QSize);
|
||||
void resize(int w, int h);
|
||||
bool isWindow() const;
|
||||
bool isTopLevel() const
|
||||
{
|
||||
return isWindow();
|
||||
}
|
||||
|
||||
bool isMaximized() const;
|
||||
bool isMinimized() const;
|
||||
bool isActiveWindow() const;
|
||||
@@ -234,7 +229,7 @@ public:
|
||||
Q_SIGNALS:
|
||||
void geometryUpdated(); // similar to QLayout stuff, when size constraints change
|
||||
void itemGeometryChanged(); // emitted when the geometry changes. QQuickItem::geometryChanged()
|
||||
// isn't a signal, so prefixed item
|
||||
// isn't a signal, so prefixed item
|
||||
|
||||
protected:
|
||||
void create();
|
||||
|
||||
@@ -50,7 +50,7 @@ TEST_CASE("View::setParent()")
|
||||
delete rootView2;
|
||||
}
|
||||
|
||||
TEST_CASE("View::isVisible")
|
||||
TEST_CASE("View::isVisible(),show(),hide()")
|
||||
{
|
||||
auto rootView = Platform::instance()->tests_createView();
|
||||
CHECK(!rootView->isVisible());
|
||||
@@ -74,6 +74,16 @@ TEST_CASE("View::isVisible")
|
||||
CHECK(!view2->isVisible());
|
||||
CHECK(!rootView->isVisible());
|
||||
|
||||
// test show()
|
||||
rootView->show();
|
||||
CHECK(rootView->isVisible());
|
||||
CHECK(view2->isVisible());
|
||||
|
||||
// test hide()
|
||||
rootView->hide();
|
||||
CHECK(!rootView->isVisible());
|
||||
CHECK(!view2->isVisible());
|
||||
|
||||
delete rootView;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user