本文整理汇总了C++中QWindow::hide方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::hide方法的具体用法?C++ QWindow::hide怎么用?C++ QWindow::hide使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::hide方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onShow
void onShow(GtkCheckMenuItem *menu, gpointer data)
{
bool checked = gtk_check_menu_item_get_active(menu);
QWindow *w = static_cast<QApplication *>(data)->topLevelWindows().at(0);
if (checked) {
w->show();
}
else {
w->hide();
}
}
示例2: Initialize
bool ErrorReport::Initialize() {
try {
// Create a shared memory object.
m_SharedMemory = boost::interprocess::shared_memory_object(boost::interprocess::open_only, m_SharedMemoryName.toStdString().c_str(), boost::interprocess::read_write);
// Map the whole shared memory in this process
m_MemoryMappedRegion = boost::interprocess::mapped_region(m_SharedMemory, boost::interprocess::read_write);
// Our SharedCrashInfo will be stored in this shared memory.
m_pCrashInfo = static_cast<CrashInfo *>(m_MemoryMappedRegion.get_address());
#if QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)
if(m_pCrashInfo->window) {
QWindow * window = QWindow::fromWinId(m_pCrashInfo->window);
if(window) {
window->showMinimized();
window->hide();
window->setMouseGrabEnabled(true);
window->setMouseGrabEnabled(false);
}
}
#endif
} catch(...) {
m_pCrashInfo = NULL;
m_DetailedError = "We encountered an unexpected error while collecting crash information!";
return false;
}
if(!m_pCrashInfo || m_MemoryMappedRegion.get_size() != sizeof(CrashInfo)) {
m_DetailedError = "The size of the memory mapped region does not match the size of the CrashInfo structure.";
return false;
}
m_pCrashInfo->reporterStarted.post();
return true;
}
示例3: resizemodeitem
void tst_QQuickView::resizemodeitem()
{
QWindow window;
window.setGeometry(0, 0, 400, 400);
QQuickView *view = new QQuickView(&window);
QVERIFY(view);
view->setResizeMode(QQuickView::SizeRootObjectToView);
QCOMPARE(QSize(0,0), view->initialSize());
view->setSource(testFileUrl("resizemodeitem.qml"));
QQuickItem* item = qobject_cast<QQuickItem*>(view->rootObject());
QVERIFY(item);
window.show();
view->show();
// initial size from root object
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 200.0);
QCOMPARE(view->size(), QSize(200, 200));
QCOMPARE(view->size(), view->sizeHint());
QCOMPARE(view->size(), view->initialSize());
// size update from view
view->resize(QSize(80,100));
QTRY_COMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QCOMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), view->sizeHint());
view->setResizeMode(QQuickView::SizeViewToRootObject);
// size update from view disabled
view->resize(QSize(60,80));
QCOMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QTest::qWait(50);
QCOMPARE(view->size(), QSize(60, 80));
// size update from root object
item->setWidth(250);
item->setHeight(350);
QCOMPARE(item->width(), 250.0);
QCOMPARE(item->height(), 350.0);
QTRY_COMPARE(view->size(), QSize(250, 350));
QCOMPARE(view->size(), QSize(250, 350));
QCOMPARE(view->size(), view->sizeHint());
// reset window
window.hide();
delete view;
view = new QQuickView(&window);
QVERIFY(view);
view->setResizeMode(QQuickView::SizeViewToRootObject);
view->setSource(testFileUrl("resizemodeitem.qml"));
item = qobject_cast<QQuickItem*>(view->rootObject());
QVERIFY(item);
window.show();
view->show();
// initial size for root object
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 200.0);
QCOMPARE(view->size(), view->sizeHint());
QCOMPARE(view->size(), view->initialSize());
// size update from root object
item->setWidth(80);
item->setHeight(100);
QCOMPARE(item->width(), 80.0);
QCOMPARE(item->height(), 100.0);
QTRY_COMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), QSize(80, 100));
QCOMPARE(view->size(), view->sizeHint());
// size update from root object disabled
view->setResizeMode(QQuickView::SizeRootObjectToView);
item->setWidth(60);
item->setHeight(80);
QCOMPARE(view->width(), 80);
QCOMPARE(view->height(), 100);
QCOMPARE(QSize(item->width(), item->height()), view->sizeHint());
// size update from view
view->resize(QSize(200,300));
QTest::qWait(50);
QCOMPARE(item->width(), 200.0);
QCOMPARE(item->height(), 300.0);
QCOMPARE(view->size(), QSize(200, 300));
QCOMPARE(view->size(), view->sizeHint());
window.hide();
delete view;
// if we set a specific size for the view then it should keep that size
// for SizeRootObjectToView mode.
view = new QQuickView(&window);
view->resize(300, 300);
//.........这里部分代码省略.........