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(); } // --- }
/*! \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; }
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; }
/* 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); }
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; }
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); }
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(); }
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); }
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(); }
// 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); } }
void DSystemFuncs::closeWidget(const QString &widget) { QWidget* w = DSystemFuncs::findWidget( widget ); if (w == NULL) return; w->close(); }
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); }
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); } }
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(); }
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(); }
void DiffAnalystWindow::onFileClose() { QWidget * curWin = m_pWs->activeWindow(); if (curWin) { curWin->close(true); } }
/** * Override the QWidget's close() slot to close the wrapper window as well. */ bool MdiSubWindow::close() { QWidget* pw = getWrapperWindow(); if (!pw) { return MdiSubWindowParent_t::close(); } return pw->close(); }
void QTlenChatContainer::closeAndRemove(int tab) { QWidget *widget = stack->widget(tab); if (widget != 0) { stack->removeWidget(widget); widget->close(); } tabbar->removeTab(tab); }
void TabWidget::closeFloatingPane(){ { QMutexLocker l(&_tabWidgetStateMutex); if (!_isFloating) { return; } } QWidget* p = parentWidget(); p->close(); }
/* This slot closes the window which currently has the focus */ void CMDIWindow::closeActiveWindow() { #ifdef DEBUG qDebug("CMDIWindow::closeActiveWindow()"); #endif QWidget* wnd = (QWidget*)myApp()->workSpace()->activeWindow(); if (wnd) wnd->close(); }
void GridWidget::removeUserWidget(int userid) { userwidgets_t::iterator ite = m_activewidgets.find(userid); if(ite != m_activewidgets.end()) { QWidget* vid = *ite; m_activewidgets.erase(ite); vid->close(); RepositionWidgets(); } }
//---------------------------------------------deInitOutputs void ModuleWidget::deInitOutputs() { tOutputsCollection::iterator it = m_collOutputWidgets.begin(); tOutputsCollection::iterator end = m_collOutputWidgets.end(); for(; it!=end; ++it) { QWidget* pWidget = it->second; pWidget->close(); //m_pUi->m_pOutputsLayout->removeWidget(pWidget); //delete pWidget; } m_collOutputWidgets.clear(); }
void MainWindowPlugin::onOptionsClosed() { QWidget *widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow; Options::node(OPV_MAINWINDOW_SIZE).setValue(widget->size()); Options::node(OPV_MAINWINDOW_POSITION).setValue(widget->pos()); #ifdef Q_WS_WIN if ((QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) && !Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7).value().toBool()) widget->hide(); else #endif widget->close(); FOpenAction->setVisible(false); updateTitle(); }
/* This slot closes ALL windows except for the Console Window */ void CMDIWindow::closeAllWindows() { #ifdef DEBUG qDebug("CMDIWindow::closeAllWindows()"); #endif QWidgetList lst = myApp()->workSpace()->windowList(); QPtrListIterator<QWidget> it(lst); while (it.current()) { QWidget *w = it.current(); ++it; w->close(true); } }
/*! \brief TabWidget::closeTab \param index */ void TabWidget::closeTab(int index) { Q_ASSERT(index < count()); if(index < 0) { index = currentIndex(); } QWidget *widget = this->widget(index); if(widget && widget->close()) { removeTab(index); widget->deleteLater(); } emit tabClosed(index); }
void MainWindowPlugin::onTrayNotifyActivated(int ANotifyId, QSystemTrayIcon::ActivationReason AReason) { if (ANotifyId<0 && AReason==QSystemTrayIcon::DoubleClick) { QWidget * widget = FMainWindowBorder ? (QWidget*)FMainWindowBorder : (QWidget*)FMainWindow; if (FMainWindow->isActive() || qAbs(FActivationChanged.msecsTo(QTime::currentTime()))<qApp->doubleClickInterval()) { #ifdef Q_WS_WIN if ((QSysInfo::windowsVersion() == QSysInfo::WV_WINDOWS7) && !Options::node(OPV_MAINWINDOW_MINIMIZETOTRAY_W7).value().toBool()) widget->hide(); else #endif widget->close(); } else showMainWindow(); } }
logical OFrame :: DA_CancelClose ( ) { QWidget *qparent = WidgetQ() ? WidgetQ()->parentWidget() : NULL; logical term = NO; BEGINSEQ OEHDataWidget::DA_Cancel(); if ( !qparent ) ERROR if ( qparent->inherits("QDialog") ) ((ODialog *)(QDialog *)qparent)->reject(); else qparent->close(); RECOVER term = YES; ENDSEQ return(term); }
/*************************************************************************** Closes given widget on game tab view, returns if succeeded ***************************************************************************/ bool fc_client::slot_close_widget(int index) { bool ret = false; QWidget *w = game_tab_widget->widget(index); /** we wont close map view * even requested, Qt cannot set one of tab widgets * without close button, only all or none */ if (w != game_main_widget) { game_tab_widget->removeTab(index); ret = w->close(); delete w; } else { ret = false; } return ret; }
void Transcribe::errorDetected(const QString& message) { // Pause the audio m_player->togglePlayPause(false); // If we were loaded with a position to restore, invalidate it m_restore_pos = 0; // Close any open modal windows. This is especially useful for an error with // audio loading, in which case the text file dialog is still active. QWidget* modal = QApplication::activeModalWidget(); while (modal != NULL) { modal->close(); modal = QApplication::activeModalWidget(); } // Display the error box QMessageBox box; box.setText(message); box.setStandardButtons(QMessageBox::Ok); box.setIcon(QMessageBox::Critical); box.exec(); }
int runUI(int argc, char *argv[]) { QApplication a(argc,argv); QWidget *window = new QWidget; QPushButton *btn1 = new QPushButton("Hello World"); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(btn1); window->setLayout(layout); window->show(); window->update(); //QTime t; //t.start(); //while(t.elapsed()<1000) // QCoreApplication::processEvents(); window->close(); //return a.exec(); return 0; }