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

C++ setSelection函数代码示例

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

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



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

示例1: setText

void UITextEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
    UIWidget::onStyleApply(styleName, styleNode);

    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "text") {
            setText(node->value());
            setCursorPos(m_text.length());
        } else if(node->tag() == "text-hidden")
            setTextHidden(node->value<bool>());
        else if(node->tag() == "shift-navigation")
            setShiftNavigation(node->value<bool>());
        else if(node->tag() == "multiline")
            setMultiline(node->value<bool>());
        else if(node->tag() == "max-length")
            setMaxLength(node->value<int>());
        else if(node->tag() == "editable")
            setEditable(node->value<bool>());
        else if(node->tag() == "selectable")
            setSelectable(node->value<bool>());
        else if(node->tag() == "selection-color")
            setSelectionColor(node->value<Color>());
        else if(node->tag() == "selection-background-color")
            setSelectionBackgroundColor(node->value<Color>());
        else if(node->tag() == "selection") {
            Point selectionRange = node->value<Point>();
            setSelection(selectionRange.x, selectionRange.y);
        }
        else if(node->tag() == "cursor-visible")
            setCursorVisible(node->value<bool>());
        else if(node->tag() == "change-cursor-image")
            setChangeCursorImage(node->value<bool>());
        else if(node->tag() == "auto-scroll")
            setAutoScroll(node->value<bool>());
    }
}
开发者ID:Anastaciaa,项目名称:otclient-1,代码行数:36,代码来源:uitextedit.cpp


示例2: wxGetApp

bool AccDecDlg::initIndex() {
  TraceOp.trc( "accdecdlg", TRCLEVEL_INFO, __LINE__, 9999, "initIndex" );
  iONode model = wxGetApp().getModel();
  if( model != NULL ) {
    iONode declist = wPlan.getdeclist( model );
    if( declist == NULL ) {
      declist = NodeOp.inst(wDecList.name(), model, ELEMENT_NODE);
      NodeOp.addChild(model, declist);
    }
    if( declist != NULL ) {
      fillIndex(declist);

      if( m_Props != NULL ) {
        setIDSelection(wDec.getid( m_Props ));
        return true;
      }
      else {
        m_Props = setSelection(0);
      }

    }
  }
  return false;
}
开发者ID:KlausMerkert,项目名称:FreeRail,代码行数:24,代码来源:accdecdlg.cpp


示例3: GetFileType

//===================>>> vedTextEditor::TextMouseDown <<<====================
  void vedTextEditor::TextMouseDown(int row, int col, int button)
  {
    static int clicks = 0;
    int btn = (GetFileType() == gccError || GetFileType() == bccError)
	 ? 1 : button;

    long oldLine = GetCurLine();		// remember current position
    int oldCol = getColPos();
    
    vTextEditor::TextMouseDown(row, col, btn);	// translate to left

    if (button == 1 && oldLine == GetCurLine() && oldCol == getColPos()) // double click...
      {
	++clicks;
	if (clicks > 3)
	    clicks = 1;
	setSelection(clicks);
      }
    else
      {
	clicks = 0;
      }

  }
开发者ID:OS2World,项目名称:DEV-CPLUSPLUS-UTIL-V_portable_C--_GUI_Framework,代码行数:25,代码来源:videcnv.cpp


示例4: setSelection

void SonicPiScintilla::replaceLine(int lineNumber, QString newLine)
{
  setSelection(lineNumber, 0, lineNumber + 1, 0);
  replaceSelectedText(newLine);
}
开发者ID:Russell-Jones,项目名称:sonic-pi,代码行数:5,代码来源:sonicpiscintilla.cpp


示例5: resetSelection

void UIHexEditorWnd::keyPressSelect(QKeyEvent *event)
{
   if (event->matches(QKeySequence::SelectAll))
   {
      resetSelection(0);
      setSelection(2*endAddress + 1);
   }
   if (event->matches(QKeySequence::SelectNextChar))
   {
      if (cursorY + (fontHeight*2) > viewport()->height() &&
         (cursorAddr + 2) % (bytesPerLine * 2) == 0)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
      s64 pos = (cursorAddr & ~1) + 2;
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousChar))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      s64 pos = (cursorAddr & ~1) - 2;
      setSelection(pos);
      setCursorPos(pos);
   }
   if (event->matches(QKeySequence::SelectEndOfLine))
   {
      s64 pos = (cursorAddr & ~1) - (cursorAddr % (2 * bytesPerLine)) + (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectStartOfLine))
   {
      s64 pos = (cursorAddr & ~1) - (cursorAddr % (2 * bytesPerLine));
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousLine))
   {
      if (cursorAddr <= (s64)verticalScrollBar()->value() * bytesPerLine * 2)
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepSub);
      s64 pos = (cursorAddr & ~1) - (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectNextLine))
   {
      if (cursorY + (fontHeight*2) > viewport()->height())
         verticalScrollBar()->triggerAction(QAbstractSlider::SliderSingleStepAdd);
      s64 pos = (cursorAddr & ~1) + (2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectNextPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
      s64 pos = (cursorAddr & ~1) + (verticalScrollBar()->pageStep() * 2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectPreviousPage))
   {
      verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
      int pos = (cursorAddr & ~1) - (verticalScrollBar()->pageStep() * 2 * bytesPerLine);
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectEndOfDocument))
   {
      int pos = endAddress * 2;
      setCursorPos(pos);
      setSelection(pos);
   }
   if (event->matches(QKeySequence::SelectStartOfDocument))
   {
      int pos = 0;
      setCursorPos(pos);
      setSelection(pos);
   }
}
开发者ID:d356,项目名称:yabause-ci-test,代码行数:79,代码来源:UIHexEditor.cpp


示例6: t2

void LLInventoryPanel::modelChanged(U32 mask)
{
	LLFastTimer t2(LLFastTimer::FTM_REFRESH);

	bool handled = false;
	if(mask & LLInventoryObserver::LABEL)
	{
		handled = true;
		// label change - empty out the display name for each object
		// in this change set.
		const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
		std::set<LLUUID>::const_iterator id_it = changed_items.begin();
		std::set<LLUUID>::const_iterator id_end = changed_items.end();
		LLFolderViewItem* view = NULL;
		LLInvFVBridge* bridge = NULL;
		for (;id_it != id_end; ++id_it)
		{
			view = mFolders->getItemByID(*id_it);
			if(view)
			{
				// request refresh on this item (also flags for filtering)
				bridge = (LLInvFVBridge*)view->getListener();
				if(bridge)
				{	// Clear the display name first, so it gets properly re-built during refresh()
					bridge->clearDisplayName();
				}
				view->refresh();
			}
		}
	}
	if((mask & (LLInventoryObserver::STRUCTURE
				| LLInventoryObserver::ADD
				| LLInventoryObserver::REMOVE)) != 0)
	{
		handled = true;
		// Record which folders are open by uuid.
		LLInventoryModel* model = getModel();
		if (model)
		{
			const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();

			std::set<LLUUID>::const_iterator id_it = changed_items.begin();
			std::set<LLUUID>::const_iterator id_end = changed_items.end();
			for (;id_it != id_end; ++id_it)
			{
				// sync view with model
				LLInventoryObject* model_item = model->getObject(*id_it);
				LLFolderViewItem* view_item = mFolders->getItemByID(*id_it);

				if (model_item)
				{
					if (!view_item)
					{
						// this object was just created, need to build a view for it
						if ((mask & LLInventoryObserver::ADD) != LLInventoryObserver::ADD)
						{
							llwarns << *id_it << " is in model but not in view, but ADD flag not set" << llendl;
						}
						buildNewViews(*id_it);
						
						// select any newly created object
						// that has the auto rename at top of folder
						// root set
						if(mFolders->getRoot()->needsAutoRename())
						{
							setSelection(*id_it, FALSE);
						}
					}
					else
					{
						// this object was probably moved, check its parent
						if ((mask & LLInventoryObserver::STRUCTURE) != LLInventoryObserver::STRUCTURE)
						{
							llwarns << *id_it << " is in model and in view, but STRUCTURE flag not set" << llendl;
						}

						LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
						if (view_item->getParentFolder() != new_parent)
						{
							view_item->getParentFolder()->extractItem(view_item);
							view_item->addToFolder(new_parent, mFolders);
						}
					}
				}
				else
				{
					if (view_item)
					{
						if ((mask & LLInventoryObserver::REMOVE) != LLInventoryObserver::REMOVE)
						{
							llwarns << *id_it << " is not in model but in view, but REMOVE flag not set" << llendl;
						}
						// item in view but not model, need to delete view
						view_item->destroyView();
					}
					else
					{
						llwarns << *id_it << "Item does not exist in either view or model, but notification triggered" << llendl;
					}
				}
//.........这里部分代码省略.........
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:101,代码来源:llinventoryview.cpp


示例7: XY_TO_COORD

void EditInteraction::snapMouseReleaseEvent(QMouseEvent * ev , Feature* aLast)
{
    Qt::KeyboardModifiers modifiers = ev->modifiers();
    if (ev->button() != Qt::LeftButton)
        return;

    if (Dragging)
    {
        QList<Feature*> List;
        EndDrag = XY_TO_COORD(ev->pos());
        CoordBox DragBox(StartDrag, EndDrag);
        for (VisibleFeatureIterator it(document()); !it.isEnd(); ++it) {
            if (it.get()->isReadonly())
                continue;

            if (modifiersForGreedyAdd(modifiers))
            {
                if (!DragBox.intersects(it.get()->boundingBox()))
                    continue;
                if (DragBox.contains(it.get()->boundingBox()))
                    List.push_back(it.get());
                else {
                    Coord A, B;
                    if (Way* R = dynamic_cast<Way*>(it.get())) {
                        for (int j=1; j<R->size(); ++j) {
                            A = R->getNode(j-1)->position();
                            B = R->getNode(j)->position();
                            if (CoordBox::visibleLine(DragBox, A, B)) {
                                List.push_back(R);
                                break;
                            }
                        }
                    } else if (Relation* r = dynamic_cast<Relation*>(it.get())) {
                        for (int k=0; k<r->size(); ++k) {
                            if (Way* R = dynamic_cast<Way*>(r->get(k))) {
                                for (int j=1; j<R->size(); ++j) {
                                    A = R->getNode(j-1)->position();
                                    B = R->getNode(j)->position();
                                    if (CoordBox::visibleLine(DragBox, A, B)) {
                                        List.push_back(r);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            } else {
                if (DragBox.contains(it.get()->boundingBox()))
                    List.push_back(it.get());
            }
        }
        if (!List.isEmpty() || (!modifiersForAdd(modifiers) && !modifiersForToggle(modifiers)))
            PROPERTIES(setSelection(List));
        PROPERTIES(checkMenuStatus());
        Dragging = false;
        view()->update();
    } else {
        if (!panning() && !modifiers) {
            PROPERTIES(setSelection(aLast));
            PROPERTIES(checkMenuStatus());
            view()->update();
        }
    }
}
开发者ID:4x4falcon,项目名称:fosm-merkaartor,代码行数:65,代码来源:EditInteraction.cpp


示例8: setCursorPos

void QHexEditPrivate::keyPressEvent(QKeyEvent *event)
{
    int charX = (_cursorX - _xPosHex) / _charWidth;
    int posX = (charX / 3) * 2 + (charX % 3);
    int posBa = (_cursorY / _charHeight) * BYTES_PER_LINE + posX / 2;


/*****************************************************************************/
/* Cursor movements */
/*****************************************************************************/

    if (event->matches(QKeySequence::MoveToNextChar))
    {
        setCursorPos(_cursorPosition + 1);
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToPreviousChar))
    {
        setCursorPos(_cursorPosition - 1);
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToEndOfLine))
    {
        setCursorPos(_cursorPosition | (2 * BYTES_PER_LINE -1));
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToStartOfLine))
    {
        setCursorPos(_cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE)));
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToPreviousLine))
    {
        setCursorPos(_cursorPosition - (2 * BYTES_PER_LINE));
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToNextLine))
    {
        setCursorPos(_cursorPosition + (2 * BYTES_PER_LINE));
        resetSelection(_cursorPosition);
    }

    if (event->matches(QKeySequence::MoveToNextPage))
    {
        setCursorPos(_cursorPosition + (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE));
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToPreviousPage))
    {
        setCursorPos(_cursorPosition - (((_scrollArea->viewport()->height() / _charHeight) - 1) * 2 * BYTES_PER_LINE));
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToEndOfDocument))
    {
        setCursorPos(_xData.size() * 2);
        resetSelection(_cursorPosition);
    }
    if (event->matches(QKeySequence::MoveToStartOfDocument))
    {
        setCursorPos(0);
        resetSelection(_cursorPosition);
    }

/*****************************************************************************/
/* Select commands */
/*****************************************************************************/
    if (event->matches(QKeySequence::SelectAll))
    {
        resetSelection(0);
        setSelection(2*_xData.size() + 1);
    }
    if (event->matches(QKeySequence::SelectNextChar))
    {
        int pos = _cursorPosition + 1;
        setCursorPos(pos);
        setSelection(pos);
    }
    if (event->matches(QKeySequence::SelectPreviousChar))
    {
        int pos = _cursorPosition - 1;
        setSelection(pos);
        setCursorPos(pos);
    }
    if (event->matches(QKeySequence::SelectEndOfLine))
    {
        int pos = _cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE)) + (2 * BYTES_PER_LINE);
        setCursorPos(pos);
        setSelection(pos);
    }
    if (event->matches(QKeySequence::SelectStartOfLine))
    {
        int pos = _cursorPosition - (_cursorPosition % (2 * BYTES_PER_LINE));
        setCursorPos(pos);
        setSelection(pos);
    }
    if (event->matches(QKeySequence::SelectPreviousLine))
    {
        int pos = _cursorPosition - (2 * BYTES_PER_LINE);
        setCursorPos(pos);
        setSelection(pos);
//.........这里部分代码省略.........
开发者ID:DDuarte,项目名称:IntWars2,代码行数:101,代码来源:qhexedit_p.cpp


示例9: getParentWindow

void MGuiEditText::onEvent(MWinEvent * windowEvent)
{
	MGuiWindow * parent = getParentWindow();

	MMouse * mouse = MMouse::getInstance();

	switch(windowEvent->type)
	{
	case MWIN_EVENT_MOUSE_WHEEL_MOVE:
	case MWIN_EVENT_MOUSE_MOVE:
		if(parent->isHighLight() && isMouseInside())
		{
			setHighLight(true);

			if(m_pointerEvent) // send mouse move gui event
			{
				MGuiEvent guiEvent;

				guiEvent.type = MGUI_EVENT_MOUSE_MOVE;
				guiEvent.data[0] = windowEvent->data[0];
				guiEvent.data[1] = windowEvent->data[1];

				m_pointerEvent(this, &guiEvent);
			}

			// break events
			if(parent->breakEvents())
				return;
		}
		else
		{
			setHighLight(false);
		}

		if(isPressed() && mouse->isLeftButtonPushed())
		{
			m_endSelectionId = getFont()->findPointedCharacter(
				getText(),
				getPosition(),
				getTextSize(),
				getMouseLocalPosition()
			);

			autoScrolling();
		}
		break;
	case MWIN_EVENT_MOUSE_BUTTON_DOWN:
		if(isHighLight())
		{
			if(windowEvent->data[0] == MMOUSE_BUTTON_LEFT)
			{
				// unpress all edit text
				unsigned int i;
				unsigned int size = parent->getEditTextsNumber();
				for(i=0; i<size; i++)
					parent->getEditText(i)->setPressed(false);

				setPressed(true);

				setCharId(
					getFont()->findPointedCharacter(
						getText(),
						getPosition(),
						getTextSize(),
						getMouseLocalPosition()
					)
				);

				// start select
				setSelection(getCharId(), getCharId());
			}

			if(m_pointerEvent) // send mouse button down gui event
			{
				MGuiEvent guiEvent;

				guiEvent.type = MGUI_EVENT_MOUSE_BUTTON_DOWN;
				guiEvent.data[0] = windowEvent->data[0];

				m_pointerEvent(this, &guiEvent);
			}
		}
		else
		{
			if(isPressed() && windowEvent->data[0] == MMOUSE_BUTTON_LEFT)
			{
				setPressed(false);
				sendVariable();
			}
		}
		break;
	case MWIN_EVENT_CHAR:
	case MWIN_EVENT_KEY_DOWN:
		if(isPressed())
		{
			editText(windowEvent);
			autoScrolling();
		}
		break;
	}
//.........这里部分代码省略.........
开发者ID:mconbere,项目名称:Newt,代码行数:101,代码来源:MGuiEditText.cpp


示例10: getSelectionIds

void MGuiEditText::editText(MWinEvent * windowEvent)
{
	unsigned int sStart;
	unsigned int sEnd;

	bool selection = getSelectionIds(&sStart, &sEnd);

	if(selection)
		setCharId(sStart);

	// events
	if(windowEvent->type == MWIN_EVENT_KEY_DOWN)
	{
		switch(windowEvent->data[0])
		{
		case MKEY_UP:
			if(! isSingleLine())
				upCharId(-1);

			setSelection(0, 0);
			return;

		case MKEY_DOWN:
			if(! isSingleLine())
				upCharId(1);

			setSelection(0, 0);
			return;

		case MKEY_RIGHT:
			addCharId();
			setSelection(0, 0);
			return;

		case MKEY_LEFT:
			subCharId();
			setSelection(0, 0);
			return;

		case MKEY_SPACE:
			if(selection)
			{
				m_text.erase(m_text.begin() + sStart, m_text.begin() + sEnd);
				setSelection(0, 0);
			}

			if(! canAddCharacter())
				return;

			m_text.insert(getCharId(), " ", 1);
			addCharId();
			autoScaleFromText();
			onChange();
			return;

		case MKEY_TAB:
			if(! isSingleLine())
			{
				if(selection)
				{
					m_text.erase(m_text.begin() + sStart, m_text.begin() + sEnd);
					setSelection(0, 0);
				}

				if(! canAddCharacter())
					return;

				m_text.insert(getCharId(), "	", 1);
				addCharId();
				autoScaleFromText();
				onChange();
			}
			return;

		case MKEY_BACKSPACE:
			if(selection)
			{
				m_text.erase(m_text.begin() + sStart, m_text.begin() + sEnd);
				setSelection(0, 0);
				autoScaleFromText();
				onChange();
			}
			else if(getCharId() > 0)
			{
				m_text.erase(m_text.begin() + getCharId() - 1);
				subCharId();
				autoScaleFromText();
				onChange();
			}
			return;

		case MKEY_DELETE:
			if(getCharId() < m_text.size())
			{
				if(selection)
				{
					m_text.erase(m_text.begin() + sStart, m_text.begin() + sEnd);
					setSelection(0, 0);
				}
				else
//.........这里部分代码省略.........
开发者ID:mconbere,项目名称:Newt,代码行数:101,代码来源:MGuiEditText.cpp


示例11: setSelection

void MGuiEditText::setPressed(bool pressed)
{
	MGui2d::setPressed(pressed);
	if(! pressed)
		setSelection(0, 0);
}
开发者ID:mconbere,项目名称:Newt,代码行数:6,代码来源:MGuiEditText.cpp


示例12: QWidget

CPUWidget::CPUWidget(QWidget* parent) : QWidget(parent), ui(new Ui::CPUWidget)
{
    ui->setupUi(this);
    setDefaultDisposition();

    mDisas = new CPUDisassembly(0);
    mSideBar = new CPUSideBar(mDisas);
    connect(mDisas, SIGNAL(tableOffsetChanged(int_t)), mSideBar, SLOT(changeTopmostAddress(int_t)));
    connect(mDisas, SIGNAL(viewableRows(int)), mSideBar, SLOT(setViewableRows(int)));
    connect(mDisas, SIGNAL(repainted()), mSideBar, SLOT(repaint()));
    connect(mDisas, SIGNAL(selectionChanged(int_t)), mSideBar, SLOT(setSelection(int_t)));
    connect(Bridge::getBridge(), SIGNAL(dbgStateChanged(DBGSTATE)), mSideBar, SLOT(debugStateChangedSlot(DBGSTATE)));
    connect(Bridge::getBridge(), SIGNAL(updateSideBar()), mSideBar, SLOT(repaint()));

    QSplitter* splitter = new QSplitter(this);
    splitter->addWidget(mSideBar);
    splitter->addWidget(mDisas);
    splitter->setChildrenCollapsible(false);
    splitter->setHandleWidth(1);

    ui->mTopLeftUpperFrameLayout->addWidget(splitter);

    mInfo = new CPUInfoBox();
    ui->mTopLeftLowerFrameLayout->addWidget(mInfo);
    int height = mInfo->getHeight();
    ui->mTopLeftLowerFrame->setMinimumHeight(height + 2);
    ui->mTopLeftLowerFrame->setMaximumHeight(height + 2);

    connect(mDisas, SIGNAL(selectionChanged(int_t)), mInfo, SLOT(disasmSelectionChanged(int_t)));

    mGeneralRegs = new RegistersView(0);
    mGeneralRegs->setFixedWidth(1000);
    mGeneralRegs->setFixedHeight(1400);
    mGeneralRegs->ShowFPU(true);

    QScrollArea* scrollArea = new QScrollArea;
    scrollArea->setWidget(mGeneralRegs);

    scrollArea->horizontalScrollBar()->setStyleSheet("QScrollBar:horizontal{border:1px solid grey;background:#f1f1f1;height:10px}QScrollBar::handle:horizontal{background:#aaa;min-width:20px;margin:1px}QScrollBar::add-line:horizontal,QScrollBar::sub-line:horizontal{width:0;height:0}");
    scrollArea->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{border:1px solid grey;background:#f1f1f1;width:10px}QScrollBar::handle:vertical{background:#aaa;min-height:20px;margin:1px}QScrollBar::add-line:vertical,QScrollBar::sub-line:vertical{width:0;height:0}");

    QPushButton* button_changeview = new QPushButton("");

    mGeneralRegs->SetChangeButton(button_changeview);

    button_changeview->setStyleSheet("Text-align:left;padding: 4px;padding-left: 10px;");
    QFont font = QFont("Lucida Console");
    font.setStyleHint(QFont::Monospace);
    font.setPointSize(8);
    button_changeview->setFont(font);
    connect(button_changeview, SIGNAL(clicked()), mGeneralRegs, SLOT(onChangeFPUViewAction()));

    ui->mTopRightFrameLayout->addWidget(button_changeview);

    ui->mTopRightFrameLayout->addWidget(scrollArea);

    mDump = new CPUDump(mDisas, 0); //dump widget
    ui->mBotLeftFrameLayout->addWidget(mDump);

    mStack = new CPUStack(0); //stack widget
    ui->mBotRightFrameLayout->addWidget(mStack);
}
开发者ID:SamirMahmudzade,项目名称:x64dbg,代码行数:62,代码来源:CPUWidget.cpp


示例13: setSelection

void ZealSearchEdit::selectQuery()
{
    setSelection(queryStart(), text().size());
}
开发者ID:MichaelBeeu,项目名称:zeal,代码行数:4,代码来源:zealsearchedit.cpp


示例14: selection

void McaEditorReferenceArea::sl_selectionChanged(const MaEditorSelection &current, const MaEditorSelection &) {
    U2Region selection(current.x(), current.width());
    setSelection(selection);
}
开发者ID:ggrekhov,项目名称:ugene,代码行数:4,代码来源:McaEditorReferenceArea.cpp


示例15: setSelection

void QMultiLineEdit::insertAt( const QString &s, int line, int col, bool mark )
{
    QTextEdit::insertAt( s, line, col );
    if ( mark )
	setSelection( line, col, line, col + s.length() );
}
开发者ID:AliYousuf,项目名称:abanq-port,代码行数:6,代码来源:qmultilineedit.cpp


示例16: setSelection

void QcWaveform::mouseDoubleClickEvent ( QMouseEvent * )
{
  setSelection( _curSel, _rangeBeg, _rangeEnd );
  Q_EMIT( action() );
}
开发者ID:acamari,项目名称:supercollider,代码行数:5,代码来源:view.cpp


示例17: setSelection

void AMScanThumbnailGridView::onSelectionRectangleEnded(const QRect& selectionRectangle, QItemSelectionModel::SelectionFlags flags)
{
    setSelection(selectionRectangle, flags);
    rubberBand_->setVisible(false);
}
开发者ID:acquaman,项目名称:acquaman,代码行数:5,代码来源:AMScanThumbnailGridView.cpp


示例18: SetTitle

void VariableDlg::initIndex() {
  SetTitle(wxGetApp().getMsg( "variable" ));

  m_VarList->DeleteAllItems();

  iONode model = wxGetApp().getModel();
  if( model != NULL ) {
    iONode varlist = wPlan.getvrlist( model );
    if( varlist != NULL ) {
      iOList list = ListOp.inst();
      int cnt = NodeOp.getChildCnt( varlist );
      for( int i = 0; i < cnt; i++ ) {
        iONode var = NodeOp.getChild( varlist, i );
        const char* id = wVariable.getid( var );
        if( id != NULL ) {
          ListOp.add(list, (obj)var);
        }
      }

      if( m_SortCol == 1 )
        ListOp.sort(list, &__sortGroup);
      else if( m_SortCol == 2 )
        ListOp.sort(list, &__sortValue);
      else if( m_SortCol == 3 )
        ListOp.sort(list, &__sortText);
      else
        ListOp.sort(list, &__sortID);

      cnt = ListOp.size( list );
      for( int i = 0; i < cnt; i++ ) {
        iONode var = (iONode)ListOp.get( list, i );
        m_VarList->InsertItem( i, wxString( wVariable.getid( var ), wxConvUTF8) );
        m_VarList->SetItem( i, 1, wxString( wVariable.getgroup( var ), wxConvUTF8) );
        m_VarList->SetItem( i, 2, wxString::Format(wxT("%d"), wVariable.getvalue( var )) );
        m_VarList->SetItem( i, 3, wxString( wVariable.gettext( var ), wxConvUTF8) );
        m_VarList->SetItemPtrData(i, (wxUIntPtr)var);
      }

      // resize
      for( int n = 0; n < 4; n++ ) {
        m_VarList->SetColumnWidth(n, wxLIST_AUTOSIZE_USEHEADER);
        int autoheadersize = m_VarList->GetColumnWidth(n);
        m_VarList->SetColumnWidth(n, wxLIST_AUTOSIZE);
        int autosize = m_VarList->GetColumnWidth(n);
        if(autoheadersize > autosize )
          m_VarList->SetColumnWidth(n, wxLIST_AUTOSIZE_USEHEADER);
        else if( autosize > 120 )
          m_VarList->SetColumnWidth(n, autoheadersize > 120 ? autoheadersize:120);
      }

      /* clean up the temp. list */
      ListOp.base.del(list);

      if( m_Props != NULL ) {
        char* title = StrOp.fmt( "%s %s", (const char*)wxGetApp().getMsg("variable").mb_str(wxConvUTF8), wVariable.getid( m_Props ) );
        SetTitle( wxString(title,wxConvUTF8) );
        StrOp.free( title );

        setSelection(wVariable.getid( m_Props ));

      }
      else if(m_VarList->GetItemCount() > 0 ) {
        m_VarList->SetItemState(0, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
        m_Props = (iONode)m_VarList->GetItemData(0);

      }

    }
  }

}
开发者ID:TomTheGeek,项目名称:Rocrail,代码行数:71,代码来源:variabledlg.cpp


示例19: text


//.........这里部分代码省略.........
    if (powerOfTen - llpowerOfTen > 16) {
        // too many digits to handle, don't do anything

        // (may overflow when adjusting llval)
        return;
    }

    double inc = inc_int * std::pow(10., (double)powerOfTen);

    // Check that we are within the authorized range
    double maxiD, miniD;
    switch (_imp->type) {
    case eSpinBoxTypeInt:
        maxiD = _imp->maxi.toInt();
        miniD = _imp->mini.toInt();
        break;
    case eSpinBoxTypeDouble:
    default:
        maxiD = _imp->maxi.toDouble();
        miniD = _imp->mini.toDouble();
        break;
    }
    val += inc;
    if ( (val < miniD) || (maxiD < val) ) {
        // out of the authorized range, don't do anything
        return;
    }

    // Adjust llval so that the increment becomes an int, and avoid rounding errors
    if (powerOfTen >= llpowerOfTen) {
        llval += inc_int * std::pow(10., powerOfTen - llpowerOfTen);
    } else {
        llval *= std::pow(10., llpowerOfTen - powerOfTen);
        llpowerOfTen -= llpowerOfTen - powerOfTen;
        llval += inc_int;
    }
    // check that val and llval*10^llPowerOfTen are still close enough (relative error should be less than 1e-8)
    assert(std::abs(val * std::pow(10., -llpowerOfTen) - llval) / std::max( qlonglong(1), std::abs(llval) ) < 1e-8);

    QString newStr;
    newStr.setNum(llval);
    bool newStrHasSign = newStr[0] == QLatin1Char('+') || newStr[0] == QLatin1Char('-');
    // the position of the decimal dot
    int newDot = newStr.size() + llpowerOfTen;
    // add leading zeroes if newDot is not a valid position (beware of sign!)
    while ( newDot <= int(newStrHasSign) ) {
        newStr.insert( int(newStrHasSign), QLatin1Char('0') );
        ++newDot;
    }
    assert( 0 <= newDot && newDot <= newStr.size() );
    assert( newDot == newStr.size() || newStr[newDot].isDigit() );
    if ( newDot != newStr.size() ) {
        assert(_imp->type == eSpinBoxTypeDouble);
        newStr.insert( newDot, QLatin1Char('.') );
    }
    // Check that the backed string is close to the wanted value (relative error should be less than 1e-8)
    assert( (newStr.toDouble() - val) / std::max( 1e-8, std::abs(val) ) < 1e-8 );
    // The new cursor position
    int newPos = newDot + (pos - dot);
    // Remove the shift (may have to be done twice due to the dot)
    newPos += shift;
    if (newPos == newDot) {
        // adjust newPos
        newPos += shift;
    }

    assert( 0 <= newDot && newDot <= newStr.size() );

    // Now, add leading and trailing zeroes so that newPos is a valid digit position
    // (beware of the sign!)
    // Trailing zeroes:
    while ( newPos >= newStr.size() ) {
        assert(_imp->type == eSpinBoxTypeDouble);
        // Add trailing zero, maybe preceded by a dot
        if (newPos == newDot) {
            newStr.append( QLatin1Char('.') );
        } else {
            assert(newPos > newDot);
            newStr.append( QLatin1Char('0') );
        }
        assert( newPos >= (newStr.size() - 1) );
    }
    // Leading zeroes:
    bool newHasSign = ( newStr[0] == QLatin1Char('-') || newStr[0] == QLatin1Char('+') );
    while ( newPos < 0 || ( newPos == 0 && ( newStr[0] == QLatin1Char('-') || newStr[0] == QLatin1Char('+') ) ) ) {
        // add leading zero
        newStr.insert( newHasSign ? 1 : 0, QLatin1Char('0') );
        ++newPos;
        ++newDot;
    }
    assert( 0 <= newPos && newPos < newStr.size() && newStr[newPos].isDigit() );

    // Set the text and cursor position
    //qDebug() << "increment setting text to " << newStr;
    setText(newStr, newPos);
    // Set the selection
    assert( newPos + 1 <= newStr.size() );
    setSelection(newPos + 1, -1);
    Q_EMIT valueChanged( value() );
} // increment
开发者ID:MrKepzie,项目名称:Natron,代码行数:101,代码来源:SpinBox.cpp


示例20: FTM_REFRESH


//.........这里部分代码省略.........
			if (model_item && view_item)
			{
				view_item->destroyView();
			}
			view_item = buildNewViews(item_id);
			view_folder = dynamic_cast<LLFolderViewFolder *>(view_item);
		}

		//////////////////////////////
		// INTERNAL Operation
		// This could be anything.  For now, just refresh the item.
		if (mask & LLInventoryObserver::INTERNAL)
		{
			if (view_item)
			{
				view_item->refresh();
			}
		}

		//////////////////////////////
		// SORT Operation
		// Sort the folder.
		if (mask & LLInventoryObserver::SORT)
		{
			if (view_folder)
			{
				view_folder->requestSort();
			}
		}	

		// We don't typically care which of these masks the item is actually flagged with, since the masks
		// may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
		// Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
		// panel).  What's relevant is that the item and UI are probably out of sync and thus need to be
		// resynchronized.
		if (mask & (LLInventoryObserver::STRUCTURE |
					LLInventoryObserver::ADD |
					LLInventoryObserver::REMOVE))
		{
			//////////////////////////////
			// ADD Operation
			// Item exists in memory but a UI element hasn't been created for it.
			if (model_item && !view_item)
			{
				// Add the UI element for this item.
				buildNewViews(item_id);
				// Select any newly created object that has the auto rename at top of folder root set.
				if(mFolderRoot.get()->getRoot()->needsAutoRename())
				{
					setSelection(item_id, FALSE);
				}
			}

			//////////////////////////////
			// STRUCTURE Operation
			// This item already exists in both memory and UI.  It was probably reparented.
			else if (model_item && view_item)
			{
				// Don't process the item if it is the root
				if (view_item->getRoot() != view_item)
				{
					LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolderRoot.get()->getItemByID(model_item->getParentUUID());
					// Item has been moved.
					if (view_item->getParentFolder() != new_parent)
					{
						if (new_parent != NULL)
						{
							// Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
							view_item->getParentFolder()->extractItem(view_item);
							view_item->addToFolder(new_parent, mFolderRoot.get());
							if (mInventory)
							{
								const LLUUID trash_id = mInventory->findCategoryUUIDForType(LLFolderType::FT_TRASH);
								if (trash_id != model_item->getParentUUID() && (mask & LLInventoryObserver::INTERNAL) && new_parent->isOpen())
								{
									setSelection(item_id, FALSE);
								}
							}
						}
						else
						{
							// Item is to be moved outside the panel's directory (e.g. moved to trash for a panel that
							// doesn't include trash).  Just remove the item's UI.
							view_item->destroyView();
						}
					}
				}
			}

			//////////////////////////////
			// REMOVE Operation
			// This item has been removed from memory, but its associated UI element still exists.
			else if (!model_item && view_item)
			{
				// Remove the item's UI.
				view_item->destroyView();
			}
		}
	}
}
开发者ID:sines,项目名称:SingularityViewer,代码行数:101,代码来源:llinventorypanel.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setSelectionBehavior函数代码示例发布时间:2022-05-30
下一篇:
C++ setScriptReturn函数代码示例发布时间: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