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));
	}
}
Ejemplo n.º 2
0
//**********************************************************************
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));
    }
  }
}
Ejemplo n.º 3
0
void QStackedWidgetEventFilter::changeOrder()
{
    QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(stackedWidget());

    if (!fw)
        return;

    const QWidgetList oldPages = qdesigner_internal::OrderDialog::pagesOfContainer(fw->core(), stackedWidget());
    const int pageCount = oldPages.size();
    if (pageCount < 2)
        return;

    qdesigner_internal::OrderDialog dlg(fw);
    dlg.setPageList(oldPages);
    if (dlg.exec() == QDialog::Rejected)
        return;

    const QWidgetList newPages = dlg.pageList();
    if (newPages == oldPages)
        return;

    fw->beginCommand(tr("Change Page Order"));
    for(int i=0; i < pageCount; ++i) {
        if (newPages.at(i) == stackedWidget()->widget(i))
            continue;
        qdesigner_internal::MoveStackedWidgetCommand *cmd = new qdesigner_internal::MoveStackedWidgetCommand(fw);
        cmd->init(stackedWidget(), newPages.at(i), i);
        fw->commandHistory()->push(cmd);
    }
    fw->endCommand();
}
Ejemplo n.º 4
0
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 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);
        };
    };
}
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();
	}
    }
}
Ejemplo n.º 7
0
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;
}
Ejemplo n.º 8
0
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();
}
Ejemplo n.º 9
0
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);
	}
}
Ejemplo n.º 10
0
void QWidgetPrivate::raise_sys()
{
    Q_Q(QWidget);
    //@@@ transaction
    if (q->isWindow()) {
        Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
        QWidget::qwsDisplay()->setAltitude(q->internalWinId(),
                                           QWSChangeAltitudeCommand::Raise);
        // XXX: subsurfaces?
#ifdef QT_NO_WINDOWGROUPHINT
#else
        QObjectList childObjects =  q->children();
        if (!childObjects.isEmpty()) {
            QWidgetList toraise;
            for (int i = 0; i < childObjects.size(); ++i) {
                QObject *obj = childObjects.at(i);
                if (obj->isWidgetType()) {
                    QWidget* w = static_cast<QWidget*>(obj);
                    if (w->isWindow())
                        toraise.append(w);
                }
            }

            for (int i = 0; i < toraise.size(); ++i) {
                QWidget *w = toraise.at(i);
                if (w->isVisible())
                    w->raise();
            }
        }
#endif // QT_NO_WINDOWGROUPHINT
    }
}
Ejemplo n.º 11
0
/*! \reimp */
int QAccessibleWidget::childAt(int x, int y) const
{
    QWidget *w = widget();
    if (!w->isVisible())
        return -1;
    QPoint gp = w->mapToGlobal(QPoint(0, 0));
    if (!QRect(gp.x(), gp.y(), w->width(), w->height()).contains(x, y))
        return -1;

    QWidgetList list = childWidgets(w);
    int ccount = childCount();

    // a complex child
    if (list.size() < ccount) {
        for (int i = 1; i <= ccount; ++i) {
            if (rect(i).contains(x, y))
                return i;
        }
        return 0;
    }

    QPoint rp = w->mapFromGlobal(QPoint(x, y));
    for (int i = 0; i<list.size(); ++i) {
        QWidget *child = list.at(i);
        if (!child->isWindow() && !child->isHidden() && child->geometry().contains(rp)) {
            return i + 1;
        }
    }
    return 0;
}
Ejemplo n.º 12
0
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();
	}
}
Ejemplo n.º 13
0
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;
}
Ejemplo n.º 14
0
void WindowMenu::onAboutToShow()
{
   QWidget* win = QApplication::activeWindow();
   pMinimize_->setEnabled(win);
   pZoom_->setEnabled(win && win->maximumSize() != win->minimumSize());
   pBringAllToFront_->setEnabled(win);


   for (int i = windows_.size() - 1; i >= 0; i--)
   {
      QAction* pAction = windows_[i];
      removeAction(pAction);
      windows_.removeAt(i);
      pAction->deleteLater();
   }

   QWidgetList topLevels = QApplication::topLevelWidgets();
   for (int i = 0; i < topLevels.size(); i++)
   {
      QWidget* pWindow = topLevels.at(i);
      if (!pWindow->isVisible())
         continue;

      QAction* pAction = new QAction(pWindow->windowTitle(), pWindow);
      pAction->setData(QVariant::fromValue(pWindow));
      pAction->setCheckable(true);
      if (pWindow->isActiveWindow())
         pAction->setChecked(true);
      insertAction(pWindowPlaceholder_, pAction);
      connect(pAction, SIGNAL(triggered()),
              this, SLOT(showWindow()));

      windows_.append(pAction);
   }
}
Ejemplo n.º 15
0
 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);
 }
Ejemplo n.º 16
0
/*! \reimp */
QAccessibleInterface *QAccessibleWidget::child(int index) const
{
    Q_ASSERT(widget());
    QWidgetList childList = childWidgets(widget());
    if (index >= 0 && index < childList.size())
        return QAccessible::queryAccessibleInterface(childList.at(index));
    return 0;
}
Ejemplo n.º 17
0
void  ActionModel::setItems(QDesignerFormEditorInterface *core, QAction *action,
                            const QIcon &defaultIcon,
                            QStandardItemList &sl)
{

    // Tooltip, mostly for icon view mode
    QString firstTooltip = action->objectName();
    const QString text = action->text();
    if (!text.isEmpty()) {
        firstTooltip += QLatin1Char('\n');
        firstTooltip += text;
    }

    Q_ASSERT(sl.size() == NumColumns);

    QStandardItem *item =  sl[NameColumn];
    item->setText(action->objectName());
    QIcon icon = action->icon();
    if (icon.isNull())
        icon = defaultIcon;
    item->setIcon(icon);
    item->setToolTip(firstTooltip);
    item->setWhatsThis(firstTooltip);
    // Used
    const QWidgetList associatedDesignerWidgets = associatedWidgets(action);
    const bool used = !associatedDesignerWidgets.empty();
    item = sl[UsedColumn];
    item->setCheckState(used ? Qt::Checked : Qt::Unchecked);
    if (used) {
        QString usedToolTip;
        const QString separator = QLatin1String(", ");
        const int count = associatedDesignerWidgets.size();
        for (int i = 0; i < count; i++) {
            if (i)
                usedToolTip += separator;
            usedToolTip += associatedDesignerWidgets.at(i)->objectName();
        }
        item->setToolTip(usedToolTip);
    } else {
        item->setToolTip(QString());
    }
    // text
    item = sl[TextColumn];
    item->setText(action->text());
    item->setToolTip(action->text());
    // shortcut
    const QString shortcut = actionShortCut(core, action).value().toString(QKeySequence::NativeText);
    item = sl[ShortCutColumn];
    item->setText(shortcut);
    item->setToolTip(shortcut);
    // checkable
    sl[CheckedColumn]->setCheckState(action->isCheckable() ?  Qt::Checked : Qt::Unchecked);
    // ToolTip. This might be multi-line, rich text
    QString toolTip = action->toolTip();
    item = sl[ToolTipColumn];
    item->setToolTip(toolTip);
    item->setText(toolTip.replace(QLatin1Char('\n'), QLatin1Char(' ')));
}
void ossimQtMainWindowWorkspace::minimizeAll()
{
    QWidgetList widgetList = windowList();
    
    for(int i = 0; i < (int)widgetList.count(); ++i)
    {
	widgetList.at(i)->showMinimized();
    }
}
Ejemplo n.º 19
0
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) );
    }
}
Ejemplo n.º 20
0
    static QWidget *parentWidget()
    {
        QWidgetList widgets = QApplication::topLevelWidgets();

        if (widgets.count())
            return widgets.at(0);
        else
            return 0;
    }
void ossimQtMainWindowWorkspace::sendEventToAll(QEvent* evt)
{
  QWidgetList widgetList = windowList();
  
  for(int i = 0; i < (int)widgetList.count(); ++i)
    {
      QApplication::sendEvent(widgetList.at(i), evt);
    }
}
Ejemplo n.º 22
0
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 DiffAnalystWindow::onCloseAllWindows()
{
        // Close all open windows
        QWidgetList windows = m_pWs->windowList ();

        for (int i = 0; i < int (windows.count ()); ++i)
        {
                windows.at (i)->close ();
        }
}
Ejemplo n.º 24
0
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();
}
Ejemplo n.º 25
0
void QKeyMapper::changeKeyboard()
{
    instance()->d_func()->clearMappings();

    // inform all toplevel widgets of the change
    QEvent e(QEvent::KeyboardLayoutChange);
    QWidgetList list = QApplication::topLevelWidgets();
    for (int i = 0; i < list.size(); ++i) {
        QWidget *w = list.at(i);
        qt_sendSpontaneousEvent(w, &e);
    }
}
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);
    }
  
}
Ejemplo n.º 27
0
void QEventDispatcherMac::flush()
{
    if(qApp) {
        QWidgetList tlws = QApplication::topLevelWidgets();
        for(int i = 0; i < tlws.size(); i++) {
            QWidget *tlw = tlws.at(i);
            if(tlw->isVisible())
                HIWindowFlush(qt_mac_window_for(tlw));

        }
    }
}
Ejemplo n.º 28
0
// 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;
}
Ejemplo n.º 29
0
static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer)
{
    GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
    g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL);
    QWidgetList widgets = QApplication::allWidgets();
    for (int i = 0; i < widgets.size(); ++i) {
        QWidget *widget = widgets.at(i);
        if (qobject_cast<QToolButton*>(widget)) {
            QEvent event(QEvent::StyleChange);
            QApplication::sendEvent(widget, &event);
        }
    }
}
Ejemplo n.º 30
0
void WidgetOptParameters::actualizeGui()
{

    // list of widgets to hide when problem is solved
    QWidgetList unsolvedWidgets;
    // unsolvedWidgets <<  _ui->pushSelectStartFile;

    // list of widgets to hide when problem is unsolved
    QWidgetList solvedWidgets;


    // if problem is solved
    if(_isResult)
    {
        for(int i=0; i < unsolvedWidgets.size(); i++)
            unsolvedWidgets.at(i)->hide();

        for(int i=0; i < solvedWidgets.size(); i++)
            solvedWidgets.at(i)->show();

        // combo algo
        _ui->comboAlgo->setEnabled(false);

    }
    else
    {
        for(int i=0; i < unsolvedWidgets.size(); i++)
            unsolvedWidgets.at(i)->show();

        for(int i=0; i < solvedWidgets.size(); i++)
            solvedWidgets.at(i)->hide();

        // combo algo
        _ui->comboAlgo->setEnabled(true);

    }
    QString curAlgoName = _problem->algos()->currentAlgoName();
    _ui->comboAlgo->setCurrentIndex(_ui->comboAlgo->findData(curAlgoName));
}