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


C++ setTextInteractionFlags函数代码示例

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


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

示例1: setTextInteractionFlags

void ItemLabel::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
	QTextCursor myCursor = this->textCursor();
	if (textInteractionFlags() == Qt::NoTextInteraction)
	{
		//QPoint p = this->textCursor()->pos();
		setTextInteractionFlags(Qt::TextEditorInteraction);//|Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse|Qt::TextEditable);
		setTextInteractionFlags(Qt::TextEditable);	
		
		//myCursor->setCursorMoveStyle;
	    //cursor.movePosition(QTextCursor::Start);

		//setTextInteractionFlags(Qt::TextEditable);	
		//this->cursor().setS
		//QTextCursor tt = ;  
		//this->setMQt::LogicalMoveStyle.
		//this->textCursor()->setTabChangesFocus(true);
		//this->cursor().setCursorMoveStyle();
		//this->textCursor().setPos(p);				
	}
	/*myCursor.setKeepPositionOnInsert(true);	
	bool flag = myCursor.keepPositionOnInsert();
	bool mflag = myCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 1);*/
	QGraphicsTextItem::mouseDoubleClickEvent(event);
	//myCursor.setPosition(10, QTextCursor::MoveAnchor);
	return;
}
开发者ID:umbcdavincilab,项目名称:pathBubbles,代码行数:27,代码来源:ItemLabel.cpp

示例2: 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

示例3: parentItem

void ElementTitle::startTextInteraction()
{
	parentItem()->setSelected(true);

	// Already interacting?
	if (hasFocus())
		return;

	mOldText = toPlainText();

	// Clear scene selection
	//if (!(event->modifiers() & Qt::ControlModifier)) - was here.
	scene()->clearSelection();

	if (mReadOnly)
		setTextInteractionFlags(Qt::TextBrowserInteraction);
	else
		setTextInteractionFlags(Qt::TextEditorInteraction);
	setFocus(Qt::OtherFocusReason);

	// Set full text selection
	QTextCursor cursor = QTextCursor(document());
	cursor.select(QTextCursor::Document);
	setTextCursor(cursor);
	setCursor(Qt::IBeamCursor);
}
开发者ID:ArtemKopylov,项目名称:qreal,代码行数:26,代码来源:elementTitle.cpp

示例4: setTextInteractionFlags

QVariant UBGraphicsTextItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
    if (QGraphicsItem::ItemSelectedChange == change)
    {
        bool selected = value.toBool();

        if (selected)
        {
            setTextInteractionFlags(Qt::TextEditorInteraction);
        }
        else
        {
            QTextCursor tc = textCursor();
            tc.clearSelection();
            setTextCursor(tc);
            setTextInteractionFlags(Qt::NoTextInteraction);
        }
    }

    QVariant newValue = value;

    if(mDelegate)
        newValue = mDelegate->itemChange(change, value);

    return QGraphicsTextItem::itemChange(change, newValue);
}
开发者ID:coachal,项目名称:Sankore-3.1,代码行数:26,代码来源:UBGraphicsTextItem.cpp

示例5: setTextInteractionFlags

void
FormText::enableEditing( bool on )
{
	if( on )
		setTextInteractionFlags( Qt::TextEditorInteraction );
	else
		setTextInteractionFlags( Qt::NoTextInteraction );
}
开发者ID:igormironchik,项目名称:prototyper,代码行数:8,代码来源:form_text.cpp

示例6: flags

void TupTextItem::setEditable(bool editable)
{
    m_isEditable = editable;
    
    if (editable) {
        m_flags = flags(); // save flags
        setTextInteractionFlags(Qt::TextEditorInteraction);
        setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsFocusable);
        setFocus(Qt::MouseFocusReason);
    } else {
        setTextInteractionFlags(Qt::TextBrowserInteraction);
        setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable); // restore flags
    }
    update();
}
开发者ID:nanox,项目名称:tupi,代码行数:15,代码来源:tuptextitem.cpp

示例7: setTextInteractionFlags

void GraphNodeText::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
    if(textInteractionFlags() == Qt::NoTextInteraction)
        setTextInteractionFlags(Qt::TextEditable | Qt::TextSelectableByKeyboard);

    QGraphicsTextItem::mouseDoubleClickEvent(event);
}
开发者ID:pinkeen,项目名称:qcoverage,代码行数:7,代码来源:graphnodetext.cpp

示例8: QLabel

ItemData::ItemData(const QModelIndex &index, int maxBytes, QWidget *parent)
    : QLabel(parent)
    , ItemWidget(this)
{
    setTextInteractionFlags(Qt::TextSelectableByMouse);
    setContentsMargins(4, 4, 4, 4);
    setTextFormat(Qt::RichText);

    QString text;

    const QStringList formats = index.data(contentType::formats).toStringList();
    for (int i = 0; i < formats.size(); ++i ) {
        QByteArray data = index.data(contentType::firstFormat + i).toByteArray();
        const int size = data.size();
        bool trimmed = size > maxBytes;
        if (trimmed)
            data = data.left(maxBytes);

        const QString &format = formats[i];
        bool hasText = format.startsWith("text/") ||
                       format.startsWith("application/x-copyq-owner-window-title");
        const QString content = hasText ? escapeHtml(stringFromBytes(data, format)) : hexData(data);
        text.append( QString("<p>") );
        text.append( QString("<b>%1</b> (%2 bytes)<pre>%3</pre>")
                     .arg(format)
                     .arg(size)
                     .arg(content) );
        text.append( QString("</p>") );

        if (trimmed)
            text.append( QString("<p>...</p>") );
    }

    setText(text);
}
开发者ID:yarod39,项目名称:CopyQ,代码行数:35,代码来源:itemdata.cpp

示例9: QTextEdit

VBoxDbgConsoleOutput::VBoxDbgConsoleOutput(QWidget *pParent/* = NULL*/, const char *pszName/* = NULL*/)
    : QTextEdit(pParent), m_uCurLine(0), m_uCurPos(0), m_hGUIThread(RTThreadNativeSelf())
{
    setReadOnly(true);
    setUndoRedoEnabled(false);
    setOverwriteMode(false);
    setPlainText("");
    setTextInteractionFlags(Qt::TextBrowserInteraction);
    setAutoFormatting(QTextEdit::AutoAll);
    setTabChangesFocus(true);
    setAcceptRichText(false);

    /*
     * Font.
     * Create actions for font menu items.
     */
    m_pCourierFontAction = new QAction(tr("Courier"), this);
    m_pCourierFontAction->setCheckable(true);
    m_pCourierFontAction->setShortcut(Qt::ControlModifier + Qt::Key_D);
    connect(m_pCourierFontAction, SIGNAL(triggered()), this, SLOT(setFontCourier()));

    m_pMonospaceFontAction = new QAction(tr("Monospace"), this);
    m_pMonospaceFontAction->setCheckable(true);
    m_pMonospaceFontAction->setShortcut(Qt::ControlModifier + Qt::Key_M);
    connect(m_pMonospaceFontAction, SIGNAL(triggered()), this, SLOT(setFontMonospace()));

    /* Create action group for grouping of exclusive font menu items. */
    QActionGroup *pActionFontGroup = new QActionGroup(this);
    pActionFontGroup->addAction(m_pCourierFontAction);
    pActionFontGroup->addAction(m_pMonospaceFontAction);
    pActionFontGroup->setExclusive(true);

    /*
     * Color scheme.
     * Create actions for color-scheme menu items.
     */
    m_pGreenOnBlackAction = new QAction(tr("Green On Black"), this);
    m_pGreenOnBlackAction->setCheckable(true);
    m_pGreenOnBlackAction->setShortcut(Qt::ControlModifier + Qt::Key_1);
    connect(m_pGreenOnBlackAction, SIGNAL(triggered()), this, SLOT(setColorGreenOnBlack()));

    m_pBlackOnWhiteAction = new QAction(tr("Black On White"), this);
    m_pBlackOnWhiteAction->setCheckable(true);
    m_pBlackOnWhiteAction->setShortcut(Qt::ControlModifier + Qt::Key_2);
    connect(m_pBlackOnWhiteAction, SIGNAL(triggered()), this, SLOT(setColorBlackOnWhite()));

    /* Create action group for grouping of exclusive color-scheme menu items. */
    QActionGroup *pActionColorGroup = new QActionGroup(this);
    pActionColorGroup->addAction(m_pGreenOnBlackAction);
    pActionColorGroup->addAction(m_pBlackOnWhiteAction);
    pActionColorGroup->setExclusive(true);

    /*
     * Set the defaults (which syncs with the menu item checked state).
     */
    setFontCourier();
    setColorGreenOnBlack();

    NOREF(pszName);
}
开发者ID:sobomax,项目名称:virtualbox_64bit_edd,代码行数:60,代码来源:VBoxDbgConsole.cpp

示例10: clear

//Reset the console
void pConsole::reset()
{
	clear();
	
	setTextInteractionFlags( Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard | Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard | Qt::TextEditable );
	setUndoRedoEnabled( false );
	setTabStopWidth( 30 );
	
	QFont font = QFont( "Bitstream Vera Sans Mono", 11 );
	font.setBold( true );
	setFont( font );
	
	QPalette pal = viewport()->palette();
	pal.setColor( viewport()->backgroundRole(), QColor( Qt::black ) );
	pal.setColor( viewport()->foregroundRole(), QColor( Qt::white ) );
	viewport()->setPalette( pal );
	
	mColors[ ctCommand ] = Qt::white;
	mColors[ ctError ] = Qt::red;
	mColors[ ctOutput ] = Qt::blue;
	mColors[ ctCompletion ] = Qt::green;
	
	mRecordedScript.clear();
	mTypedCommand.clear();
	
	setHistory( QStringList() );
	setPromptVisible( true );
	setPrompt( "@:/> " );
}
开发者ID:hlamer,项目名称:Fresh-framework,代码行数:30,代码来源:pConsole.cpp

示例11: QTextBrowser

ChatView::ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
    : QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), evenNumber(true), showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing)
{
    document()->setDefaultStyleSheet("a { text-decoration: none; color: blue; }");
    userContextMenu = new UserContextMenu(tabSupervisor, this, game);
    connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
    
    if(tabSupervisor->getUserInfo())
    {
        userName = QString::fromStdString(tabSupervisor->getUserInfo()->name());
        mention = "@" + userName;
    }

    mentionFormat.setFontWeight(QFont::Bold);

    mentionFormatOtherUser.setFontWeight(QFont::Bold);
    mentionFormatOtherUser.setForeground(Qt::blue);
    mentionFormatOtherUser.setAnchor(true);

    viewport()->setCursor(Qt::IBeamCursor);
    setReadOnly(true);
    setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
    setOpenLinks(false);
    connect(this, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(openLink(const QUrl &)));
}
开发者ID:MarkyMarkMcDonald,项目名称:Cockatrice,代码行数:25,代码来源:chatview.cpp

示例12: setAcceptDrops

void LogViewer::init()
{
    setAcceptDrops(true);
    setReadOnly(true);
    setTabWidth(4);
    setLineWrapMode(QPlainTextEdit::NoWrap);
    setTextInteractionFlags(Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse);

    QPalette palette;
    palette.setColor(QPalette::Inactive, QPalette::Highlight, palette.color(QPalette::Active, QPalette::Highlight));
    palette.setColor(QPalette::Inactive, QPalette::HighlightedText, palette.color(QPalette::Active, QPalette::HighlightedText));
    setPalette(palette);

    // Read settings.
    setFont(INIMANAGER()->font());
    setForegroundColor(INIMANAGER()->foregroundColor());
    setBackgroundColor(INIMANAGER()->backgroundColor());
    setCustomBackgroundColor(INIMANAGER()->customBackgroundColor());
    setCurrentLineFgColor(INIMANAGER()->currentLineFgColor());
    setCurrentLineBgColor(INIMANAGER()->currentLineBgColor());

    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(drawCurrentLine()));
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(blockCountChanged(int)));
    connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));

    // Line Number.
    updateLineNumberAreaWidth(0);
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));

    // Keyword Highlighter.
    connect(m_keywordHighlighter, SIGNAL(modelCreated(QStandardItemModel*)), this, SLOT(modelCreated(QStandardItemModel*)));
    connect(m_keywordHighlighter, SIGNAL(chartLoaded(QPixmap*)), this, SLOT(chartLoaded(QPixmap*)));
}
开发者ID:joonhwan,项目名称:monkeylogviewer,代码行数:34,代码来源:LogViewer.cpp

示例13: QDialog

CreditsDialog::CreditsDialog(QWidget *parent) :
    QDialog(parent)
{
    auto mainLayout = new QVBoxLayout();

    auto titleLabel = new QLabel(tr("Credits"), this);
    titleLabel->setObjectName("CreditsDialogTitleLabel");

    auto programmersLabel = new QLabel(tr("Programmers"), this);
    programmersLabel->setObjectName("CreditsDialogProgrammersLabel");

    auto iconsLabel = new QLabel(tr("Icons"), this);
    iconsLabel->setObjectName("CreditsDialogIconsLabel");

    auto icons8LinkLabel = new QLabel("<a href=\"http://icons8.com/\">http://icons8.com/</a>", this);
    icons8LinkLabel->setObjectName("CreditsDialogIcons8LinkLabel");
    icons8LinkLabel->setTextFormat(Qt::RichText);
    icons8LinkLabel->setTextInteractionFlags(Qt::TextBrowserInteraction);
    icons8LinkLabel->setOpenExternalLinks(true);

    mainLayout->addWidget(titleLabel);

    mainLayout->addWidget(programmersLabel);

    mainLayout->addWidget(iconsLabel);
    mainLayout->addWidget(icons8LinkLabel);

    this->setLayout(mainLayout);
}
开发者ID:appetizerteam,项目名称:SayCheesePhotoManager,代码行数:29,代码来源:creditsdialog.cpp

示例14: setTextInteractionFlags

void LabelItem::focusOutEvent ( QFocusEvent* event ) {
  setTextInteractionFlags ( Qt::NoTextInteraction );
  setFlag ( QGraphicsItem::ItemIsSelectable, false );
  scene()->update();
  emit lostFocus ( this );
  QGraphicsTextItem::focusOutEvent ( event );
}
开发者ID:KristianKarl,项目名称:GraphWalkerEditor,代码行数:7,代码来源:LabelItem.cpp

示例15: toHtml

void ElementTitle::focusOutEvent(QFocusEvent *event)
{
	QGraphicsTextItem::focusOutEvent(event);

	QString htmlNormalizedText = toHtml().remove("\n", Qt::CaseInsensitive);

	setTextInteractionFlags(Qt::NoTextInteraction);

	parentItem()->setSelected(true);

	// Clear selection
	QTextCursor cursor = textCursor();
	cursor.clearSelection();
	setTextCursor(cursor);

	unsetCursor();

	if (mReadOnly)
		return;

	if (mOldText != toPlainText()) {
		QString value = toPlainText();
		if (mBinding == "name")
			static_cast<NodeElement*>(parentItem())->setName(value);
		else
			static_cast<NodeElement*>(parentItem())->setLogicalProperty(mBinding, value);
	}
	setHtml(htmlNormalizedText);
}
开发者ID:ArtemKopylov,项目名称:qreal,代码行数:29,代码来源:elementTitle.cpp


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