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


C++ QObject::isWidgetType方法代码示例

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


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

示例1: pChild

/*override*/ bool FileRenamerDlgImpl::eventFilter(QObject* pObj, QEvent* pEvent)
{
//qDebug("ev %d", int(pEvent->type()));
    if (QEvent::ChildAdded == pEvent->type())
    {
        //qDebug("add");
        QObject* pChild (((QChildEvent*)pEvent)->child());
        if (pChild->isWidgetType())
        {
            CB_ASSERT (0 == m_pEditor);
            m_pEditor = pChild;
        }
    }
    else if (QEvent::ChildRemoved == pEvent->type())
    {
        //qDebug("rm");
        QObject* pChild (((QChildEvent*)pEvent)->child());
        if (pChild->isWidgetType())
        {
            CB_ASSERT (pChild == m_pEditor);
            m_pEditor = 0;
        }
    }
    return QDialog::eventFilter(pObj, pEvent);
}
开发者ID:miracle2k,项目名称:mp3diags,代码行数:25,代码来源:FileRenamerDlgImpl.cpp

示例2: allocatedRegion

QRegion QWidget::allocatedRegion() const
{
    if (isVisible()) {
	if ( isTopLevel() ) {
	    return alloc_region;
	} else {
	    if ( isAllocatedRegionDirty() ) {
		const QObjectList *c;
		QRegion r( req_region );
		r &= parentWidget()->allocatedRegion();
		parentWidget()->updateOverlappingChildren();
		if ( parentWidget()->overlapping_children ) {
		    c = parentWidget()->children();
		    if ( c ) {
			QObjectListIt it(*c);
			QObject* ch;
			bool clip=FALSE;
			while ((ch=it.current())) {
			    ++it;
			    if ( ch->isWidgetType() ) {
				QWidget *w = (QWidget*)ch;
				if ( w == this )
				    clip=TRUE;
				else if ( clip && !w->isTopLevel() && w->isVisible() ) {
				    if ( w->geometry().intersects( geometry() ) )
					r -= w->req_region;
				}
			    }
			}
		    }
		}

		// if I'm dirty, so are my chlidren.
		c = children();
		if ( c ) {
		    QObjectListIt it(*c);
		    QObject* ch;
		    while ((ch=it.current())) {
			++it;
			if ( ch->isWidgetType() && !((QWidget*)ch)->isTopLevel() ) {
			    ((QWidget *)ch)->alloc_region_dirty = TRUE;
			}
		    }
		}

		alloc_region = r;
		alloc_region_dirty = FALSE;
		paintable_region_dirty = TRUE;
	    }
	    return alloc_region;
	}
    } else {
	return QRegion();
    }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:55,代码来源:qwidget_qws.cpp

示例3: indexesToObjects

void ObjectInspector::ObjectInspectorPrivate::synchronizeSelection(const QItemSelection & selectedSelection, const QItemSelection &deselectedSelection)
{
    // Synchronize form window cursor.
    const QObjectVector deselected = indexesToObjects(m_model, deselectedSelection.indexes());
    const QObjectVector newlySelected = indexesToObjects(m_model, selectedSelection.indexes());

    const QModelIndexList currentSelectedIndexes = m_treeView->selectionModel()->selectedRows(0);

    int deselectedManagedWidgetCount = 0;
    if (!deselected.empty())
        deselectedManagedWidgetCount = selectInCursor(m_formWindow, deselected, false);

    if (newlySelected.empty()) { // Nothing selected
        if (currentSelectedIndexes.empty()) // Do not allow a null-selection, reset to main container
            m_formWindow->clearSelection(!m_withinClearSelection);
        return;
    }

    const int selectManagedWidgetCount = selectInCursor(m_formWindow, newlySelected, true);
    // Check consistency: Make sure either  managed widgets or  unmanaged objects are selected.
    // No newly-selected managed widgets: Unless there are ones in the (old) current selection,
    // select the unmanaged object
    if (selectManagedWidgetCount == 0) {
        if (checkManagedWidgetSelection(currentSelectedIndexes)) {
            // Managed selection exists, refuse and update if necessary
            if (deselectedManagedWidgetCount != 0 || selectManagedWidgetCount != 0)
                m_formWindow->emitSelectionChanged();
            return;
        }
        // And now for the unmanaged selection
        m_formWindow->clearSelection(false);
        QObject *unmanagedObject = newlySelected.front();
        m_core->propertyEditor()->setObject(unmanagedObject);
        m_core->propertyEditor()->setEnabled(true);
        // open container page if it is a single widget
        if (newlySelected.size() == 1 && unmanagedObject->isWidgetType())
            showContainersCurrentPage(static_cast<QWidget*>(unmanagedObject));
        return;
    }
    // Open container page if it is a single widget
    if (newlySelected.size() == 1) {
        QObject *object = newlySelected.back();
        if (object->isWidgetType())
            showContainersCurrentPage(static_cast<QWidget*>(object));
    }

    // A managed widget was newly selected. Make sure  there are no unmanaged objects
    // in the whole unless just single selection
    if (currentSelectedIndexes.size() > selectManagedWidgetCount)
        checkManagedWidgetSelection(currentSelectedIndexes);
    // Update form
    if (deselectedManagedWidgetCount != 0 || selectManagedWidgetCount != 0)
        m_formWindow->emitSelectionChanged();
}
开发者ID:Fale,项目名称:qtmoko,代码行数:54,代码来源:objectinspector.cpp

示例4: calcIndicatorPos

QPoint QDesignerToolBar::calcIndicatorPos( const QPoint &pos )
{
    if ( orientation() == Horizontal ) {
	QPoint pnt( width() - 2, 0 );
	insertAnchor = 0;
	afterAnchor = TRUE;
	if ( !children() )
	    return pnt;
	pnt = QPoint( 13, 0 );
	QObjectListIt it( *children() );
	QObject * obj;
	while( (obj=it.current()) != 0 ) {
	    ++it;
	    if ( obj->isWidgetType() &&
		 qstrcmp( "qt_dockwidget_internal", obj->name() ) != 0 ) {
		QWidget *w = (QWidget*)obj;
		if ( w->x() < pos.x() ) {
		    pnt.setX( w->x() + w->width() + 1 );
		    insertAnchor = w;
		    afterAnchor = TRUE;
		}
	    }
	}
	return pnt;
    } else {
	QPoint pnt( 0, height() - 2 );
	insertAnchor = 0;
	afterAnchor = TRUE;
	if ( !children() )
	    return pnt;
	pnt = QPoint( 0, 13 );
	QObjectListIt it( *children() );
	QObject * obj;
	while( (obj=it.current()) != 0 ) {
	    ++it;
	    if ( obj->isWidgetType() &&
		 qstrcmp( "qt_dockwidget_internal", obj->name() ) != 0 ) {
		QWidget *w = (QWidget*)obj;
		if ( w->y() < pos.y() ) {
		    pnt.setY( w->y() + w->height() + 1 );
		    insertAnchor = w;
		    afterAnchor = TRUE;
		}
	    }
	}
	return pnt;
    }
}
开发者ID:app,项目名称:ananas-labs,代码行数:48,代码来源:actiondnd.cpp

示例5: show

/*!
    \reimp
*/
void QWidgetStack::show()
{
    //  Reimplemented in order to set the children's geometries
    //  appropriately and to pick the first widget as topWidget if no
    //  topwidget was defined
    if ( !isVisible() && children() ) {
	const QObjectList * c = children();
	QObjectListIt it( *c );
	QObject * o;

	while( (o=it.current()) != 0 ) {
	    ++it;
	    if ( o->isWidgetType() ) {
		if ( !topWidget && o != invisible )
		    topWidget = (QWidget*)o;
		if ( o == topWidget )
		    ((QWidget *)o)->show();
		else
		    ((QWidget *)o)->hide();
	    }
	}
	setChildGeometries();
    }
    QFrame::show();
}
开发者ID:aroraujjwal,项目名称:qt3,代码行数:28,代码来源:qwidgetstack.cpp

示例6: smartSpacing

int FlowLayout::smartSpacing(QStyle::PixelMetric t_pm) const {
    if ((t_pm == QStyle::PM_LayoutHorizontalSpacing) &&
            (m_item_list.count() > 0) && (this->geometry().width() > 0)) {
        qreal refWidth = 40. / 2736.;
        QRect rect = qApp->primaryScreen()->geometry();
        int newWidth = static_cast<int>(rect.width() * refWidth + 1);

        auto width = this->geometry().width() - newWidth;
        auto single_width = m_item_list.first()->widget()->width();
        if (single_width == 0) return 0;
        int items_per_row = width / single_width;
        if (items_per_row == 0) items_per_row = 1;

        auto extra_space = width - single_width * items_per_row;

        if (items_per_row == 1) return extra_space;

        return extra_space / (items_per_row - 1) - 1;
    }

    QObject *parent = this->parent();

    if (!parent) {
        return -1;
    } else if (parent->isWidgetType()) {
        QWidget *pw = static_cast<QWidget *>(parent);
        return pw->style()->pixelMetric(t_pm, 0, pw);
    } else {
        return static_cast<QLayout *>(parent)->spacing();
    }
}
开发者ID:NotLemon,项目名称:Shinjiru,代码行数:31,代码来源:flowlayout.cpp

示例7: getSelection

void QDesignerIntegrationPrivate::getSelection(Selection &s)
{
    QDesignerFormEditorInterface *core = q->core();
    // Get multiselection from object inspector
    if (QDesignerObjectInspector *designerObjectInspector = qobject_cast<QDesignerObjectInspector *>(core->objectInspector())) {
        designerObjectInspector->getSelection(s);
        // Action editor puts actions that are not on the form yet
        // into the property editor only.
        if (s.empty())
            if (QObject *object = core->propertyEditor()->object())
                s.objects.push_back(object);

    } else {
        // Just in case someone plugs in an old-style object inspector: Emulate selection
        s.clear();
        QDesignerFormWindowInterface *formWindow = core->formWindowManager()->activeFormWindow();
        if (!formWindow)
            return;

        QObject *object = core->propertyEditor()->object();
        if (object->isWidgetType()) {
            QWidget *widget = static_cast<QWidget*>(object);
            QDesignerFormWindowCursorInterface *cursor = formWindow->cursor();
            if (cursor->isWidgetSelected(widget)) {
                s.managed.push_back(widget);
            } else {
                s.unmanaged.push_back(widget);
            }
        } else {
            s.objects.push_back(object);
        }
    }
}
开发者ID:2gis,项目名称:2gisqt5android,代码行数:33,代码来源:abstractintegration.cpp

示例8: isEnabled

void
CQGroupBox::
updateEnabled()
{
  bool enabled = isEnabled();

  QObjectList childList = children();

  for (int i = 0; i < childList.size(); ++i) {
    QObject *o = childList.at(i);

    if (! o->isWidgetType()) continue;

    QWidget *w = static_cast<QWidget *>(o);

    if (isCheckable()) {
      if (isChecked()) {
//      if (! w->isEnabled()) {
//        if (! w->testAttribute(Qt::WA_ForceDisabled))
            w->setEnabled(true);
//      }
      }
      else {
//      if (w->isEnabled())
          w->setEnabled(false);
      }
    }
    else {
      w->setEnabled(enabled);
    }
  }
}
开发者ID:colinw7,项目名称:CQGroupBox,代码行数:32,代码来源:CQGroupBox.cpp

示例9: paint_children

static void paint_children(QWidget * p,const QRegion& r, bool post)
{
    if(!p)
	return;
    QObjectList * childObjects=(QObjectList*)p->children();
    if(childObjects) {
	QObject * o;
	for(o=childObjects->first();o!=0;o=childObjects->next()) {
	    if( o->isWidgetType() ) {
		QWidget *w = (QWidget *)o;
		if ( w->testWState(Qt::WState_Visible) ) {
		    QRegion wr( QRegion(w->geometry()) & r );
		    if ( !wr.isEmpty() ) {
			wr.translate(-w->x(),-w->y());
			if ( post )
			    QApplication::postEvent(w,new QPaintEvent(wr,
				   !w->testWFlags(QWidget::WRepaintNoErase) ) );
			else
			    w->repaint(wr, !w->testWFlags(QWidget::WRepaintNoErase));
			paint_children(w,wr,post);
		    }
		}
	    }
	}
    }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:26,代码来源:qwidget_qws.cpp

示例10: updateRequestedRegion

void QWidget::updateRequestedRegion( const QPoint &gpos )
{
    if ( !isTopLevel() ) {
	if ( !testWState( WState_Visible ) || testWState(WState_ForceHide) ) {
	    req_region = QRegion();
	} else {
	    req_region = QRect(gpos,crect.size());
	    if ( extra && !extra->mask.isNull() ) {
		QRegion maskr = extra->mask;
		maskr.translate( gpos.x(), gpos.y() );
		req_region &= maskr;
	    }
	    req_region = qt_screen->mapToDevice( req_region, QSize(qt_screen->width(), qt_screen->height()) );
	}
    }
    const QObjectList *c = children();
    if ( c ) {
	QObjectListIt it(*c);
	QObject* ch;
	while ((ch=it.current())) {
	    ++it;
	    if ( ch->isWidgetType() && !((QWidget*)ch)->isTopLevel() ) {
		QWidget *w = (QWidget *)ch;
		w->updateRequestedRegion( gpos + w->pos() );
	    }
	}
    }
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:28,代码来源:qwidget_qws.cpp

示例11: updateOverlappingChildren

void QWidget::updateOverlappingChildren() const
{
    if ( overlapping_children != -1 || isSettingGeometry )
	return;

    QRegion r;
    const QObjectList *c = children();
    if ( c ) {
	QObjectListIt it(*c);
	QObject* ch;
	while ((ch=it.current())) {
	    ++it;
	    if ( ch->isWidgetType() && !((QWidget*)ch)->isTopLevel() ) {
		QWidget *w = (QWidget *)ch;
		if ( w->isVisible() ) {
		    QRegion rr( w->req_region );
		    QRegion ir = r & rr;
		    if ( !ir.isEmpty() ) {
			overlapping_children = 1;
			return;
		    }
		    r |= rr;
		}
	    }
	}
    }
    overlapping_children = 0;
}
开发者ID:Miguel-J,项目名称:eneboo-core,代码行数:28,代码来源:qwidget_qws.cpp

示例12: it

static QWidget * find_child( QWidget * tlw, QPoint & p )
{
    QWidget * w = tlw;

    p = w->mapFromGlobal( p );
    bool done = FALSE;
    while ( !done ) {
	done = TRUE;
	if ( w->children() ) {
	    QObjectListIt it( *w->children() );
	    it.toLast();
	    QObject * o;
	    while( (o=it.current()) ) {
		--it;
		if ( o->isWidgetType() &&
		     ((QWidget*)o)->isVisible() &&
		     ((QWidget*)o)->geometry().contains( p ) ) {
		    w = (QWidget *)o;
		    done = FALSE;
		    p = w->mapFromParent( p );
		    break;
		}
	    }
	}
    }
    return w;
}
开发者ID:kthxbyte,项目名称:Qt1.45-Linaro,代码行数:27,代码来源:qdnd_x11.cpp

示例13: createWidgetsContainer

void SkinStyle::createWidgetsContainer(QWidget * widget, const QString & objectName) {
    QWidget * container = new QWidget(widget->parentWidget());
    container->setObjectName(objectName);

    QHBoxLayout * layout = new QHBoxLayout();
    container->setLayout(layout);

    QObjectList objects = widget->children();
    for (int i = 0; i < objects.size(); i++) {
        QObject * object = objects.at(i);

        if (object->isWidgetType()) {
            if (!object->inherits("QToolBarHandle") && !object->inherits("QToolBarExtension")) {
                QWidget * w = qobject_cast < QWidget * > (object);
                addWidgetToLayout(w, layout);
                w->show();
            }
        }

        else if (object->inherits("QAction")) {
            QAction * a = qobject_cast < QAction * > (object);
            QWidget * w = new QWidget(container);
            w->addAction(a);
            addWidgetToLayout(w, layout);
        }

        else if (object->inherits("QLayout")) {
            QLayout * l = qobject_cast < QLayout * > (object);
            layout->addLayout(l);
        }
    }

    container->show();
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例14: it

static QWidget * find_child( QWidget * tlw, QPoint & p )
{
    QWidget * w = tlw;

    p = w->mapFromGlobal( p );
    bool done = FALSE;
    while ( !done ) {
	done = TRUE;
	if ( ((QExtraWidget*)w)->extraData() &&
	     ((QExtraWidget*)w)->extraData()->xDndProxy != 0 )
	    break; // stop searching for widgets under the mouse cursor if found widget is a proxy.
	if ( w->children() ) {
	    QObjectListIt it( *w->children() );
	    it.toLast();
	    QObject * o;
	    while( (o=it.current()) ) {
		--it;
		if ( o->isWidgetType() &&
		     ((QWidget*)o)->isVisible() &&
		     ((QWidget*)o)->geometry().contains( p ) &&
		     !((QWidget*)o)->isTopLevel()) {
		    w = (QWidget *)o;
		    done = FALSE;
		    p = w->mapFromParent( p );
		    break;
		}
	    }
	}
    }
    return w;
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:31,代码来源:qdnd_x11.cpp

示例15: expand

//-----------------------------------------------------------------------------
void ctkCollapsibleGroupBox::expand(bool _expand)
{
  if (!_expand)
    {
    this->OldSize = this->size();
    }

  QObjectList childList = this->children();
  for (int i = 0; i < childList.size(); ++i) 
    {
    QObject *o = childList.at(i);
    if (o && o->isWidgetType()) 
      {
      QWidget *w = static_cast<QWidget *>(o);
      if ( w )
        {
        w->setVisible(_expand);
        }
      }
    }
  
  if (_expand)
    {
    this->setMaximumHeight(this->MaxHeight);
    this->resize(this->OldSize);
    }
  else
    {
    this->MaxHeight = this->maximumHeight();
    this->setMaximumHeight(22);
    }
}
开发者ID:benoitbleuze,项目名称:CTK,代码行数:33,代码来源:ctkCollapsibleGroupBox.cpp


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