Use QLineEdit's clear button feature in in Qt Designer.
authorFriedemann Kleint <Friedemann.Kleint@digia.com>
Fri, 12 Apr 2013 13:24:55 +0000 (15:24 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 2 Sep 2013 15:27:03 +0000 (17:27 +0200)
Remove old filter widget.

Change-Id: Id65eee844d85df2d3c5a87f5acc26ba154d202c9
Reviewed-by: David Faure (KDE) <faure@kde.org>
Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
src/designer/src/components/propertyeditor/propertyeditor.cpp
src/designer/src/components/propertyeditor/propertyeditor.h
src/designer/src/components/widgetbox/widgetbox.cpp
src/designer/src/lib/shared/actioneditor.cpp
src/designer/src/lib/shared/filterwidget.cpp [deleted file]
src/designer/src/lib/shared/filterwidget_p.h [deleted file]
src/designer/src/lib/shared/qtresourceview.cpp
src/designer/src/lib/shared/shared.pri

index 7275b68..eb76b68 100644 (file)
@@ -47,7 +47,6 @@
 #include "designerpropertymanager.h"
 #include "qdesigner_propertysheet_p.h"
 #include "formwindowbase_p.h"
-#include "filterwidget_p.h" // For FilterWidget
 
 #include "newdynamicpropertydialog.h"
 #include "dynamicpropertysheet.h"
@@ -226,7 +225,7 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
     m_dynamicGroup(0),
     m_updatingBrowser(false),
     m_stackedWidget(new QStackedWidget),
-    m_filterWidget(new FilterWidget(0, FilterWidget::LayoutAlignNone)),
+    m_filterWidget(new QLineEdit),
     m_buttonIndex(-1),
     m_treeIndex(-1),
     m_addDynamicAction(new QAction(createIconSet(QStringLiteral("plus.png")), tr("Add Dynamic Property..."), this)),
@@ -331,7 +330,9 @@ PropertyEditor::PropertyEditor(QDesignerFormEditorInterface *core, QWidget *pare
     m_treeBrowser->setResizeMode(QtTreePropertyBrowser::Interactive);
     m_treeIndex = m_stackedWidget->addWidget(m_treeBrowser);
     connect(m_treeBrowser, SIGNAL(currentItemChanged(QtBrowserItem*)), this, SLOT(slotCurrentItemChanged(QtBrowserItem*)));
-    connect(m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(setFilter(QString)));
+    m_filterWidget->setPlaceholderText(tr("Filter"));
+    m_filterWidget->setClearButtonEnabled(true);
+    connect(m_filterWidget, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
 
     QVBoxLayout *layout = new QVBoxLayout(this);
     layout->addWidget(toolBar);
index a439fd0..b917d47 100644 (file)
@@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE
 class DomProperty;
 class QDesignerMetaDataBaseItemInterface;
 class QDesignerPropertySheetExtension;
+class QLineEdit;
 
 class QtAbstractPropertyBrowser;
 class QtButtonPropertyBrowser;
@@ -69,7 +70,6 @@ namespace qdesigner_internal {
 class StringProperty;
 class DesignerPropertyManager;
 class DesignerEditorFactory;
-class FilterWidget;
 class ElidingLabel;
 
 class QT_PROPERTYEDITOR_EXPORT PropertyEditor: public QDesignerPropertyEditor
@@ -176,7 +176,7 @@ private:
     bool m_updatingBrowser;
 
     QStackedWidget *m_stackedWidget;
-    FilterWidget *m_filterWidget;
+    QLineEdit *m_filterWidget;
     int m_buttonIndex;
     int m_treeIndex;
     QAction *m_addDynamicAction;
index f29f99e..d514fec 100644 (file)
 
 #include <iconloader_p.h>
 #include <qdesigner_utils_p.h>
-#include <filterwidget_p.h>
 
 #include <QtGui/QDropEvent>
 #include <QtWidgets/QVBoxLayout>
 #include <QtWidgets/QApplication>
 #include <QtWidgets/QToolBar>
+#include <QtWidgets/QLineEdit>
 #include <QtGui/QIcon>
 
 QT_BEGIN_NAMESPACE
 
 namespace qdesigner_internal {
 
+/* WidgetBoxFilterLineEdit: This widget should never have initial focus
+ * (ie, be the first widget of a dialog, else, the hint cannot be displayed.
+ * As it is the only focusable control in the widget box, it clears the focus
+ * policy and focusses explicitly on click only (note that setting Qt::ClickFocus
+ * is not sufficient for that as an ActivationFocus will occur). */
+
+class WidgetBoxFilterLineEdit : public QLineEdit {
+public:
+    explicit WidgetBoxFilterLineEdit(QWidget *parent = 0) : QLineEdit(parent), m_defaultFocusPolicy(focusPolicy())
+        { setFocusPolicy(Qt::NoFocus); }
+
+protected:
+    virtual void mousePressEvent(QMouseEvent *event);
+    virtual void focusInEvent(QFocusEvent *e);
+
+private:
+    const Qt::FocusPolicy m_defaultFocusPolicy;
+};
+
+void WidgetBoxFilterLineEdit::mousePressEvent(QMouseEvent *e)
+{
+    if (!hasFocus()) // Explicitly focus on click.
+        setFocus(Qt::OtherFocusReason);
+    QLineEdit::mousePressEvent(e);
+}
+
+void WidgetBoxFilterLineEdit::focusInEvent(QFocusEvent *e)
+{
+    // Refuse the focus if the mouse it outside. In addition to the mouse
+    // press logic, this prevents a re-focussing which occurs once
+    // we actually had focus
+    const Qt::FocusReason reason = e->reason();
+    if (reason == Qt::ActiveWindowFocusReason || reason == Qt::PopupFocusReason) {
+        const QPoint mousePos = mapFromGlobal(QCursor::pos());
+        const bool refuse = !geometry().contains(mousePos);
+        if (refuse) {
+            e->ignore();
+            return;
+        }
+    }
+    QLineEdit::focusInEvent(e);
+}
+
 WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::WindowFlags flags)
     : QDesignerWidgetBox(parent, flags),
       m_core(core),
@@ -71,11 +114,11 @@ WidgetBox::WidgetBox(QDesignerFormEditorInterface *core, QWidget *parent, Qt::Wi
     l->setSpacing(0);
 
     // Prevent the filter from grabbing focus since Our view has Qt::NoFocus
-    FilterWidget *filterWidget = new FilterWidget(0, FilterWidget::LayoutAlignNone);
-    filterWidget->setRefuseFocus(true);
-    connect(filterWidget, SIGNAL(filterChanged(QString)), m_view, SLOT(filter(QString)));
-
     QToolBar *toolBar = new QToolBar(this);
+    QLineEdit *filterWidget = new WidgetBoxFilterLineEdit(toolBar);
+    filterWidget->setPlaceholderText(tr("Filter"));
+    filterWidget->setClearButtonEnabled(true);
+    connect(filterWidget, SIGNAL(textChanged(QString)), m_view, SLOT(filter(QString)));
     toolBar->addWidget(filterWidget);
     l->addWidget(toolBar);
 
index 218d963..ba0ce78 100644 (file)
@@ -40,7 +40,6 @@
 ****************************************************************************/
 
 #include "actioneditor_p.h"
-#include "filterwidget_p.h"
 #include "actionrepository_p.h"
 #include "iconloader_p.h"
 #include "newactiondialog_p.h"
@@ -205,8 +204,14 @@ ActionEditor::ActionEditor(QDesignerFormEditorInterface *core, QWidget *parent,
     m_listViewAction->setIcon(style()->standardIcon (QStyle::SP_FileDialogDetailedView));
     configureMenu->addAction(m_listViewAction);
     // filter
-    m_filterWidget = new FilterWidget(toolbar);
-    connect(m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(setFilter(QString)));
+    m_filterWidget = new QWidget(toolbar);
+    QHBoxLayout *filterLayout = new QHBoxLayout(m_filterWidget);
+    QLineEdit *filterLineEdit = new QLineEdit(m_filterWidget);
+    connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilter(QString)));
+    filterLineEdit->setPlaceholderText(tr("Filter"));
+    filterLineEdit->setClearButtonEnabled(true);
+    filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
+    filterLayout->addWidget(filterLineEdit);
     m_filterWidget->setEnabled(false);
     toolbar->addWidget(m_filterWidget);
 
diff --git a/src/designer/src/lib/shared/filterwidget.cpp b/src/designer/src/lib/shared/filterwidget.cpp
deleted file mode 100644 (file)
index 15346b3..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.  For licensing terms and
-** conditions see http://qt.digia.com/licensing.  For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights.  These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "filterwidget_p.h"
-#include "iconloader_p.h"
-
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QHBoxLayout>
-#include <QtWidgets/QLineEdit>
-#include <QtGui/QFocusEvent>
-#include <QtGui/QPalette>
-#include <QtGui/QCursor>
-#include <QtWidgets/QToolButton>
-#include <QtGui/QPainter>
-#include <QtWidgets/QStyle>
-#include <QtWidgets/QStyleOption>
-
-#include <QtCore/QDebug>
-#include <QtCore/QPropertyAnimation>
-
-enum { debugFilter = 0 };
-
-QT_BEGIN_NAMESPACE
-
-namespace qdesigner_internal {
-
-HintLineEdit::HintLineEdit(QWidget *parent) :
-    QLineEdit(parent),
-    m_defaultFocusPolicy(focusPolicy()),
-    m_refuseFocus(false)
-{
-}
-
-IconButton::IconButton(QWidget *parent)
-    : QToolButton(parent), m_fader(1.0f)
-{
-    setCursor(Qt::ArrowCursor);
-}
-
-void IconButton::paintEvent(QPaintEvent *)
-{
-    QPainter painter(this);
-    // Note isDown should really use the active state but in most styles
-    // this has no proper feedback
-    QIcon::Mode state = QIcon::Disabled;
-    if (isEnabled())
-        state = isDown() ? QIcon::Selected : QIcon::Normal;
-    QPixmap iconpixmap = icon().pixmap(QSize(ICONBUTTON_SIZE, ICONBUTTON_SIZE),
-                                       state, QIcon::Off);
-    QRect pixmapRect = QRect(0, 0, iconpixmap.width(), iconpixmap.height());
-    pixmapRect.moveCenter(rect().center());
-    painter.setOpacity(m_fader);
-    painter.drawPixmap(pixmapRect, iconpixmap);
-}
-
-void IconButton::animateShow(bool visible)
-{
-    if (visible) {
-        QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
-        animation->setDuration(160);
-        animation->setEndValue(1.0);
-        animation->start(QAbstractAnimation::DeleteWhenStopped);
-    } else {
-        QPropertyAnimation *animation = new QPropertyAnimation(this, "fader");
-        animation->setDuration(160);
-        animation->setEndValue(0.0);
-        animation->start(QAbstractAnimation::DeleteWhenStopped);
-    }
-}
-
-bool HintLineEdit::refuseFocus() const
-{
-    return m_refuseFocus;
-}
-
-void HintLineEdit::setRefuseFocus(bool v)
-{
-    if (v == m_refuseFocus)
-        return;
-    m_refuseFocus = v;
-    setFocusPolicy(m_refuseFocus ? Qt::NoFocus : m_defaultFocusPolicy);
-}
-
-void HintLineEdit::mousePressEvent(QMouseEvent *e)
-{
-    if (debugFilter)
-        qDebug() << Q_FUNC_INFO;
-    // Explicitly focus on click.
-    if (m_refuseFocus && !hasFocus())
-        setFocus(Qt::OtherFocusReason);
-    QLineEdit::mousePressEvent(e);
-}
-
-void HintLineEdit::focusInEvent(QFocusEvent *e)
-{
-    if (debugFilter)
-        qDebug() << Q_FUNC_INFO;
-    if (m_refuseFocus) {
-        // Refuse the focus if the mouse it outside. In addition to the mouse
-        // press logic, this prevents a re-focussing which occurs once
-        // we actually had focus
-        const Qt::FocusReason reason = e->reason();
-        if (reason == Qt::ActiveWindowFocusReason || reason == Qt::PopupFocusReason) {
-            const QPoint mousePos = mapFromGlobal(QCursor::pos());
-            const bool refuse = !geometry().contains(mousePos);
-            if (debugFilter)
-                qDebug() << Q_FUNC_INFO << refuse ;
-            if (refuse) {
-                e->ignore();
-                return;
-            }
-        }
-    }
-
-    QLineEdit::focusInEvent(e);
-}
-
-// ------------------- FilterWidget
-FilterWidget::FilterWidget(QWidget *parent, LayoutMode lm)  :
-    QWidget(parent),
-    m_editor(new HintLineEdit(this)),
-    m_button(new IconButton(m_editor)),
-    m_buttonwidth(0)
-{
-    m_editor->setPlaceholderText(tr("Filter"));
-
-    // Let the style determine minimum height for our widget
-    QSize size(ICONBUTTON_SIZE + 6, ICONBUTTON_SIZE + 2);
-
-    // Note KDE does not reserve space for the highlight color
-    if (style()->inherits("OxygenStyle")) {
-        size = size.expandedTo(QSize(24, 0));
-    }
-
-    // Make room for clear icon
-    QMargins margins = m_editor->textMargins();
-    if (layoutDirection() == Qt::LeftToRight)
-        margins.setRight(size.width());
-    else
-        margins.setLeft(size.width());
-
-    m_editor->setTextMargins(margins);
-
-    QHBoxLayout *l = new QHBoxLayout(this);
-    l->setMargin(0);
-    l->setSpacing(0);
-    if (lm == LayoutAlignRight)
-        l->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum));
-
-    l->addWidget(m_editor);
-
-    // KDE has custom icons for this. Notice that icon namings are counter intuitive
-    // If these icons are not avaiable we use the freedesktop standard name before
-    // falling back to a bundled resource
-    QIcon icon = QIcon::fromTheme(layoutDirection() == Qt::LeftToRight ?
-                     QStringLiteral("edit-clear-locationbar-rtl") :
-                     QStringLiteral("edit-clear-locationbar-ltr"),
-                     QIcon::fromTheme(QStringLiteral("edit-clear"), createIconSet(QStringLiteral("cleartext.png"))));
-
-    m_button->setIcon(icon);
-    m_button->setToolTip(tr("Clear text"));
-    connect(m_button, SIGNAL(clicked()), this, SLOT(reset()));
-    connect(m_editor, SIGNAL(textChanged(QString)), this, SLOT(checkButton(QString)));
-    connect(m_editor, SIGNAL(textEdited(QString)), this, SIGNAL(filterChanged(QString)));
-}
-
-QString FilterWidget::text() const
-{
-    return m_editor->text();
-}
-
-void FilterWidget::checkButton(const QString &text)
-{
-    if (m_oldText.isEmpty() || text.isEmpty())
-        m_button->animateShow(!m_editor->text().isEmpty());
-    m_oldText = text;
-}
-
-void FilterWidget::reset()
-{
-    if (debugFilter)
-        qDebug() << Q_FUNC_INFO;
-
-    if (!m_editor->text().isEmpty()) {
-        // Editor has lost focus once this is pressed
-        m_editor->clear();
-        emit filterChanged(QString());
-    }
-}
-
-void FilterWidget::resizeEvent(QResizeEvent *)
-{
-    QRect contentRect = m_editor->rect();
-    if (layoutDirection() == Qt::LeftToRight) {
-        const int iconoffset = m_editor->textMargins().right() + 4;
-        m_button->setGeometry(contentRect.adjusted(m_editor->width() - iconoffset, 0, 0, 0));
-    } else {
-        const int iconoffset = m_editor->textMargins().left() + 4;
-        m_button->setGeometry(contentRect.adjusted(0, 0, -m_editor->width() + iconoffset, 0));
-    }
-}
-
-bool FilterWidget::refuseFocus() const
-{
-    return m_editor->refuseFocus();
-}
-
-void FilterWidget::setRefuseFocus(bool v)
-{
-    m_editor->setRefuseFocus(v);
-}
-} // namespace qdesigner_internal
-
-QT_END_NAMESPACE
diff --git a/src/designer/src/lib/shared/filterwidget_p.h b/src/designer/src/lib/shared/filterwidget_p.h
deleted file mode 100644 (file)
index 53405cc..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
-**
-** This file is part of the Qt Designer of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia.  For licensing terms and
-** conditions see http://qt.digia.com/licensing.  For further information
-** use the contact form at http://qt.digia.com/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Digia gives you certain additional
-** rights.  These rights are described in the Digia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.  Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-//  W A R N I N G
-//  -------------
-//
-// This file is not part of the Qt API.  It exists for the convenience
-// of Qt Designer.  This header
-// file may change from version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef FILTERWIDGET_H
-#define FILTERWIDGET_H
-
-#include "shared_global_p.h"
-
-#include <QtWidgets/QWidget>
-#include <QtWidgets/QLineEdit>
-#include <QtGui/QColor>
-#include <QtWidgets/QToolButton>
-
-QT_BEGIN_NAMESPACE
-
-class QToolButton;
-
-namespace qdesigner_internal {
-
-/* This widget should never have initial focus
- * (ie, be the first widget of a dialog, else, the hint cannot be displayed.
- * For situations, where it is the only focusable control (widget box),
- * there is a special "refuseFocus()" mode, in which it clears the focus
- * policy and focusses explicitly on click (note that setting Qt::ClickFocus
- * is not sufficient for that as an ActivationFocus will occur). */
-
-#define ICONBUTTON_SIZE 16
-
-class QDESIGNER_SHARED_EXPORT HintLineEdit : public QLineEdit {
-    Q_OBJECT
-public:
-    explicit HintLineEdit(QWidget *parent = 0);
-
-    bool refuseFocus() const;
-    void setRefuseFocus(bool v);
-
-protected:
-    virtual void mousePressEvent(QMouseEvent *event);
-    virtual void focusInEvent(QFocusEvent *e);
-
-private:
-    const Qt::FocusPolicy m_defaultFocusPolicy;
-    bool m_refuseFocus;
-};
-
-// IconButton: This is a simple helper class that represents clickable icons
-
-class IconButton: public QToolButton
-{
-    Q_OBJECT
-    Q_PROPERTY(float fader READ fader WRITE setFader)
-public:
-    IconButton(QWidget *parent);
-    void paintEvent(QPaintEvent *event);
-    float fader() { return m_fader; }
-    void setFader(float value) { m_fader = value; update(); }
-    void animateShow(bool visible);
-
-private:
-    float m_fader;
-};
-
-// FilterWidget: For filtering item views, with reset button Uses HintLineEdit.
-
-class  QDESIGNER_SHARED_EXPORT FilterWidget : public QWidget
-{
-    Q_OBJECT
-public:
-    enum LayoutMode {
-        // For use in toolbars: Expand to the right
-        LayoutAlignRight,
-        // No special alignment
-        LayoutAlignNone
-    };
-
-    explicit FilterWidget(QWidget *parent = 0, LayoutMode lm = LayoutAlignRight);
-
-    QString text() const;
-    void resizeEvent(QResizeEvent *);
-    bool refuseFocus() const; // see HintLineEdit
-    void setRefuseFocus(bool v);
-
-signals:
-    void filterChanged(const QString &);
-
-public slots:
-    void reset();
-
-private slots:
-    void checkButton(const QString &text);
-
-private:
-    HintLineEdit *m_editor;
-    IconButton *m_button;
-    int m_buttonwidth;
-    QString m_oldText;
-};
-} // namespace qdesigner_internal
-
-QT_END_NAMESPACE
-
-#endif
index 34d3019..132d9d0 100644 (file)
@@ -43,7 +43,6 @@
 #include "qtresourcemodel_p.h"
 #include "qtresourceeditordialog_p.h"
 #include "iconloader_p.h"
-#include "filterwidget_p.h" // For FilterWidget
 
 #include <QtDesigner/QDesignerFormEditorInterface>
 #include <QtDesigner/QDesignerSettingsInterface>
@@ -68,6 +67,7 @@
 #include <QtGui/QClipboard>
 #endif
 #include <QtWidgets/QMenu>
+#include <QtWidgets/QLineEdit>
 #include <QtGui/QDrag>
 #include <QtCore/QMimeData>
 #include <QtXml/QDomDocument>
@@ -165,7 +165,7 @@ public:
     QDesignerFormEditorInterface *m_core;
     QtResourceModel *m_resourceModel;
     QToolBar *m_toolBar;
-    qdesigner_internal::FilterWidget *m_filterWidget;
+    QWidget *m_filterWidget;
     QTreeWidget *m_treeWidget;
     QListWidget *m_listWidget;
     QSplitter *m_splitter;
@@ -609,10 +609,15 @@ QtResourceView::QtResourceView(QDesignerFormEditorInterface *core, QWidget *pare
     d_ptr->m_copyResourcePathAction->setEnabled(false);
 #endif
 
-    //d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(0, qdesigner_internal::FilterWidget::LayoutAlignNone);
-    d_ptr->m_filterWidget = new qdesigner_internal::FilterWidget(d_ptr->m_toolBar);
+    d_ptr->m_filterWidget = new QWidget(d_ptr->m_toolBar);
+    QHBoxLayout *filterLayout = new QHBoxLayout(d_ptr->m_filterWidget);
+    QLineEdit *filterLineEdit = new QLineEdit(d_ptr->m_filterWidget);
+    connect(filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotFilterChanged(QString)));
+    filterLineEdit->setPlaceholderText(tr("Filter"));
+    filterLineEdit->setClearButtonEnabled(true);
+    filterLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::MinimumExpanding, QSizePolicy::Ignored));
+    filterLayout->addWidget(filterLineEdit);
     d_ptr->m_toolBar->addWidget(d_ptr->m_filterWidget);
-    connect(d_ptr->m_filterWidget, SIGNAL(filterChanged(QString)), this, SLOT(slotFilterChanged(QString)));
 
     d_ptr->m_splitter = new QSplitter;
     d_ptr->m_splitter->setChildrenCollapsible(false);
index fc5570a..cf530af 100644 (file)
@@ -106,7 +106,6 @@ HEADERS += \
     $$PWD/qdesigner_formwindowmanager_p.h \
     $$PWD/shared_settings_p.h \
     $$PWD/newformwidget_p.h \
-    $$PWD/filterwidget_p.h \
     $$PWD/plugindialog_p.h \
     $$PWD/rcc_p.h
 
@@ -183,7 +182,6 @@ SOURCES += \
     $$PWD/qdesigner_formwindowmanager.cpp \
     $$PWD/shared_settings.cpp \
     $$PWD/newformwidget.cpp \
-    $$PWD/filterwidget.cpp \
     $$PWD/plugindialog.cpp \
     $$PWD/rcc.cpp