• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ clearFocus函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: clearFocus

//! \brief Clears focus if escape key pressed. Otherwise calls base method.
void PropertyItem::keyPressEvent(QKeyEvent *e)
{
    if(e->key() == Qt::Key_Escape) {
        clearFocus();
        return;
    }
    QVariant oldProperty(component()->property(m_propertyName));
    if(e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
        if(m_edited &&
                component()->setProperty(m_propertyName, QVariant(toPlainText()))) {
            updateGroupGeometry();
            m_edited = false;
            QVariant newProperty(component()->property(m_propertyName));
            PropertiesGroup *parentGroup = static_cast<PropertiesGroup*>(group());
            Q_ASSERT(parentGroup);
            SchematicScene *schScene = parentGroup->schematicScene();
            schScene->undoStack()->push(new PropertyChangeCmd(m_propertyName,
                        newProperty, oldProperty, component()));
        }
        clearFocus();
        return;
    }

    m_edited = true;
    QGraphicsTextItem::keyPressEvent(e);
}
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:27,代码来源:propertyitem.cpp


示例2: lcQColorPickerPopup

void lcQColorPicker::buttonPressed(bool toggled)
{
	if (!toggled)
		return;

	lcQColorPickerPopup *popup = new lcQColorPickerPopup(this, currentColorIndex);
	connect(popup, SIGNAL(changed(int)), SLOT(changed(int)));
	connect(popup, SIGNAL(selected(int)), SLOT(selected(int)));
	connect(popup, SIGNAL(hid()), SLOT(popupClosed()));
	popup->setMinimumSize(300, 200);

	const QRect desktop = QApplication::desktop()->geometry();

	QPoint pos = mapToGlobal(rect().bottomLeft());
	if (pos.x() < desktop.left())
		pos.setX(desktop.left());
	if (pos.y() < desktop.top())
		pos.setY(desktop.top());

	if ((pos.x() + popup->width()) > desktop.width())
		pos.setX(desktop.width() - popup->width());
	if ((pos.y() + popup->height()) > desktop.bottom())
		pos.setY(desktop.bottom() - popup->height());
	popup->move(pos);

	clearFocus();
	update();

	popup->setFocus();
	popup->show();
}
开发者ID:ldraw-linux,项目名称:leocad,代码行数:31,代码来源:lc_qcolorpicker.cpp


示例3: clearFocus

/**This function displays the window after losing the game.
 * @brief Game::lose() creates a panel to obscure the background and places a message on the screen along with quit and retry buttons.
 */
void Game::lose(){
    // play lose music
    lose_music->play();

    // stop game music
    game_music->stop();

    ash_lose = true;
    clearFocus();
    drawPanel(400,0,400,400,QBrush(QImage(":/new/prefix1/sad_pika.png").scaledToWidth(400)), 1);
    QGraphicsTextItem* message= new QGraphicsTextItem("GAME OVER");
    message->setDefaultTextColor(Qt::red);
    message->setFont(QFont("Gill Sans",40));
    message->setPos(500, 75);
    scene->addItem(message);

    QPushButton* quit_button= new QPushButton("Quit");
    quit_button->setGeometry(450, 200, 80, 40);
    scene->addWidget(quit_button);

    QPushButton* retry_button = new QPushButton("Retry");
    retry_button->setGeometry(650,200,80,40);
    scene->addWidget(retry_button);

    QObject::connect(quit_button, SIGNAL(clicked(bool)), this, SLOT(close()));
    QObject::connect(retry_button,SIGNAL(clicked(bool)),this,SLOT(retry()));
}
开发者ID:moeishihara,项目名称:GetPikachu,代码行数:30,代码来源:game.cpp


示例4: qDebug

void Label::setTextInteraction(bool on, bool selectAll)
{
    if(on && textInteractionFlags() == Qt::NoTextInteraction)
       {
           // switch on editor mode:
        qDebug() << textInteractionFlags();
           setTextInteractionFlags(Qt::TextEditorInteraction);
           qDebug() << textInteractionFlags();

           // manually do what a mouse click would do else:
           setFocus(Qt::MouseFocusReason); // this gives the item keyboard focus
           setSelected(true); // this ensures that itemChange() gets called when we click out of the item
           if(selectAll) // option to select the whole text (e.g. after creation of the TextItem)
           {
               QTextCursor c = textCursor();
               c.select(QTextCursor::Document);
               setTextCursor(c);
           }
       }
       else if(!on && textInteractionFlags() == Qt::TextEditorInteraction)
       {
           // turn off editor mode:
           setTextInteractionFlags(Qt::NoTextInteraction);
           // deselect text (else it keeps gray shade):
           QTextCursor c = this->textCursor();
           c.clearSelection();
           this->setTextCursor(c);
           clearFocus();
       }
   }
开发者ID:Ndolam,项目名称:Graphic,代码行数:30,代码来源:label.cpp


示例5: ungrabMouse

void Connection::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    QGraphicsObject::mouseReleaseEvent(event);
    if (drag_state == CONNECTED)
        return;

    ungrabMouse();
    clearFocus();
    setFlag(QGraphicsItem::ItemIsFocusable, false);

    InputPort* target = gscene()->getInputPortAt(endPos());
    Datum* datum = target ? target->getDatum() : NULL;
    if (target && datum->acceptsLink(link))
    {
        datum->addLink(link);
        drag_state = CONNECTED;

        connect(endInspector(), &NodeInspector::moved,
                this, &Connection::onInspectorMoved);
        connect(endInspector(), &NodeInspector::hiddenChanged,
                this, &Connection::onHiddenChanged);

        App::instance()->pushStack(new UndoAddLinkCommand(link));
    }
    else
    {
        link->deleteLater();
    }

    prepareGeometryChange();
}
开发者ID:Highstaker,项目名称:antimony,代码行数:31,代码来源:connection.cpp


示例6: grabKeyboard

void KeyButton::keyPressEvent(QKeyEvent *keyEvent) {
	std::string keyText = QKeyUtil::keyName(keyEvent);
	if (keyEvent->key() == Key_Return) {
	    grabKeyboard();
	    return;
	}
	if (keyEvent->key() == Key_Up ||
	    keyEvent->key() == Key_Down) {
	    clearFocus();
	    releaseKeyboard();
	    return;
	}

	if (!keyText.empty()) {
		myKeyView.myCurrentKey = keyText;
		myKeyView.myLabel->setText("Action For " + QString::fromUtf8(keyText.c_str()));
		myKeyView.myLabel->show();
#if 0
    QSizePolicy pol = myKeyView.myLabel->sizePolicy();
    pol.setHorData(QSizePolicy::Fixed);
    myKeyView.myLabel->setSizePolicy(pol);
    myKeyView.myLabel->setLineWidth(80);
    pol = myKeyView.myComboBox->sizePolicy();
    pol.setHorData(QSizePolicy::Fixed);
    myKeyView.myComboBox->setSizePolicy(pol);
#endif
		myKeyView.myComboBox->setCurrentItem(((ZLKeyOptionEntry*)myKeyView.myOption)->actionIndex(keyText));
		myKeyView.myComboBox->show();
	}
}
开发者ID:xufooo,项目名称:fbreader-e2-test,代码行数:30,代码来源:QOptionView.cpp


示例7: ungrabMouse

void Connection::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
    QGraphicsObject::mouseReleaseEvent(event);
    if (drag_state == CONNECTED)
        return;

    ungrabMouse();
    clearFocus();
    setFlag(QGraphicsItem::ItemIsFocusable, false);

    InputPort* t = gscene()->getInputPortAt(endPos());
    Datum* datum = target ? target->getDatum() : NULL;
    if (t && datum->acceptsLink(source->getDatum()))
    {
        target = t;
        t->install(this);

        datum->installLink(source->getDatum());
        drag_state = CONNECTED;
        App::instance()->pushStack(
                new UndoAddLinkCommand(source->getDatum(), datum));
        onPortsMoved();

        emit(changed());
    }
    else
    {
        deleteLater();
    }

    prepareGeometryChange();
}
开发者ID:CreativeLabs0X3CF,项目名称:antimony,代码行数:32,代码来源:connection.cpp


示例8: returnPressed

void AMGraphicsTextItem::keyPressEvent(QKeyEvent *event){
	if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return){
		emit returnPressed(shapeIndex_);
		clearFocus();
		event->accept();
	}// for no particular reason delete doesn't work, so reimplemented here
	else if(event->key() == Qt::Key_Delete)
	{
		QString docString = toPlainText();
		if(docString.count() > 0)
		{
			int cursorPosition = textCursor().position();
			if(cursorPosition >= 0)
			{
				docString.remove((cursorPosition), 1);
				setPlainText(docString);
				QTextCursor newCursor = textCursor();
				newCursor.setPosition(cursorPosition);
				setTextCursor(newCursor);
			}
		}
	}
	else
		QGraphicsTextItem::keyPressEvent(event);
}
开发者ID:acquaman,项目名称:acquaman,代码行数:25,代码来源:AMGraphicsTextItem.cpp


示例9: switch

void SpellItem::keyPressEvent(QKeyEvent * event)
{
	Spell * spellParent = NULL;
	switch (event->key())
	{
		// Delete : remove that spell
	case Qt::Key::Key_Delete :
		spellParent = spell_->getParent();
		if (spellParent == NULL)
		{
			// Can't remove the top level spell, so just clear it
			cout << "Clearing top level spell" << endl;
			spell_->clear();
		}
		else
		{
			cout << "Removing spell" << endl;
			spellParent->remove(spell_);
		}
		emit(changedSpell());
		break;
	case Qt::Key::Key_Plus:
		// No need for the alternative add
		//if (event->modifiers() & Qt::ShiftModifier)
		spell_->addEmptyChild();
		emit(changedSpell());
		break;
	case Qt::Key::Key_Escape:
		clearFocus();
		break;
	}
}
开发者ID:m-irigoyen,项目名称:rpg-runes,代码行数:32,代码来源:SpellItem.cpp


示例10: mapToGlobal

/*! \internal

  Pops up the color grid, and makes sure the status of
  QtColorPicker's button is right.
*/
void QtColorPicker::buttonPressed(bool toggled)
{
    if (!toggled)
        return;

    const QRect desktop = QApplication::desktop()->geometry();
    // Make sure the popup is inside the desktop.
    QPoint pos = mapToGlobal(rect().bottomLeft());
    if (pos.x() < desktop.left())
        pos.setX(desktop.left());
    if (pos.y() < desktop.top())
        pos.setY(desktop.top());

    if ((pos.x() + popup->sizeHint().width()) > desktop.width())
        pos.setX(desktop.width() - popup->sizeHint().width());
    if ((pos.y() + popup->sizeHint().height()) > desktop.bottom())
        pos.setY(desktop.bottom() - popup->sizeHint().height());
    popup->move(pos);

    if (ColorPickerItem *item = popup->find(col))
        item->setSelected(true);

    // Remove focus from this widget, preventing the focus rect
    // from showing when the popup is shown. Order an update to
    // make sure the focus rect is cleared.
    clearFocus();
    update();

    // Allow keyboard navigation as soon as the popup shows.
    popup->setFocus();

    // Execute the popup. The popup will enter the event loop.
    popup->show();
}
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:39,代码来源:qtcolorpicker.cpp


示例11: clearFocus

void ToolbarSearch::clear()
{
    m_stringListModel->setStringList(QStringList());
    m_autosaver->changeOccurred();
    QLineEdit::clear();
    clearFocus();
}
开发者ID:kingst,项目名称:op2-browser,代码行数:7,代码来源:toolbarsearch.cpp


示例12: toDouble

//! Function to set the selected scale from text
bool QgsScaleComboBox::setScaleString( const QString& scaleTxt )
{
  bool ok;
  double newScale = toDouble( scaleTxt, &ok );
  double oldScale = mScale;
  if ( newScale < mMinScale )
  {
    newScale = mMinScale;
  }
  if ( ! ok )
  {
    return false;
  }
  else
  {
    mScale = newScale;
    setEditText( toString( mScale ) );
    clearFocus();
    if ( mScale != oldScale )
    {
      emit scaleChanged( mScale );
    }
    return true;
  }
}
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:26,代码来源:qgsscalecombobox.cpp


示例13: cursor

void Preview::mouseMoveEvent( QMouseEvent* e )
{
	e;
	QCursor c = cursor();
	QPoint mapFromGlobal = this->mapFromGlobal( c.pos() );
	if ( GetAsyncKeyState( VK_LBUTTON ) < 0 && mapFromGlobal.x() >= 0 && mapFromGlobal.x() <= width() &&
		 mapFromGlobal.y() >= 0 && mapFromGlobal.y() <= height() && MouseInput::globalMouseInput.oldMousePosition != glm::vec2( c.pos().x() , c.pos().y() ) )
	{
		if ( !MouseInput::globalMouseInput.getDeltaTracking() )MouseInput::globalMouseInput.setDeltaTracking( true );
		glm::vec2 oldPos = MouseInput::globalMouseInput.oldMousePosition;
		MouseInput::globalMouseInput.updateMousePosition( glm::vec2( c.pos().x() , c.pos().y() ) );
		
		c.setPos( QPoint( oldPos.x , oldPos.y ) );
		c.setShape( Qt::BlankCursor );
	}
	else if ( MouseInput::globalMouseInput.oldMousePosition != glm::vec2( c.pos().x() , c.pos().y() ) )
	{
		c.setShape( Qt::ArrowCursor );
		if ( MouseInput::globalMouseInput.getDeltaTracking() )MouseInput::globalMouseInput.setDeltaTracking( false );
		MouseInput::globalMouseInput.oldMousePosition = glm::vec2( c.pos().x() , c.pos().y() );
		MouseInput::globalMouseInput.updateMousePosition( glm::vec2( c.pos().x() , c.pos().y() ) );
	}
	clearFocus();
	setCursor( c );
	setFocus();
}
开发者ID:pokelege,项目名称:PokEngine_Source,代码行数:26,代码来源:Preview.cpp


示例14: getFocusedMediaImpl

BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
	LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
	if(media_impl)
	{
		media_impl->handleKeyHere(key, mask);

		if (KEY_ESCAPE == key)
		{
			// Reset camera zoom in this case.
			if(mFocusedImplID.notNull())
			{
				if(mMediaControls.get())
				{
					mMediaControls.get()->resetZoomLevel(true);
				}
			}
			
			clearFocus();
		}
		
		if ( KEY_F1 == key && LLUI::sHelpImpl && mMediaControls.get())
		{
			std::string help_topic;
			if (mMediaControls.get()->findHelpTopic(help_topic))
			{
				LLUI::sHelpImpl->showTopic(help_topic);
			}
		}
	}
	
	return true;
}
开发者ID:kow,项目名称:Astra-Viewer-2,代码行数:33,代码来源:llviewermediafocus.cpp


示例15: clearFocus

void SceneViewWidget::leaveEvent(QEvent* e)
{
	if (isActiveWindow())
	{
		clearFocus();
	}
	emit mouseLeft();
}
开发者ID:BGR360,项目名称:CppGameEngine3D,代码行数:8,代码来源:SceneViewWidget.cpp


示例16: clearFocus

void SpinBox::stepDown()
{
	QSpinBox::stepDown();
	if (_clearFocus)
		clearFocus();
	else
		_clearFocus = true;
}
开发者ID:ViktorNova,项目名称:los,代码行数:8,代码来源:spinbox.cpp


示例17: clear

void FilterWidget::keyPressEvent(QKeyEvent* event)
{
    if (event->key() == Qt::Key_Escape) {
        clear();
        clearFocus();
    }
    QLineEdit::keyPressEvent(event);
}
开发者ID:1h6,项目名称:ProjectTox-Qt-GUI,代码行数:8,代码来源:filterwidget.cpp


示例18: clearFocus

void QKeyButton::click()
{
    if (hasFocus()) {
        clearFocus();
    } else {
        setFocus();
    }
}
开发者ID:BackupTheBerlios,项目名称:sim-im-svn,代码行数:8,代码来源:qkeybutton.cpp


示例19: clearFocus

void GalleryTreeView::slotCheckSelection(const QModelIndex &selected)
{
  clearFocus();
  if (selected.isValid()) {
    emit signalSelected(true);
  } else
    emit signalSelected(false);
}
开发者ID:BackupTheBerlios,项目名称:galerist-svn,代码行数:8,代码来源:gallerytreeview.cpp


示例20: clearFocus

void
ScaleSliderQWidget::leaveEvent(QEvent* e)
{
    if ( hasFocus() ) {
        clearFocus();
    }
    QWidget::leaveEvent(e);
}
开发者ID:haebler,项目名称:Natron,代码行数:8,代码来源:ScaleSliderQWidget.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ clearLCD函数代码示例发布时间:2022-05-30
下一篇:
C++ clearFields函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap