本文整理汇总了C++中KLineEdit::installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ KLineEdit::installEventFilter方法的具体用法?C++ KLineEdit::installEventFilter怎么用?C++ KLineEdit::installEventFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KLineEdit
的用法示例。
在下文中一共展示了KLineEdit::installEventFilter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: QShortcut
//.........这里部分代码省略.........
m_layout->addWidget(m_buttonContainer);
m_searchTerm = new KrunnerHistoryComboBox(false, this);
KLineEdit *lineEdit = new KLineEdit(m_searchTerm);
QAction *focusEdit = new QAction(this);
focusEdit->setShortcut(Qt::Key_F6);
connect(focusEdit, SIGNAL(triggered(bool)), this, SLOT(searchTermSetFocus()));
addAction(focusEdit);
// the order of these next few lines if very important.
// QComboBox::setLineEdit sets the autoComplete flag on the lineedit,
// and KComboBox::setAutoComplete resets the autocomplete mode! ugh!
m_searchTerm->setLineEdit(lineEdit);
m_completion = new KCompletion();
lineEdit->setCompletionObject(m_completion);
lineEdit->setCompletionMode(static_cast<KGlobalSettings::Completion>(KRunnerSettings::queryTextCompletionMode()));
lineEdit->setClearButtonShown(true);
QStringList pastQueryItems = KRunnerSettings::pastQueries();
m_searchTerm->setHistoryItems(pastQueryItems);
m_completion->insertItems(pastQueryItems);
bottomLayout->insertWidget(4, m_searchTerm, 10);
m_singleRunnerSearchTerm = new KLineEdit(this);
bottomLayout->insertWidget(4, m_singleRunnerSearchTerm, 10 );
//kDebug() << "size:" << m_resultsView->size() << m_resultsView->minimumSize();
m_resultsScene = new ResultScene(&m_resultData, runnerManager, m_searchTerm, this);
m_resultsView = new ResultsView(m_resultsScene, &m_resultData, this);
m_layout->addWidget(m_resultsView);
connect(m_resultsScene, SIGNAL(viewableHeightChanged()), this, SLOT(fitWindow()));
connect(m_resultsScene, SIGNAL(matchCountChanged(int)), this, SLOT(matchCountChanged(int)));
connect(m_resultsScene, SIGNAL(itemActivated(ResultItem*)), this, SLOT(run(ResultItem*)));
connect(m_searchTerm, SIGNAL(queryTextEdited(QString)), this, SLOT(queryTextEdited(QString)));
connect(m_searchTerm, SIGNAL(returnPressed()), this, SLOT(runDefaultResultItem()));
connect(m_singleRunnerSearchTerm, SIGNAL(textChanged(QString)), this, SLOT(queryTextEdited(QString)));
connect(m_singleRunnerSearchTerm, SIGNAL(returnPressed()), this, SLOT(runDefaultResultItem()));
lineEdit->installEventFilter(this);
m_searchTerm->installEventFilter(this);
themeUpdated();
connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), this, SLOT(themeUpdated()));
new QShortcut(QKeySequence(Qt::Key_Escape), this, SLOT(resetAndClose()));
m_layout->setAlignment(Qt::AlignTop);
setTabOrder(0, m_configButton);
setTabOrder(m_configButton, m_activityButton);
setTabOrder(m_activityButton, m_searchTerm);
setTabOrder(m_searchTerm, m_singleRunnerSearchTerm);
setTabOrder(m_singleRunnerSearchTerm, m_resultsView);
setTabOrder(m_resultsView, m_helpButton);
setTabOrder(m_helpButton, m_closeButton);
//kDebug() << "size:" << m_resultsView->size() << m_resultsView->minimumSize() << minimumSizeHint();
// we restore the original size, which will set the results view back to its
// normal size, then we hide the results view and resize the dialog
setMinimumSize(QSize(MIN_WIDTH, m_searchTerm->sizeHint().height()));
// we load the last used size; the saved value is the size of the dialog when the
// results are visible;
adjustSize();
if (KGlobal::config()->hasGroup("Interface")) {
KConfigGroup interfaceConfig(KGlobal::config(), "Interface");
restoreDialogSize(interfaceConfig);
m_defaultSize = size();
} else {
const int screenWidth = qApp->desktop()->screenGeometry().width();
int width = size().width();
if (screenWidth >= 1920) {
width = qMax(width, 550);
} else if (screenWidth >= 1024) {
width = qMax(width, 300);
}
m_defaultSize = QSize(width, 500);
}
m_resultsView->hide();
m_delayedQueryTimer.setSingleShot(true);
m_delayedQueryTimer.setInterval(50);
connect(&m_delayedQueryTimer, SIGNAL(timeout()), this, SLOT(delayedQueryLaunch()));
m_saveDialogSizeTimer.setSingleShot(true);
m_saveDialogSizeTimer.setInterval(1000);
connect(&m_saveDialogSizeTimer, SIGNAL(timeout()), SLOT(saveCurrentDialogSize()));
QTimer::singleShot(0, this, SLOT(resetInterface()));
}