本文整理汇总了C++中QWidget::close方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::close方法的具体用法?C++ QWidget::close怎么用?C++ QWidget::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWidget
的用法示例。
在下文中一共展示了QWidget::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LookingForDB
void MangaW::LookingForDB(void)
{
QWidget * loadingWidget = new QWidget;
QVBoxLayout * loadingLayout = new QVBoxLayout; // Layout Vertical Box
QLabel * loadingTexte = new QLabel("Restauration des sauvegardes"); // Label = Texte
QProgressBar * loadingProgressBar = new QProgressBar; // Barre de progression
loadingProgressBar->setRange(0, 0); // ProgressBar en "chargement indéfini"
loadingLayout->addWidget(loadingTexte);
loadingLayout->addWidget(loadingProgressBar);
loadingWidget->setLayout(loadingLayout); // On ajoute le layout au Widget
loadingWidget->show(); // On affiche le widget
// On vérifie l'existance de la sauvegarde
if ( T.DB_Existe() && T.DB_Charger() )
{
loadingWidget->close();
this->ClassicStart();
}
else
{
loadingWidget->close();
this->FirstStart();
}
// ---
}
示例2: clear
/*!
\fn OptToolBar::clear()
*/
void OptToolBar::clear()
{
QLayoutItem *item = NULL;
QWidget* wind = NULL;
//clear all cell except the last line
for(int i=0; i<mRow; ++i)
{
for(int j=0; j<mColSize; ++j)
{
item = NULL;
item = mLayout->itemAtPosition(i, j);
if(item)
{
wind = NULL;
wind = item->widget();
if( wind ) //is a widget
{
mLayout->removeWidget( wind );
wind->close();
}
else //is layout item
{
mLayout->removeItem(item);
}
} // end if(item)
}// end for(int j=0; j<mColSize; ++j)
}//end for(int i=0; i<mRow; ++i)
//clear the last line
for(int i=0; i<mCol; ++i)
{
item = NULL;
item = mLayout->itemAtPosition(mRow, i);
if(item)
{
wind = NULL;
wind = item->widget();
if( wind ) //is a widget
{
mLayout->removeWidget( wind );
wind->close();
}
else //is layout item
{
mLayout->removeItem(item);
}
}// end if(item)
}//end for(int i=0; i<mCol; ++i)
mRow = 0;
mCol = 0;
}
示例3: deleteSelf
void MDIView::deleteSelf()
{
// When using QMdiArea make sure to remove the QMdiSubWindow
// this view is associated with.
//
// #0001023: Crash when quitting after using Windows > Tile
// Use deleteLater() instead of delete operator.
QWidget* parent = this->parentWidget();
if (qobject_cast<QMdiSubWindow*>(parent)) {
// https://forum.freecadweb.org/viewtopic.php?f=22&t=23070
#if QT_VERSION < 0x050000
// With Qt5 this would lead to some annoying flickering
getMainWindow()->removeWindow(this);
#endif
parent->close();
}
else {
this->close();
}
// detach from document
if (_pcDocument)
onClose();
_pcDocument = 0;
}
示例4: closeEvent
/* Handles closing all of the open editor windows when the window is closed */
void MainWindow::closeEvent(QCloseEvent *e)
{
int widgetCount = ui_tabWidget->count();
while(ui_tabWidget->count() > 0) {
ui_tabWidget->setCurrentIndex(0);
closeTab();
if(ui_tabWidget->count() == widgetCount) {
qWarning() << "Ignoring close event.";
e->ignore();
return;
}
--widgetCount;
}
//Close all other windows
hide();
QListIterator<QWidget *> i(qApp->topLevelWidgets());
while(i.hasNext()) {
QWidget *w = i.next();
if(w->isVisible())
w->close();
}
QMainWindow::closeEvent(e);
}
示例5: openBookmark
void Menu::openBookmark()
{
QWidget *menu = this;
while (menu)
{
menu->close();
menu = menu->parentWidget();
if (!menu || !menu->inherits(QLatin1String("QMenu").data()))
{
break;
}
}
MainWindow *mainWindow = MainWindow::findMainWindow(parent());
QAction *action = qobject_cast<QAction*>(sender());
if (action && action->data().type() == QVariant::ModelIndex)
{
m_bookmark = dynamic_cast<BookmarksItem*>(BookmarksManager::getModel()->itemFromIndex(action->data().toModelIndex()));
}
if (mainWindow)
{
const WindowsManager::OpenHints hints = (action ? static_cast<WindowsManager::OpenHints>(action->data().toInt()) : WindowsManager::DefaultOpen);
mainWindow->getWindowsManager()->open(m_bookmark, ((hints == WindowsManager::DefaultOpen) ? WindowsManager::calculateOpenHints() : hints));
}
m_bookmark = NULL;
}
示例6: mouseReleaseEvent
void Menu::mouseReleaseEvent(QMouseEvent *event)
{
if (m_role == BookmarksMenuRole && (event->button() == Qt::LeftButton || event->button() == Qt::MiddleButton))
{
QAction *action = actionAt(event->pos());
if (action && action->isEnabled() && action->data().type() == QVariant::ModelIndex)
{
QWidget *menu = this;
while (menu)
{
menu->close();
menu = menu->parentWidget();
if (!menu || !menu->inherits(QLatin1String("QMenu").data()))
{
break;
}
}
MainWindow *mainWindow = MainWindow::findMainWindow(parent());
if (mainWindow)
{
mainWindow->getWindowsManager()->open(dynamic_cast<BookmarksItem*>(BookmarksManager::getModel()->itemFromIndex(action->data().toModelIndex())), WindowsManager::calculateOpenHints(event->modifiers(), event->button()));
return;
}
}
}
QMenu::mouseReleaseEvent(event);
}
示例7: main
Q_DECL_EXPORT
#endif
int main(int argc, char *argv[])
{
#ifdef MEEGO_EDITION
QScopedPointer<QApplication> app(MDeclarativeCache::qApplication(argc, argv));
#else
QScopedPointer<QApplication> app(new QApplication(argc, argv));
#endif
QTextCodec::setCodecForTr(QTextCodec::codecForName("utf-8"));
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("utf-8"));
#ifdef Q_WS_MAEMO_5
QWidget *loadingWindow = new QWidget();
loadingWindow->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
loadingWindow->setAttribute(Qt::WA_Maemo5ShowProgressIndicator, Qt::Checked);
loadingWindow->show();
app->processEvents();
#endif
Core::ModuleManagerImpl core;
Q_UNUSED(core);
// At first time use current time with pointers to initiators
qsrand(uint(std::time(0)) ^ qHash(qApp));
// At second random value
qsrand(uint(qrand()));
// It looks like Qt doesn't always use srand as backend of qsrand
srand(uint(qrand()));
#ifdef Q_WS_MAEMO_5
loadingWindow->close();
#endif
return app->exec();
}
示例8: WidgetQ
logical OFrame :: DA_SaveClose ( )
{
QWidget *qwidget = WidgetQ();
QWidget *qparent = qwidget ? qwidget->parentWidget() : NULL;
logical term = NO;
BEGINSEQ
OEHDataWidget::DA_Save();
/// q3 there is no mainWidget
// if ( qwidget == qApp->mainWidget() )
// term = Quit();
// else
{
if ( !qparent ) ERROR
if ( qparent->inherits("QDialog") )
((ODialog *)(QDialog *)qparent)->accept();
else
qparent->close();
}
RECOVER
term = YES;
ENDSEQ
return(term);
}
示例9: setMode
void DolphinView::setMode(Mode mode)
{
if (mode == m_mode) {
return; // the wished mode is already set
}
QWidget* view = (m_iconsView != 0) ? static_cast<QWidget*>(m_iconsView) :
static_cast<QWidget*>(m_detailsView);
if (view != 0) {
m_topLayout->remove(view);
view->close();
view->deleteLater();
m_iconsView = 0;
m_detailsView = 0;
}
m_mode = mode;
createView();
ViewProperties props(m_urlNavigator->url());
props.setViewMode(m_mode);
emit signalModeChanged();
}
示例10: startVisualCapture
// creation of a new capture in GUI mode
void Controller::startVisualCapture(const uint id, const QString &forcedSavePath) {
if (!m_captureWindow) {
QWidget *modalWidget = nullptr;
do {
modalWidget = qApp->activeModalWidget();
if (modalWidget) {
modalWidget->close();
modalWidget->deleteLater();
}
} while (modalWidget);
m_captureWindow = new CaptureWidget(id, forcedSavePath);
//m_captureWindow = new CaptureWidget(id, forcedSavePath, false); // debug
connect(m_captureWindow, &CaptureWidget::captureFailed,
this, &Controller::captureFailed);
connect(m_captureWindow, &CaptureWidget::captureTaken,
this, &Controller::captureTaken);
#ifdef Q_OS_WIN
m_captureWindow->show();
#else
m_captureWindow->showFullScreen();
//m_captureWindow->show(); // Debug
#endif
} else {
emit captureFailed(id);
}
}
示例11: closeWidget
void DSystemFuncs::closeWidget(const QString &widget)
{
QWidget* w = DSystemFuncs::findWidget( widget );
if (w == NULL)
return;
w->close();
}
示例12: fileOpenEvent
bool
QLuaApplication::event(QEvent *e)
{
if (e->type() == QEvent::FileOpen)
{
QString f = static_cast<QFileOpenEvent*>(e)->file();
d->filesToOpen.append(f);
emit fileOpenEvent();
return true;
}
else if (e->type() == QEvent::Close)
{
// carefully close all windows
bool okay = true;
QSet<QWidget*> closed;
QWidgetList wl = topLevelWidgets();
while (okay && wl.size())
{
QWidget *w = wl.takeFirst();
if (w == 0 || !w->isVisible() ||
w->windowType() == Qt::Desktop ||
closed.contains(w) )
continue;
closed += w;
okay = w->close();
wl = topLevelWidgets();
}
// accept event on success
e->setAccepted(okay);
return true;
}
return QApplication::event(e);
}
示例13: deleteLed
void AxisDetailsWidget::deleteLed(LedDetails &details) {
int index = iGridLayout->indexOf(&details.frameList());
int row;
int column;
int rowSpan;
int columnSpan;
iGridLayout->getItemPosition(index, &row, &column, &rowSpan, &columnSpan);
for(int i = 0; i < 3; i++) {
QWidget* widget = iGridLayout->itemAtPosition(row, i)->widget();
widget->close();
iGridLayout->removeWidget(widget);
}
iLedDetails.remove(details.ledNumber());
removeGroup(details.frameList());
update();
if(iLedDetails.count() == 0) {
iCloseAll->setEnabled(false);
iScrollAreaWidgetContents->setShowCurrentFrameLine(false);
}
}
示例14: closeDialog
void DialogController::closeDialog()
{
QWidget *dialog = m_dialog;
m_dialog = nullptr;
m_widget = nullptr;
if(!dialog)
return;
QRect geom = dialog->geometry();
int w = geom.width() + m_dialogOffsetLeft;
QPropertyAnimation *animation = new QPropertyAnimation(dialog, "geometry");
animation->setStartValue(visibleGeometry(dialog));
animation->setEndValue(hiddenGeometry(dialog));
animation->setDuration(300);
animation->setEasingCurve(QEasingCurve::OutExpo);
animation->start();
connect(animation, &QPropertyAnimation::finished, [=]{
animation->deleteLater();
dialog->close();
dialog->deleteLater();
});
emit dialogClosed();
}
示例15: closeEvent
void ReportWriterWindow::closeEvent(QCloseEvent * e) {
QWidgetList wl = ws->windowList();
QWidget * w = 0;
for(w = wl.first(); w; w = wl.next()) {
if(!w->close()) return;
}
e->accept();
}