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


C++ QWidget::blockSignals方法代码示例

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


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

示例1: dropEvent

void QtDNDTabBar::dropEvent(QDropEvent* dropEvent) {
	QtDNDTabBar* sourceTabBar = dynamic_cast<QtDNDTabBar*>(dropEvent->source());
	if (sourceTabBar && dropEvent->mimeData() && dropEvent->mimeData()->data("action") == QByteArray("application/tab-detach")) {
		QtDNDTabBar* source = dynamic_cast<QtDNDTabBar*>(dropEvent->source());

		int targetTabIndex = tabAt(dropEvent->pos());
		QRect rect = tabRect(targetTabIndex);
		if (targetTabIndex >= 0 && (dropEvent->pos().x() - rect.left() - rect.width()/2 > 0)) {
			targetTabIndex++;
		}

		QWidget* tab = source->getDragWidget();
		assert(tab);
		QTabWidget* targetTabWidget = dynamic_cast<QTabWidget*>(parentWidget());

		QString tabText = source->getDragText();

		/*
		 * When you add a widget to an empty QTabWidget, it's automatically made the current widget.
		 * Making the widget the current widget, widget->show() is called for the widget. Directly reacting
		 * to that event, and adding the widget again to the QTabWidget results in undefined behavior. For
		 * example the tab label is shown but the widget is neither has the old nor in the new QTabWidget as
		 * parent. Blocking signals on the QWidget to be added to a QTabWidget prevents this behavior.
		 */
		targetTabWidget->setUpdatesEnabled(false);
		tab->blockSignals(true);
		targetTabWidget->insertTab(targetTabIndex, tab, tabText);
		dropEvent->acceptProposedAction();
		tab->blockSignals(false);
		targetTabWidget->setUpdatesEnabled(true);
		onDropSucceeded();
	}
}
开发者ID:scopeInfinity,项目名称:swift,代码行数:33,代码来源:QtDNDTabBar.cpp

示例2: setElement

void InspectorBase::setElement(Element* e)
      {
      for (int i = 0; i < inspectorItems(); ++i) {
            QWidget* w = item(i).w;
            P_ID id    = item(i).t;
            P_TYPE pt  = propertyType(id);
            QVariant val;
            if (pt == T_SIZE || pt == T_SCALE) {
                  QSizeF sz = e->getProperty(id).toSizeF();
                  if (item(i).sv == 0)
                        val = QVariant(sz.width());
                  else
                        val = QVariant(sz.height());
                  }
            else if (pt == T_POINT) {
                  QPointF sz = e->getProperty(id).toPointF();
                  if (item(i).sv == 0)
                        val = QVariant(sz.x());
                  else
                        val = QVariant(sz.y());
                  }
            else
                  val = e->getProperty(id);

            w->blockSignals(true);
            setValue(i, val);
            w->blockSignals(false);

            QToolButton* r = item(i).r;
            if (r)
                  r->setEnabled(!isDefault(i));
            }
      }
开发者ID:parinporecha,项目名称:MuseScore,代码行数:33,代码来源:inspectorBase.cpp

示例3: qMax

void Dataset3D::updateMaskSelect()
{
    QList<Dataset*>dsl1 = Models::getDatasets( Fn::DatasetType::NIFTI_SCALAR, false );

    if( dsl1.size() != m_scalarDSL.size() )
    {
        QWidget* widget = m_properties["maingl"].getWidget( Fn::Property::D_STIPPLE_PROB_MASK );
        widget->blockSignals( true );

        int curScalar = m_properties["maingl"].get( Fn::Property::D_STIPPLE_PROB_MASK ).toInt();

        PropertySelection* prop = static_cast<PropertySelection*> ( m_properties["maingl"].getProperty( Fn::Property::D_STIPPLE_PROB_MASK ) );
        prop->clear();

        for ( int i = 0; i < dsl1.size(); ++i )
        {
            prop->addOption( dsl1[i]->properties().get( Fn::Property::D_NAME ).toString() );
        }

        if ( dsl1.size() > m_scalarDSL.size() )
        {
            m_properties["maingl"].set( Fn::Property::D_STIPPLE_PROB_MASK, qMax( 0, curScalar ) );
        }
        else
        {
            m_properties["maingl"].set( Fn::Property::D_STIPPLE_PROB_MASK, 0 );
        }
        m_scalarDSL.clear();
        for ( int i = 0; i < dsl1.size(); ++i )
        {
            m_scalarDSL.push_back( static_cast<DatasetScalar*>( dsl1[i] ) );
        }
        widget->blockSignals( false );

    }
}
开发者ID:dmastrovito,项目名称:braingl,代码行数:36,代码来源:dataset3d.cpp

示例4: initMetadata

void PEMetadataView::initMetadata(const QDomDocument & doc) 
{
    QWidget * widget = QApplication::focusWidget();
    if (widget) {
        QList<QWidget *> children = m_mainFrame->findChildren<QWidget *>();
        if (children.contains(widget)) {
            widget->blockSignals(true);
        }
    }

    if (m_mainFrame) {
        this->setWidget(NULL);
        delete m_mainFrame;
        m_mainFrame = NULL;
    }

    QDomElement root = doc.documentElement();
    QDomElement label = root.firstChildElement("label");
    QDomElement author = root.firstChildElement("author");
    QDomElement descr = root.firstChildElement("description");
    QDomElement title = root.firstChildElement("title");
    QDomElement date = root.firstChildElement("date");
    QDomElement url = root.firstChildElement("url");

	QStringList readOnlyKeys;
    QHash<QString, QString> tagHash;    
    QDomElement tags = root.firstChildElement("tags");
    QDomElement tag = tags.firstChildElement("tag");
    while (!tag.isNull()) {
        tagHash.insert(tag.text(), "");
        tag = tag.nextSiblingElement("tag");
    }

    QString family;
    QString variant;

    QHash<QString, QString> propertyHash;    
    QDomElement properties = root.firstChildElement("properties");
    QDomElement prop = properties.firstChildElement("property");
    while (!prop.isNull()) {
        QString name = prop.attribute("name");
        QString value = prop.text();
        if (name.compare("family", Qt::CaseInsensitive) == 0) {
            family = value;
        }
        else if (name.compare("variant", Qt::CaseInsensitive) == 0) {
            variant = value;
        }
        else {
            propertyHash.insert(name, value);
        }

        prop = prop.nextSiblingElement("property");
    }


	m_mainFrame = new QFrame(this);
	m_mainFrame->setObjectName("metadataMainFrame");
	QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame);
    mainLayout->setSizeConstraint( QLayout::SetMinAndMaxSize );

    QLabel *explanation = new QLabel(tr("This is where you edit the metadata for the part ..."));
    mainLayout->addWidget(explanation);

    QFormLayout * formLayout = new QFormLayout();
    QFrame * formFrame = new QFrame;
    mainLayout->addWidget(formFrame);

    m_titleEdit = new QLineEdit();
    m_titleEdit->setText(title.text());
	connect(m_titleEdit, SIGNAL(editingFinished()), this, SLOT(titleEntry()));
	m_titleEdit->setObjectName("PartsEditorLineEdit");
    m_titleEdit->setStatusTip(tr("Set the part's title"));
    formLayout->addRow(tr("Title"), m_titleEdit);

    m_dateEdit = new QLineEdit();
    m_dateEdit->setText(date.text());
	connect(m_dateEdit, SIGNAL(editingFinished()), this, SLOT(dateEntry()));
	m_dateEdit->setObjectName("PartsEditorLineEdit");
    m_dateEdit->setStatusTip(tr("Set the part's date"));
    m_dateEdit->setEnabled(false);
    formLayout->addRow(tr("Date"), m_dateEdit);

    m_authorEdit = new QLineEdit();
    m_authorEdit->setText(author.text());
	connect(m_authorEdit, SIGNAL(editingFinished()), this, SLOT(authorEntry()));
	m_authorEdit->setObjectName("PartsEditorLineEdit");
    m_authorEdit->setStatusTip(tr("Set the part's author"));
    formLayout->addRow(tr("Author"), m_authorEdit);

    m_descriptionEdit = new FocusOutTextEdit();
    m_descriptionEdit->setText(descr.text());
	m_descriptionEdit->document()->setModified(false);
	connect(m_descriptionEdit, SIGNAL(focusOut()), this, SLOT(descriptionEntry()));
	m_descriptionEdit->setObjectName("PartsEditorTextEdit");
    m_descriptionEdit->setStatusTip(tr("Set the part's description--you can use simple html (as defined by Qt's Rich Text)"));
    formLayout->addRow(tr("Description"), m_descriptionEdit);

    m_labelEdit = new QLineEdit();
    m_labelEdit->setText(label.text());
//.........这里部分代码省略.........
开发者ID:HyunTaeHwang,项目名称:fritzing-app,代码行数:101,代码来源:pemetadataview.cpp


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