mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
port to Qt4
svn path=/trunk/playground/utils/dolphin/; revision=608854
This commit is contained in:
parent
d3648471e0
commit
c86d00c8be
|
@ -19,16 +19,13 @@
|
|||
***************************************************************************/
|
||||
#include "filterbar.h"
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qlayout.h>
|
||||
//Added by qt3to4:
|
||||
#include <Q3VBoxLayout>
|
||||
#include <QBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <Q3HBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
|
||||
#include <kdialog.h>
|
||||
#include <klocale.h>
|
||||
#include <kpushbutton.h>
|
||||
#include <klineedit.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
|
@ -39,10 +36,12 @@ FilterBar::FilterBar(QWidget *parent, const char *name) :
|
|||
{
|
||||
const int gap = 3;
|
||||
|
||||
Q3VBoxLayout* foo = new Q3VBoxLayout(this);
|
||||
QVBoxLayout* foo = new QVBoxLayout(this);
|
||||
foo->setMargin(0);
|
||||
foo->addSpacing(gap);
|
||||
|
||||
Q3HBoxLayout* layout = new Q3HBoxLayout(foo);
|
||||
QHBoxLayout* layout = new QHBoxLayout(foo);
|
||||
layout->setMargin(0);
|
||||
layout->addSpacing(gap);
|
||||
|
||||
m_filter = new QLabel(i18n("Filter:"), this);
|
||||
|
@ -50,11 +49,12 @@ FilterBar::FilterBar(QWidget *parent, const char *name) :
|
|||
layout->addSpacing(KDialog::spacingHint());
|
||||
|
||||
m_filterInput = new KLineEdit(this);
|
||||
m_filter->setBuddy(m_filterInput);
|
||||
layout->addWidget(m_filterInput);
|
||||
|
||||
m_close = new KPushButton(this);
|
||||
m_close->setIconSet(SmallIcon("fileclose"));
|
||||
m_close->setFlat(true);
|
||||
m_close = new QToolButton(this);
|
||||
m_close->setAutoRaise(true);
|
||||
m_close->setIcon(QIcon(SmallIcon("fileclose")));
|
||||
layout->addWidget(m_close);
|
||||
layout->addSpacing(gap);
|
||||
|
||||
|
@ -69,17 +69,19 @@ FilterBar::~FilterBar()
|
|||
{
|
||||
}
|
||||
|
||||
void FilterBar::hide()
|
||||
void FilterBar::hideEvent(QHideEvent* event)
|
||||
{
|
||||
m_filterInput->clear();
|
||||
m_filterInput->clearFocus();
|
||||
QWidget::hide();
|
||||
if (!event->spontaneous()) {
|
||||
m_filterInput->clear();
|
||||
m_filterInput->clearFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void FilterBar::show()
|
||||
void FilterBar::showEvent(QShowEvent* event)
|
||||
{
|
||||
m_filterInput->setFocus();
|
||||
QWidget::show();
|
||||
if (!event->spontaneous()) {
|
||||
m_filterInput->setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void FilterBar::keyReleaseEvent(QKeyEvent* event)
|
||||
|
|
|
@ -20,14 +20,11 @@
|
|||
#ifndef FILTERBAR_H
|
||||
#define FILTERBAR_H
|
||||
|
||||
#include <qwidget.h>
|
||||
//Added by qt3to4:
|
||||
#include <QKeyEvent>
|
||||
#include <QLabel>
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
class QToolButton;
|
||||
class KLineEdit;
|
||||
class KPushButton;
|
||||
|
||||
/**
|
||||
* @brief Provides an input field for filtering the currently shown items.
|
||||
|
@ -44,25 +41,20 @@ public:
|
|||
|
||||
signals:
|
||||
/**
|
||||
* Signal that reports the name filter has been
|
||||
* changed to \a nameFilter.
|
||||
*/
|
||||
* Signal that reports the name filter has been
|
||||
* changed to \a nameFilter.
|
||||
*/
|
||||
void signalFilterChanged(const QString& nameFilter);
|
||||
|
||||
public slots:
|
||||
/** @see QWidget::hide() */
|
||||
virtual void hide();
|
||||
|
||||
/** @see QWidget::show() */
|
||||
virtual void show();
|
||||
|
||||
protected:
|
||||
virtual void hideEvent(QHideEvent* event);
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void keyReleaseEvent(QKeyEvent* event);
|
||||
|
||||
private:
|
||||
QLabel* m_filter;
|
||||
KLineEdit* m_filterInput;
|
||||
KPushButton* m_close;
|
||||
QToolButton* m_close;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user