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


C++ KLineEdit类代码示例

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


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

示例1: copySqueezedText

bool KLineEdit::copySqueezedText(bool clipboard) const
{
   if (!d->squeezedText.isEmpty() && d->squeezedStart)
   {
      int start, end;
      KLineEdit *that = const_cast<KLineEdit *>(this);
      if (!that->getSelection(&start, &end))
         return false;
      if (start >= d->squeezedStart+3)
         start = start - 3 - d->squeezedStart + d->squeezedEnd;
      else if (start > d->squeezedStart)
         start = d->squeezedStart;
      if (end >= d->squeezedStart+3)
         end = end - 3 - d->squeezedStart + d->squeezedEnd;
      else if (end > d->squeezedStart)
         end = d->squeezedEnd;
      if (start == end)
         return false;
      QString t = d->squeezedText;
      t = t.mid(start, end - start);
      disconnect( QApplication::clipboard(), SIGNAL(selectionChanged()), this, 0);
      QApplication::clipboard()->setText( t, clipboard ? QClipboard::Clipboard : QClipboard::Selection );
      connect( QApplication::clipboard(), SIGNAL(selectionChanged()), this,
               SLOT(clipboardChanged()) );
      return true;
   }
   return false;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: Q_UNUSED

QWidget* RuleDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(option)

    QWidget *editor = new QWidget(parent);
    KLineEdit *ruleLineEdit = new KLineEdit(editor);
    ruleLineEdit->setToolTip(i18n("Expression"));

    KComboBox *matchComboBox = new KComboBox(editor);
    matchComboBox->setToolTip(i18n("Match Mode"));
    matchComboBox->addItem(i18n("Ignore"));
    matchComboBox->addItem(i18n("Regular expression"));
    matchComboBox->addItem(i18n("Partial match"));
    matchComboBox->addItem(i18n("Exact match"));

    QCheckBox *requiredCheckBox = new QCheckBox(editor);
    requiredCheckBox->setToolTip(i18n("Required"));

    QHBoxLayout *layout = new QHBoxLayout(editor);
    layout->addWidget(ruleLineEdit);
    layout->addWidget(matchComboBox);
    layout->addWidget(requiredCheckBox);
    layout->setMargin(0);

    setEditorData(editor, index);

    return editor;
}
开发者ID:Arigotoma,项目名称:plasmoid-fancy-tasks,代码行数:28,代码来源:RuleDelegate.cpp

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

示例4: KLineEdit

QWidget *MoneyDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */) const
{
    KLineEdit *editor = new KLineEdit(parent);
    //TODO: validator
    editor->installEventFilter(const_cast<MoneyDelegate*>(this));
    return editor;
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:7,代码来源:kptitemmodelbase.cpp

示例5: setEditorData

void Delegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    QString value = index.model()->data(index, Qt::EditRole).toString();

    KLineEdit *le = static_cast<KLineEdit*>(editor);
    le->setText(value);
}
开发者ID:KDE,项目名称:networkmanagement,代码行数:7,代码来源:delegate.cpp

示例6: setModelData

void Delegate::setModelData(QWidget *editor, QAbstractItemModel *model,
        const QModelIndex &index) const
{
    KLineEdit *le = static_cast<KLineEdit*>(editor);

    model->setData(index, le->text(), Qt::EditRole);
}
开发者ID:KDE,项目名称:networkmanagement,代码行数:7,代码来源:delegate.cpp

示例7: KDialogBase

void kiptablesgenerator::setupNewHostDialog()
{
  newHostDialog = new KDialogBase(this, 0, true, i18n("Add Host"), KDialogBase::Ok | KDialogBase::Cancel);
  
  QFrame *dialogArea = new QFrame(newHostDialog);
  QGridLayout *layout = new QGridLayout(dialogArea, 5, 2);
  
  QLabel *intro = new QLabel(i18n(
    "<p>Here you can tell netfilter to allow all connections from a given host regardless of other rules, "
    "or block all connections from a given host regardless of other rules.</p>"
    "<p>You can specify a host either by IP address or MAC address.</p>"), dialogArea);
  intro->show();
  layout->addMultiCellWidget(intro, 0, 0, 0, 1);

  QButtonGroup *whitelistOrBlacklist = new QButtonGroup(dialogArea);
  whitelistOrBlacklist->hide();
  
  QRadioButton *whitelist = new QRadioButton(i18n("&Allow"), dialogArea);
  whitelist->setChecked(true);
  whitelist->show();
  layout->addWidget(whitelist, 1, 0);
  namedWidgets["newHost_allow"] = whitelist;
  whitelistOrBlacklist->insert(whitelist);
  
  QRadioButton *blacklist = new QRadioButton(i18n("&Block"), dialogArea);
  blacklist->setChecked(false);
  blacklist->show();
  layout->addWidget(blacklist, 1, 1);
  whitelistOrBlacklist->insert(blacklist);
  
  QButtonGroup *ipOrMAC = new QButtonGroup(dialogArea);
  ipOrMAC->hide();
  
  QRadioButton *useIP = new QRadioButton(i18n("&Use IP"), dialogArea);
  useIP->setChecked(true);
  useIP->show();
  layout->addWidget(useIP, 2, 0);
  namedWidgets["newHost_useIP"] = useIP;
  ipOrMAC->insert(useIP);
  
  QRadioButton *useMAC = new QRadioButton(i18n("U&se MAC"), dialogArea);
  useMAC->show();
  layout->addWidget(useMAC, 2, 1);
  ipOrMAC->insert(useMAC);
  
  QLabel *hostLabel = new QLabel(i18n("Host:"), dialogArea);
  hostLabel->show();
  layout->addMultiCellWidget(hostLabel, 3, 3, 0, 1);
  
  KLineEdit *host = new KLineEdit(dialogArea);
  host->show();
  namedWidgets["newHost_address"] = host;
  layout->addMultiCellWidget(host, 4, 4, 0, 1);
  
  connect(newHostDialog, SIGNAL(okClicked()), this, SLOT(slotAddHost()));
  
  dialogArea->show();
  newHostDialog->setMainWidget(dialogArea);
}
开发者ID:BackupTheBerlios,项目名称:kiptg-svn,代码行数:59,代码来源:kiptablesgenerator.cpp

示例8: currentMessageListViewWidget

void Pane::focusQuickSearch()
{
  Widget *widget = currentMessageListViewWidget();
  if ( widget ) {
    KLineEdit *quickSearch = widget->quickSearch();
    if ( quickSearch )
      quickSearch->setFocus();
  }
}
开发者ID:akhuettel,项目名称:kdepim-noakonadi,代码行数:9,代码来源:pane.cpp

示例9: QWidget

QWidget *FormBase::setupLineEdit(QWidget *parent, QString text, int lineEditWidth)
{
	QWidget *widget = new QWidget(parent);
	(new QHBoxLayout(widget ) )->setAutoAdd(true);
	QLabel *label = new QLabel(text, widget);
	KLineEdit *lineEdit = new KLineEdit(widget);
	lineEdit->setMaximumWidth(lineEditWidth);
	return widget;
}
开发者ID:BackupTheBerlios,项目名称:kludoteca-svn,代码行数:9,代码来源:formbase.cpp

示例10: Q_UNUSED

QWidget * KWQTableDelegate::createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index) const
{
  Q_UNUSED(option);
  KLineEdit *editor = new KLineEdit(parent);
  editor->setFrame(false);
  editor->setFont(index.data(Qt::FontRole).value<QFont>());

  //connect(editor, SIGNAL(returnPressed()), this, SLOT(commitAndCloseEditor()));
  return editor;
}
开发者ID:phedlund,项目名称:kwordquiz,代码行数:10,代码来源:kwqtabledelegate.cpp

示例11: Q_D

void Security8021xAuthWidget::showPasswordsToggled(bool toggled)
{
    Q_D(Security8021xAuthWidget);
    for (int i = 0; i < d->layout->rowCount() - 1; i++)
    {
        KLineEdit *le = qobject_cast<KLineEdit*>(d->layout->itemAt(i, QFormLayout::FieldRole)->widget());
        if (le) {
            le->setPasswordMode(!toggled);
        }
    }
}
开发者ID:KDE,项目名称:networkmanagement,代码行数:11,代码来源:security8021xauth.cpp

示例12: QVERIFY

void AkonadiSearchDebugDialogTest::shouldHaveDefaultValue()
{
    Akonadi::Search::AkonadiSearchDebugDialog dlg;
    Akonadi::Search::AkonadiSearchDebugWidget *debugWidget = dlg.findChild<Akonadi::Search::AkonadiSearchDebugWidget *>(QStringLiteral("akonadisearchdebugwidget"));
    QVERIFY(debugWidget);
    QPlainTextEdit *editorWidget = debugWidget->findChild<QPlainTextEdit *>(QStringLiteral("plaintexteditor"));
    QVERIFY(editorWidget);
    KLineEdit *lineEdit = debugWidget->findChild<KLineEdit *>(QStringLiteral("lineedit"));
    QVERIFY(lineEdit);
    QVERIFY(lineEdit->text().isEmpty());
}
开发者ID:KDE,项目名称:akonadi-search,代码行数:11,代码来源:akonadisearchdebugdialogtest.cpp

示例13: staticSetWidgetData

void CharDataInformation::staticSetWidgetData(quint8 value, QWidget* w)
{
    KLineEdit* edit = dynamic_cast<KLineEdit*> (w);
    if (edit)
    {
        QChar qchar(value, 0);
        if (! qchar.isPrint())
            qchar = QChar(QChar::ReplacementCharacter);
        edit->setText( qchar );
    }
}
开发者ID:ShermanHuang,项目名称:kdesdk,代码行数:11,代码来源:chardatainformation.cpp

示例14: KPluginSelector

ScriptSelector::ScriptSelector( QWidget * parent )
 : KPluginSelector( parent )
{
    KLineEdit* lineEdit;
    lineEdit = this->findChild<KLineEdit*>();

    if( lineEdit )
        lineEdit->setClickMessage( i18n( "Search Scripts" ) );

    m_listView = this->findChild<KCategorizedView*>();
    scriptCount = 0;
}
开发者ID:weiligang512,项目名称:apue-test,代码行数:12,代码来源:ScriptSelector.cpp

示例15: QVERIFY

void BlackListBalooEmailCompletionWidgetTest::shouldHaveDefaultValue()
{
    KPIM::BlackListBalooEmailCompletionWidget widget;
    widget.show();
    QTest::qWaitForWindowExposed(&widget);
    QLabel *searchLabel = widget.findChild<QLabel *>(QStringLiteral("search_label"));
    QVERIFY(searchLabel);

    KLineEdit *searchLineEdit = widget.findChild<KLineEdit *>(QStringLiteral("search_lineedit"));
    QVERIFY(searchLineEdit);
    QVERIFY(searchLineEdit->isClearButtonShown());
    QVERIFY(searchLineEdit->trapReturnKey());
    QVERIFY(searchLineEdit->text().isEmpty());

    QPushButton *seachButton = widget.findChild<QPushButton *>(QStringLiteral("search_button"));
    QVERIFY(seachButton);
    QVERIFY(!seachButton->isEnabled());

    QLabel *moreResult = widget.findChild<QLabel *>(QStringLiteral("moreresultlabel"));
    QVERIFY(moreResult);
    QVERIFY(!moreResult->isVisible());

    QLabel *mNumberOfEmailsFound = widget.findChild<QLabel *>(QStringLiteral("numberofemailsfound"));
    QVERIFY(mNumberOfEmailsFound);
    QVERIFY(mNumberOfEmailsFound->text().isEmpty());

    QPushButton *showAllBlackListedEmails = widget.findChild<QPushButton *>(QStringLiteral("show_blacklisted_email_button"));
    QVERIFY(showAllBlackListedEmails);

    KPIM::BlackListBalooEmailList *emailList = widget.findChild<KPIM::BlackListBalooEmailList *>(QStringLiteral("email_list"));
    QVERIFY(emailList);

    QPushButton *selectButton = widget.findChild<QPushButton *>(QStringLiteral("select_email"));
    QVERIFY(selectButton);
    QVERIFY(!selectButton->isEnabled());
    QPushButton *unselectButton = widget.findChild<QPushButton *>(QStringLiteral("unselect_email"));
    QVERIFY(unselectButton);
    QVERIFY(!unselectButton->isEnabled());

    QLabel *excludeDomainLabel = widget.findChild<QLabel *>(QStringLiteral("domain_label"));
    QVERIFY(excludeDomainLabel);

    KLineEdit *excludeDomainLineEdit = widget.findChild<KLineEdit *>(QStringLiteral("domain_lineedit"));
    QVERIFY(excludeDomainLineEdit);
    QVERIFY(excludeDomainLineEdit->trapReturnKey());
    QVERIFY(excludeDomainLineEdit->text().isEmpty());
    QVERIFY(excludeDomainLineEdit->isClearButtonShown());
    QVERIFY(!excludeDomainLineEdit->placeholderText().isEmpty());

    KListWidgetSearchLine *searchInResult = widget.findChild<KListWidgetSearchLine *>(QStringLiteral("searchinresultlineedit"));
    QVERIFY(searchInResult);
    QVERIFY(!searchInResult->placeholderText().isEmpty());
    QVERIFY(searchInResult->text().isEmpty());
    QVERIFY(searchInResult->isClearButtonEnabled());

    KPIM::BlackListBalooEmailWarning *blackListWarning = widget.findChild<KPIM::BlackListBalooEmailWarning *>(QStringLiteral("backlistwarning"));
    QVERIFY(blackListWarning);
}
开发者ID:KDE,项目名称:zanshin,代码行数:58,代码来源:blacklistbalooemailcompletionwidgettest.cpp


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