当前位置: 首页>>代码示例>>C++>>正文


C++ QWidgetList类代码示例

本文整理汇总了C++中QWidgetList的典型用法代码示例。如果您正苦于以下问题:C++ QWidgetList类的具体用法?C++ QWidgetList怎么用?C++ QWidgetList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QWidgetList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: widget

/*! \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;
}
开发者ID:Arise,项目名称:Open-DPI-Detector,代码行数:31,代码来源:qaccessiblewidget.cpp

示例2: deleteWidgetList

void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list)
{
    switch (widget_list.size()) {
    case 0:
        break;
    case 1: {
        commandHistory()->beginMacro(tr("Delete '%1'").arg(widget_list.front()->objectName()));
        emit widgetRemoved(widget_list.front());
        DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
        cmd->init(widget_list.front());
        commandHistory()->push(cmd);
        commandHistory()->endMacro();
    }
        break;
    default:
        commandHistory()->beginMacro(tr("Delete"));
        foreach (QWidget *w, widget_list) {
            emit widgetRemoved(w);
            DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this);
            cmd->init(w);
            commandHistory()->push(cmd);
        }
        commandHistory()->endMacro();
        break;
    }
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:25,代码来源:formwindowbase.cpp

示例3: style

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();
	}
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:29,代码来源:pieDialog.cpp

示例4: undo

void InsertPageCommand::undo()
{
    QWidget *page = m_form->objectTree()->lookup(m_name)->widget();
    QWidget *parent = m_form->objectTree()->lookup(m_parentname)->widget();

    QWidgetList list;
    list.append(page);
    KFormDesigner::Command *com = new KFormDesigner::DeleteWidgetCommand(*m_form, list);

    QByteArray classname = parent->metaObject()->className();
    if (classname == "KFDTabWidget") {
        TabWidgetBase *tab = dynamic_cast<TabWidgetBase*>(parent);
        tab->removeTab(tab->indexOf(page));
    } else if (classname == "QStackedWidget" || /* compat */ classname == "QWidgetStack") {
        QStackedWidget *stack = dynamic_cast<QStackedWidget*>(parent);
        int index = stack->indexOf(page);
        if (index > 0)
            index--;
        else if (index < (stack->count()-1))
            index++;
        else
            index = -1;

        if (index >= 0)
            stack->setCurrentIndex(index);
        stack->removeWidget(page);
    }

    com->execute();
    delete com;
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:31,代码来源:containerfactory.cpp

示例5: SLOT

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));
	}
}
开发者ID:concocon,项目名称:CodeAnalyst-3_4_18_0413-Public,代码行数:29,代码来源:DiffAnalystWindow.cpp

示例6: lamexp_broadcast

/*
 * Broadcast event to all windows
 */
bool lamexp_broadcast(int eventType, bool onlyToVisible)
{
	if(QApplication *app = dynamic_cast<QApplication*>(QApplication::instance()))
	{
		qDebug("Broadcasting %d", eventType);
		
		bool allOk = true;
		QEvent poEvent(static_cast<QEvent::Type>(eventType));
		QWidgetList list = app->topLevelWidgets();

		while(!list.isEmpty())
		{
			QWidget *widget = list.takeFirst();
			if(!onlyToVisible || widget->isVisible())
			{
				if(!app->sendEvent(widget, &poEvent))
				{
					allOk = false;
				}
			}
		}

		qDebug("Broadcast %d done (%s)", eventType, (allOk ? "OK" : "Stopped"));
		return allOk;
	}
	else
	{
		qWarning("Broadcast failed, could not get QApplication instance!");
		return false;
	}
}
开发者ID:BackupTheBerlios,项目名称:lamexp,代码行数:34,代码来源:Global_Utils.cpp

示例7: DllCanUnloadNow

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;
}
开发者ID:,项目名称:,代码行数:31,代码来源:

示例8: qtns_shutdown

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;
}
开发者ID:PhobosK,项目名称:plexydesk,代码行数:29,代码来源:qtbrowserplugin_x11.cpp

示例9: SLOT

//**********************************************************************
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));
    }
  }
}
开发者ID:kdbanman,项目名称:browseRDF,代码行数:28,代码来源:TulipApp.cpp

示例10: removeAction

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);
   }
}
开发者ID:Sophrinix,项目名称:rstudio,代码行数:35,代码来源:DesktopMenuCallback.cpp

示例11: accessibleChildren

QWidgetList QAccessibleAbstractScrollArea::accessibleChildren() const
{
    QWidgetList children;

    // Viewport.
    QWidget * viewport = abstractScrollArea()->viewport();
    if (viewport)
        children.append(viewport);

    // Horizontal scrollBar container.
    QScrollBar *horizontalScrollBar = abstractScrollArea()->horizontalScrollBar();
    if (horizontalScrollBar && horizontalScrollBar->isVisible()) {
        children.append(horizontalScrollBar->parentWidget());
    }

    // Vertical scrollBar container.
    QScrollBar *verticalScrollBar = abstractScrollArea()->verticalScrollBar();
    if (verticalScrollBar && verticalScrollBar->isVisible()) {
        children.append(verticalScrollBar->parentWidget());
    }

    // CornerWidget.
    QWidget *cornerWidget = abstractScrollArea()->cornerWidget();
    if (cornerWidget && cornerWidget->isVisible())
        children.append(cornerWidget);

    return children;
}
开发者ID:crobertd,项目名称:qtbase,代码行数:28,代码来源:complexwidgets.cpp

示例12: Q_Q

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
    }
}
开发者ID:Afreeca,项目名称:qt,代码行数:32,代码来源:qwidget_qws.cpp

示例13: slotTriggered

void RemoveStackPageAction::slotTriggered()
{
    if (   !KexiUtils::objectIsA(m_receiver, "QStackedWidget")
        && /* compat */ !KexiUtils::objectIsA(m_receiver, "QWidgetStack"))
    {
        return;
    }
    QStackedWidget *stack = qobject_cast<QStackedWidget*>(m_receiver);
    QWidget *page = stack->currentWidget();

    QWidgetList list;
    list.append(page);
    KFormDesigner::Command *com = new KFormDesigner::DeleteWidgetCommand(*m_container->form(), list);

    // raise prev/next widget
    int index = stack->indexOf(page);
    if (index > 0) {
        index--;
    }
    else if (index < (stack->count()-1)) {
        index++;
    }
    else {
        index = -1;
    }
    if (index >= 0) {
        stack->setCurrentIndex(index);
    }
    stack->removeWidget(page);
    m_container->form()->addCommand(com);
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:31,代码来源:KexiStandardContainerFormWidgets.cpp

示例14: childWidgets

/*! \reimp */
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
    if (!child)
        return -1;
    QWidgetList cl = childWidgets(widget());
    return cl.indexOf(qobject_cast<QWidget *>(child->object()));
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:8,代码来源:qaccessiblewidget.cpp

示例15: findWidgetToWrap

QWidget * KvsObject_wrapper::findTopLevelWidgetToWrap(const QString &szClass,const QString &szName,bool bRecursive)
{
	QWidgetList list = g_pApp->topLevelWidgets();
	if(list.isEmpty())
		return NULL;

	Q_FOREACH(QWidget * w,list)
	{
		//qDebug("TLW: %s::%s (look for %s::%s)",w->metaObject()->className(),w->objectName().toUtf8().data(),szClass.toUtf8().data(),szName.toUtf8().data());
		if(
				(
					szClass.isEmpty() ||
					KviQString::equalCI(w->metaObject()->className(),szClass)
				) && (
					szName.isEmpty() ||
					KviQString::equalCI(w->objectName(),szName)
				)
			)
			return w;
	}

	if(bRecursive)
	{
		Q_FOREACH(QWidget * w,list)
		{
			w = findWidgetToWrap(szClass,szName,w,bRecursive);
			if(w)
				return w;
		}
	}
开发者ID:namikaze90,项目名称:KVIrc-old,代码行数:30,代码来源:KvsObject_wrapper.cpp


注:本文中的QWidgetList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。