QFont font = v.value<QFont>();
if(font.family().isEmpty())
font = QApplication::font();
- ui.inputEdit->setFont(font);
+ ui.inputEdit->setCustomFont(font);
}
void InputWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
***************************************************************************/
#include "bufferview.h"
-
+#include "graphicalui.h"
#include "inputline.h"
#include "tabcompleter.h"
{
#ifdef HAVE_KDE
//This is done to make the KTextEdit look like a lineedit
- setMaximumHeight(document()->size().toSize().height() + 2);
+ setMaximumHeight(document()->size().toSize().height());
+ setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setAcceptRichText(false);
setLineWrapMode(NoWrap);
enableFindReplace(false);
- setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
connect(this, SIGNAL(textChanged()), this, SLOT(on_textChanged()));
#endif
InputLine::~InputLine() {
}
+void InputLine::setCustomFont(const QFont &font) {
+ setFont(font);
+#ifdef HAVE_KDE
+ setMaximumHeight(document()->size().toSize().height());
+#endif
+}
+
bool InputLine::eventFilter(QObject *watched, QEvent *event) {
if(event->type() != QEvent::KeyPress)
return false;
}
void InputLine::keyPressEvent(QKeyEvent * event) {
+
+#ifdef HAVE_KDE
+ if(event->matches(QKeySequence::Find)) {
+ QAction *act = GraphicalUi::actionCollection()->action("ToggleSearchBar");
+ if(act) {
+ act->toggle();
+ event->accept();
+ return;
+ }
+ }
+#endif
+
switch(event->key()) {
case Qt::Key_Up:
event->accept();
#else
QLineEdit
#endif
- {
+{
Q_OBJECT
public:
InputLine(QWidget *parent = 0);
~InputLine();
+ void setCustomFont(const QFont &); // should be used instead setFont(), so we can set our size correctly
+
#ifdef HAVE_KDE
//Compatibility methods with the rest of the classes which expects this to be a QLineEdit
QString text() { return toPlainText(); };