STDAPI DllCanUnloadNow() { if (GetCurrentThreadId() != qAxThreadId) return S_FALSE; if (qAxLockCount()) return S_FALSE; if (!qax_ownQApp) return S_OK; // check if qApp still runs widgets (in other DLLs) QWidgetList widgets = qApp->allWidgets(); int count = widgets.count(); for (int w = 0; w < widgets.count(); ++w) { // remove all Qt generated widgets QWidget *widget = widgets.at(w); if (widget->windowType() == Qt::Desktop || widget->objectName() == QLatin1String("Qt internal tablet widget")) count--; } if (count) return S_FALSE; // no widgets left - destroy qApp if (qax_hhook) UnhookWindowsHookEx(qax_hhook); delete qApp; qax_ownQApp = false; // never allow unloading - safety net for Internet Explorer return S_FALSE; }
extern "C" void qtns_shutdown() { if (clients.count() > 0) { QMap<QtNPInstance *, QX11EmbedWidget *>::iterator it = clients.begin(); while (it != clients.end()) { delete it.value(); ++it; } clients.clear(); } if (!ownsqapp) return; // check if qApp still runs widgets (in other DLLs) QWidgetList widgets = qApp->allWidgets(); int count = widgets.count(); for (int w = 0; w < widgets.count(); ++w) { // ignore all Qt generated widgets QWidget *widget = widgets.at(w); if (widget->windowFlags() & Qt::Desktop) count--; } if (count) // qApp still used return; delete qApp; ownsqapp = false; }
void pieDialog::pickBorderColor() { QColor c = QColorDialog::getColor(boxBorderColor->color(), this); if ( !c.isValid() || c == boxBorderColor->color() ) return; boxBorderColor->setColor ( c ) ; if (boxAll->isChecked()) { QWidgetList* allPlots = mPlot->graphPtrs(); for (int i=0; i<(int)allPlots->count();i++) { Graph* g=(Graph*)allPlots->at(i); if (g) g->drawBorder(boxBorderWidth->value(), c); } } else { Graph* g = (Graph*)mPlot->activeGraph(); if (g) g->drawBorder(boxBorderWidth->value(), c); } }
//********************************************************************** void TulipApp::windowsMenuAboutToShow() { windowsMenu->clear(); if(tabWidget->currentIndex()==-1) return; QWorkspace *currentWorkspace=controllerToWorkspace[tabIndexToController[tabWidget->currentIndex()]]; QAction* cascadeAction = windowsMenu->addAction("&Cascade", this, SLOT(cascade() ) ); QAction* tileAction = windowsMenu->addAction("&Tile", currentWorkspace, SLOT(tile() ) ); QAction* closeallAction = windowsMenu->addAction("Close All", this, SLOT(closeAll())); if ( currentWorkspace->windowList().isEmpty() ) { cascadeAction->setEnabled(false); tileAction->setEnabled(false); closeallAction->setEnabled(false); } else { windowsMenu->addSeparator(); QWidgetList windows = currentWorkspace->windowList(); for ( int i = 0; i < int(windows.count()); ++i ) { QAction* action = windowsMenu->addAction(windows.at(i)->windowTitle()); action->setChecked(currentWorkspace->activeWindow() == windows.at(i)); action->setData(QVariant(i)); } } }
void pieDialog::updatePlot() { if (generalDialog->currentPage()==(QWidget *)pieOptions) { QPen pen=QPen(boxLineColor->color(),boxLineWidth->value(), style()); emit updatePie(pen, pattern(), boxRay->value(), boxFirstColor->currentItem()); } if (generalDialog->currentPage()==(QWidget*)frame) { if (!boxAll->isChecked()) return; QColor c = boxBackgroundColor->color(); QWidgetList* allPlots = mPlot->graphPtrs(); for (int i=0; i<(int)allPlots->count();i++) { Graph* g=(Graph*)allPlots->at(i); if (g) { g->drawBorder(boxBorderWidth->value(), boxBorderColor->color()); g->changeMargin(boxMargin->value()); g->setBackgroundColor(c); } } if (c == QColor(white) && mPlot->hasOverlapingLayers()) mPlot->updateTransparency(); } }
void DiffAnalystWindow::onWindowsMenuAboutToShow() { m_pWindowsMenu->clear (); int cascadeId = m_pWindowsMenu->insertItem ("&Cascade", this, SLOT (onCascade ())); int tileId = m_pWindowsMenu->insertItem ("&Tile", this, SLOT (onTile ())); int close_all_id = m_pWindowsMenu->insertItem ("Close Al&l", this, SLOT (onCloseAllWindows ())); if (m_pWs->windowList ().isEmpty ()) { m_pWindowsMenu->setItemEnabled (cascadeId, FALSE); m_pWindowsMenu->setItemEnabled (tileId, FALSE); m_pWindowsMenu->setItemEnabled (close_all_id, FALSE); } m_pWindowsMenu->insertSeparator (); QWidgetList windows = m_pWs->windowList (); for (int i = 0; i < int (windows.count ()); ++i) { int id = m_pWindowsMenu->insertItem (windows.at (i)->caption (), this, SLOT (onWindowsMenuActivated (int))); m_pWindowsMenu->setItemParameter (id, i); m_pWindowsMenu->setItemChecked (id, m_pWs->activeWindow () == windows.at (i)); } }
void pieDialog::pickBackgroundColor() { QColor c = QColorDialog::getColor(boxBackgroundColor->color(), this); if ( !c.isValid() || c == boxBackgroundColor->color() ) return; boxBackgroundColor->setColor ( c ) ; if (boxAll->isChecked()) { QWidgetList* allPlots = mPlot->graphPtrs(); for (int i=0; i<(int)allPlots->count();i++) { Graph* g=(Graph*)allPlots->at(i); if (g) g->setBackgroundColor(c); } } else { Graph* g = (Graph*)mPlot->activeGraph(); if (g) g->setBackgroundColor(c); } if (c == QColor(white) && mPlot->hasOverlapingLayers()) mPlot->updateTransparency(); }
void ReportWriterWindow::sPrepareWindowMenu() { windowMenu->clear(); int intCascadeid = windowMenu->insertItem(tr("&Cascade"), ws, SLOT(cascade())); int intTileid = windowMenu->insertItem(tr("&Tile"), ws, SLOT(tile())); windowMenu->insertSeparator(); int cnt = 0; QWidgetList windows = ws->windowList(); for (unsigned int intCursor = 0; intCursor < windows.count(); intCursor++) { if(windows.at(intCursor)->isVisible()) { int intMenuid = windowMenu->insertItem(windows.at(intCursor)->caption(), windows.at(intCursor), SLOT(setFocus())); windowMenu->setItemChecked(intMenuid, (ws->activeWindow() == windows.at(intCursor))); cnt++; } } if (cnt < 1) { windowMenu->setItemEnabled(intCascadeid, FALSE); windowMenu->setItemEnabled(intTileid, FALSE); } }
void closeEvent(QCloseEvent *evt){ QWidgetList windows = ws->windowList(); for (int i = 0; i < int(windows.count()); ++i) { GLWidget *window = (GLWidget *)windows.at(i); window->stopRendering(); } QMainWindow::closeEvent(evt); }
QWidget* tomahawkWindow() { QWidgetList widgetList = qApp->topLevelWidgets(); int i = 0; while( i < widgetList.count() && widgetList.at( i )->objectName() != "TH_Main_Window" ) i++; if ( i == widgetList.count() ) { qDebug() << Q_FUNC_INFO << "could not find main Tomahawk mainwindow"; Q_ASSERT( false ); return 0; } QWidget *widget = widgetList.at( i ); return widget; }
void ossimQtMainWindowWorkspace::sendEventToAll(QEvent* evt) { QWidgetList widgetList = windowList(); for(int i = 0; i < (int)widgetList.count(); ++i) { QApplication::sendEvent(widgetList.at(i), evt); } }
void ossimQtMainWindowWorkspace::minimizeAll() { QWidgetList widgetList = windowList(); for(int i = 0; i < (int)widgetList.count(); ++i) { widgetList.at(i)->showMinimized(); } }
static QWidget *parentWidget() { QWidgetList widgets = QApplication::topLevelWidgets(); if (widgets.count()) return widgets.at(0); else return 0; }
/*! \reimp */ QAccessible::Role QAccessibleWidget::role(int child) const { if (!child) return d->role; QWidgetList childList = childWidgets(widget()); if (childList.count() > 0 && child <= childList.count()) { QWidget *targetWidget = childList.at(child - 1); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(targetWidget); if (iface) { QAccessible::Role role = iface->role(0); delete iface; return role; } } return NoRole; }
void DiffAnalystWindow::onCloseAllWindows() { // Close all open windows QWidgetList windows = m_pWs->windowList (); for (int i = 0; i < int (windows.count ()); ++i) { windows.at (i)->close (); } }
/** * @brief 빈 메인윈도우를 지운다. */ void CWindowManager::removeEmptyWindow() { QWidgetList list = qApp->topLevelWidgets(); for(int i = 0; i < list.count(); i++) { MainWindow* item = static_cast<MainWindow*>(list[i]); if(item->m_tabwidget->count() == 0) { item->setAttribute(Qt::WA_DeleteOnClose, true); item->close(); } } }
void KApplication::applyPalette(const QPalette &pal) { setPalette(pal); QWidgetList list = allWidgets (); for (int i = 0; i < list.count(); i++) { QObject *o = list[i]; if (o) static_cast<QWidget*>(o)->setPalette(pal); } }
void OrderDialog::setPageList(const QWidgetList &pages) { // The QWidget* are stored in a map indexed by the old index. // The old index is set as user data on the item instead of the QWidget* // because DnD is enabled which requires the user data to serializable m_orderMap.clear(); const int count = pages.count(); for (int i=0; i < count; ++i) m_orderMap.insert(i, pages.at(i)); buildList(); }
void ossimQtMainWindowWorkspace::refreshAll() { QWidgetList widgetList = windowList(); for(int i = 0; i < (int)widgetList.count(); ++i) { ossimQtRefreshDisplayEvent* evt = new ossimQtRefreshDisplayEvent; QApplication::postEvent(widgetList.at(i), evt); } }
// all toplevel widgets except popups and the desktop static QWidgetList topLevelWidgets() { QWidgetList list; const QWidgetList tlw(qApp->topLevelWidgets()); for (int i = 0; i < tlw.count(); ++i) { QWidget *w = tlw.at(i); if (!(w->windowType() == Qt::Popup) && !(w->windowType() == Qt::Desktop)) list.append(w); } return list; }
void ossimQtMainWindowWorkspace::restoreAll() { QWidgetList widgetList = windowList(); for(int i = 0; i < (int)widgetList.count(); ++i) { if((!widgetList.at(i)->isShown())|| (widgetList.at(i)->isMinimized())) { widgetList.at(i)->showNormal(); } } }
void processByWeatherWidget::openDateWidget(QModelIndex index){ QWidgetList widgets = qApp->allWidgets(); MainWindow *mainwidget; for(int i = 0; i < widgets.count(); i++){ if(dynamic_cast<MainWindow*>(widgets.at(i)) != NULL){ //qDebug() << "eureka"; mainwidget = static_cast<MainWindow*>(widgets.at(i)); QDateTime *param = new QDateTime(QDateTime::fromString(index.data().toString(), "yyyy-MM-dd hh:mm:ss")); weatherDisplayWidget *form = new weatherDisplayWidget(param); mainwidget->showForm(form); }; }; }
/* This reimplemented method confirms if the user wants to exit from the application or not */ void CMDIWindow::closeEvent(QCloseEvent * e) { #ifdef DEBUG qDebug("CMDIWindow::closeEvent()"); #endif if (myApp()->confirmCritical() && !myApp()->checkCritical()) if ((QMessageBox::information(0, tr("Confirm Exit"), tr("Are you sure you want to Exit ?"), tr("&Yes"), tr("&No")) != 0)) { e->ignore(); return; } beforeClose(); QWidgetList openWindows = myApp()->workSpace()->windowList(); if (openWindows.count() > 0) for ( int i = 0; i < int(openWindows.count()); ++i) ((CMyWindow *)openWindows.at(i))->beforeClose(); emit about_to_close(); e->accept(); }
QWidget *KvsObject_wrapper::findTopLevelWidgetToWrap(const QString szClass, const QString szName) { QWidgetList list = g_pApp->topLevelWidgets(); if( !list.count() ) return 0; for(int idx=0;idx<list.count();idx++) { bool bNameMatch = false; bool bClassMatch = false; if( !szName.isEmpty() ) bNameMatch = KviQString::equalCI(list.at(idx)->objectName(), szName); else bNameMatch = true; if( !szClass.isEmpty()) bClassMatch = KviQString::equalCI(list.at(idx)->metaObject()->className(), szClass); else bClassMatch = true; if( bNameMatch && bClassMatch ) { QWidget *w = list.at(idx); return w; } } return 0; }
/* The "Window" menu item is created dynamically; This slot creates the menu items for the Window menu before it's shown. */ void CMDIWindow::windowMenuAboutToShow() { #ifdef DEBUG qDebug("CMDIWindow::windowMenuAboutToShow()"); #endif windowMenu->clear(); int consoleWindowId = windowMenu->insertItem(consoleWindow->caption(), this, SLOT(consoleWindowDisplay())); windowMenu->setItemParameter(consoleWindowId, 0); windowMenu->setItemChecked(consoleWindowId, !consoleWindow->isHidden()); windowMenu->insertSeparator(); int closeId = windowMenu->insertItem(getPixmapIcon("closeIcon"), tr("Cl&ose"), this, SLOT(closeActiveWindow())); int closeAllId = windowMenu->insertItem(getPixmapIcon("closeAllIcon"), tr("Close Al&l"), this, SLOT(closeAllWindows())); windowMenu->insertSeparator(); int cascadeId = windowMenu->insertItem(getPixmapIcon("cascadeIcon"), tr("&Cascade"), CApplication::Application()->workSpace(), SLOT(cascade())); int tileId = windowMenu->insertItem(getPixmapIcon("tileIcon"), tr("&Tile"), CApplication::Application()->workSpace(), SLOT(tile())); QWidgetList openWindows = CApplication::Application()->workSpace()->windowList(); if ( ((openWindows.count() <= 1) || (CApplication::Application()->workSpace()->windowList().isEmpty())) && (consoleWindow->isHidden())) { windowMenu->setItemEnabled( closeId, false); windowMenu->setItemEnabled( closeAllId, false); windowMenu->setItemEnabled( cascadeId, false); windowMenu->setItemEnabled( tileId, false); } else if (openWindows.count() > 1) windowMenu->insertSeparator(); for ( int i = 1; i < int(openWindows.count()); ++i ) { int id = windowMenu->insertItem(openWindows.at(i)->caption(), this, SLOT(windowActivated(int))); windowMenu->setItemParameter(id, i); windowMenu->setItemChecked(id, CApplication::Application()->workSpace()->activeWindow() == openWindows.at(i)); } }
void tst_QFontDialog::postKeyReturn() { #ifndef Q_WS_MAC QWidgetList list = QApplication::topLevelWidgets(); for (int i=0; i<list.count(); ++i) { QFontDialog *dialog = qobject_cast<QFontDialog*>(list[i]); if (dialog) { QTest::keyClick( list[i], Qt::Key_Return, Qt::NoModifier ); return; } } #else extern void click_cocoa_button(); click_cocoa_button(); #endif }
void ApplicationWindow::windowsMenuAboutToShow() { windowsMenu->clear(); int cascadeId = windowsMenu->insertItem("&Cascade", ws, SLOT(cascade() ) ); int tileId = windowsMenu->insertItem("&Tile", ws, SLOT(tile() ) ); if ( ws->windowList().isEmpty() ) { windowsMenu->setItemEnabled( cascadeId, FALSE ); windowsMenu->setItemEnabled( tileId, FALSE ); } windowsMenu->insertSeparator(); QWidgetList windows = ws->windowList(); for ( int i = 0; i < int(windows.count()); ++i ) { int id = windowsMenu->insertItem(windows.at(i)->caption(), this, SLOT( windowsMenuActivated( int ) ) ); windowsMenu->setItemParameter( id, i ); windowsMenu->setItemChecked( id, ws->activeWindow() == windows.at(i) ); } }
void MultiLayer::copy(ApplicationWindow *parent, MultiLayer *ml) { hide(); // FIXME: find a better way to avoid a resize event resize(ml->size()); setSpacing(ml->rowsSpacing(), ml->colsSpacing()); setAlignement(ml->horizontalAlignement(), ml->verticalAlignement()); setMargins(ml->leftMargin(), ml->rightMargin(), ml->topMargin(), ml->bottomMargin()); QWidgetList graphsList = ml->graphPtrs(); for (int i = 0; i < graphsList.count(); i++) { Graph *g = (Graph *)graphsList.at(i); Graph *g2 = addLayer(g->pos().x(), g->pos().y(), g->width(), g->height()); g2->copy(parent, g); g2->setIgnoreResizeEvents(g->ignoresResizeEvents()); g2->setAutoscaleFonts(g->autoscaleFonts()); } show(); }
// // File -> Exit or Window destroyed // void App::closeEvent(QCloseEvent* e) { QLCFixtureEditor* editor = NULL; e->accept(); QWidgetList wl = workspace()->windowList(); for (unsigned int i = 0; i < wl.count(); i++) { editor = static_cast<QLCFixtureEditor*> (wl.at(i)); assert(editor); editor->show(); editor->setFocus(); if ( !editor->close() ) { e->ignore(); } } }
void pieDialog::changeMargin(int width) { if (generalDialog->currentPage() != frame) return; if (boxAll->isChecked()) { QWidgetList* allPlots = mPlot->graphPtrs(); for (int i=0; i<(int)allPlots->count();i++) { Graph* g=(Graph*)allPlots->at(i); if (g) g->changeMargin(width); } } else { Graph* g = (Graph*)mPlot->activeGraph(); if (g) g->changeMargin(width); } }