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


C++ KLineEdit::completionObject方法代码示例

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


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

示例1: setupUI

    void setupUI() {
        p->setObjectName(QStringLiteral("FieldLineEdit"));

        hLayout = new QHBoxLayout(p);
        hLayout->setMargin(0);
        hLayout->setSpacing(2);

        m_pushButtonType = new QPushButton(p);
        appendWidget(m_pushButtonType);
        hLayout->setStretchFactor(m_pushButtonType, 0);
        m_pushButtonType->setObjectName(QStringLiteral("FieldLineEditButton"));

        if (isMultiLine) {
            m_multiLineEditText = new KTextEdit(p);
            appendWidget(m_multiLineEditText);
            connect(m_multiLineEditText, &KTextEdit::textChanged, p, &MenuLineEdit::slotTextChanged);
            m_multiLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            p->setFocusProxy(m_multiLineEditText);
            m_multiLineEditText->setAcceptRichText(false);
        } else {
            m_singleLineEditText = new KLineEdit(p);
            appendWidget(m_singleLineEditText);
            hLayout->setStretchFactor(m_singleLineEditText, 100);
            m_singleLineEditText->setClearButtonEnabled(true);
            m_singleLineEditText->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
            m_singleLineEditText->setCompletionMode(KCompletion::CompletionPopup);
            m_singleLineEditText->completionObject()->setIgnoreCase(true);
            p->setFocusProxy(m_singleLineEditText);
            connect(m_singleLineEditText, &KLineEdit::textEdited, p, &MenuLineEdit::textChanged);
        }

        p->setFocusPolicy(Qt::StrongFocus); // FIXME improve focus handling
        p->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
    }
开发者ID:KDE,项目名称:kbibtex,代码行数:34,代码来源:menulineedit.cpp

示例2: addJourneySearchWidgets

void TitleWidget::addJourneySearchWidgets()
{
    // Add recent journeys button
    Plasma::ToolButton *recentJourneysButton = new Plasma::ToolButton;
    recentJourneysButton->setIcon( KIcon("document-open-recent") );
    recentJourneysButton->setToolTip( i18nc("@info:tooltip", "Use a favorite/recent journey search") );
    recentJourneysButton->nativeWidget()->setPopupMode( QToolButton::InstantPopup );
    // This is needed, to have the popup menu drawn above other widgets
    recentJourneysButton->setZValue( 9999 );
    connect( recentJourneysButton, SIGNAL(clicked()), this, SLOT(slotJourneysIconClicked()) );

    // Add button to start the journey search
    Plasma::ToolButton *journeySearchButton = new Plasma::ToolButton;
    journeySearchButton->setIcon( KIcon("edit-find") );
    journeySearchButton->setToolTip( i18nc("@info:tooltip", "Find journeys") );
    journeySearchButton->setEnabled( false );
    connect( journeySearchButton, SIGNAL(clicked()), this, SLOT(slotJourneySearchInputFinished()) );

    // Add journey search query input field
    Plasma::LineEdit *journeySearchLineEdit = new Plasma::LineEdit;
    journeySearchLineEdit->setNativeWidget( new JourneySearchLineEdit );
    journeySearchLineEdit->setToolTip(
            i18nc("@info:tooltip This should match the localized keywords.",
            "<para>Type a <emphasis strong='1'>target stop</emphasis> or "
            "<emphasis strong='1'>journey request</emphasis>.</para>"
            "<para><emphasis strong='1'>Samples:</emphasis><list>"
            "<item><emphasis>To target in 15 mins</emphasis></item>"
            "<item><emphasis>From origin arriving tomorrow at 18:00</emphasis></item>"
            "<item><emphasis>Target at 6:00 2010-03-07</emphasis></item>"
            "</list></para>") );
    journeySearchLineEdit->installEventFilter( this ); // Handle up/down keys (selecting stop suggestions)
    journeySearchLineEdit->setClearButtonShown( true );
    journeySearchLineEdit->nativeWidget()->setCompletionMode( KGlobalSettings::CompletionAuto );
    journeySearchLineEdit->nativeWidget()->setCompletionModeDisabled(
            KGlobalSettings::CompletionMan );
    journeySearchLineEdit->nativeWidget()->setCompletionModeDisabled(
            KGlobalSettings::CompletionPopup );
    journeySearchLineEdit->nativeWidget()->setCompletionModeDisabled(
            KGlobalSettings::CompletionPopupAuto );
    journeySearchLineEdit->nativeWidget()->setCompletionModeDisabled(
            KGlobalSettings::CompletionShell );
    journeySearchLineEdit->setEnabled( true );

    KLineEdit *journeySearch = journeySearchLineEdit->nativeWidget();
    journeySearch->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
    journeySearch->setClickMessage( i18nc("@info/plain", "Target stop name or journey request") );
    KCompletion *completion = journeySearch->completionObject( false );
    completion->setIgnoreCase( true );
    journeySearchLineEdit->setFont( m_settings->sizedFont() );
    connect( journeySearchLineEdit, SIGNAL(returnPressed()),
             this, SLOT(slotJourneySearchInputFinished()) );
    connect( journeySearchLineEdit, SIGNAL(textEdited(QString)),
             this, SIGNAL(journeySearchInputEdited(QString)) );
    connect( journeySearchLineEdit, SIGNAL(textChanged(QString)),
             this, SLOT(slotJourneySearchInputChanged(QString)) );

    // Add widgets
    addWidget( journeySearchLineEdit, WidgetJourneySearchLine );
    addWidget( recentJourneysButton, WidgetFillJourneySearchLineButton );
    addWidget( journeySearchButton, WidgetStartJourneySearchButton );
}
开发者ID:KDE,项目名称:publictransport,代码行数:61,代码来源:titlewidget.cpp


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