summaryrefslogtreecommitdiff
authorzecke <zecke>2003-10-07 12:56:18 (UTC)
committer zecke <zecke>2003-10-07 12:56:18 (UTC)
commit6f807f937764d0b80d38cd5e29983ad4ec2ae3c8 (patch) (unidiff)
treea1fc0bf579e5dfa0b07813110e998d4ea97d5c78
parent898d453b417e561cea25f6b7578814d31cec6e97 (diff)
downloadopie-6f807f937764d0b80d38cd5e29983ad4ec2ae3c8.zip
opie-6f807f937764d0b80d38cd5e29983ad4ec2ae3c8.tar.gz
opie-6f807f937764d0b80d38cd5e29983ad4ec2ae3c8.tar.bz2
Just a small example on usage of an Event Filter...
I needed that for debugging but it looks useful as an example
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/big-screen/example/osplitter_mail.cpp12
-rw-r--r--libopie/big-screen/example/osplitter_mail.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/libopie/big-screen/example/osplitter_mail.cpp b/libopie/big-screen/example/osplitter_mail.cpp
index 91442c8..4eaf3a9 100644
--- a/libopie/big-screen/example/osplitter_mail.cpp
+++ b/libopie/big-screen/example/osplitter_mail.cpp
@@ -17,16 +17,17 @@ OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
17class Folder { 17class Folder {
18 int dummy; 18 int dummy;
19}; 19};
20 20
21// ----------------------------------------------------------------- 21// -----------------------------------------------------------------
22 22
23ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) 23ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
24 : QWidget( p, name, fl ) { 24 : QWidget( p, name, fl ) {
25 qApp->installEventFilter( this );
25 m_lstFolders.setAutoDelete( true ); 26 m_lstFolders.setAutoDelete( true );
26 QHBoxLayout *lay = new QHBoxLayout(this); 27 QHBoxLayout *lay = new QHBoxLayout(this);
27 28
28 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); 29 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
29 lay->addWidget( m_splitter ); 30 lay->addWidget( m_splitter );
30 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ), 31 connect(m_splitter, SIGNAL(sizeChange(bool, const QSize& ) ),
31 this, SLOT(slotSizeChange(bool, const QSize& ) ) ); 32 this, SLOT(slotSizeChange(bool, const QSize& ) ) );
32 33
@@ -63,8 +64,19 @@ ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
63 m_splitter->addWidget( splitti ); 64 m_splitter->addWidget( splitti );
64 65
65} 66}
66 67
67 68
68ListViews::~ListViews() { 69ListViews::~ListViews() {
69 70
70} 71}
72
73
74bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
75 if (!obj->isWidgetType() )
76 return false;
77 if ( ev->type() == QEvent::MouseButtonRelease ) {
78 qWarning(" name %s, class %s", obj->name(), obj->className() );
79 }
80
81 return false;
82}
diff --git a/libopie/big-screen/example/osplitter_mail.h b/libopie/big-screen/example/osplitter_mail.h
index d76f264..b7e7efe 100644
--- a/libopie/big-screen/example/osplitter_mail.h
+++ b/libopie/big-screen/example/osplitter_mail.h
@@ -20,16 +20,17 @@ class QLabel;
20class OSplitter; 20class OSplitter;
21class ListViews : public QWidget { 21class ListViews : public QWidget {
22 Q_OBJECT 22 Q_OBJECT
23public: 23public:
24 static QString appName() { return QString::fromLatin1("osplitter-mail"); } 24 static QString appName() { return QString::fromLatin1("osplitter-mail"); }
25 ListViews( QWidget* parent, const char * name, WFlags fl ); 25 ListViews( QWidget* parent, const char * name, WFlags fl );
26 ~ListViews(); 26 ~ListViews();
27 27
28 bool eventFilter( QObject* , QEvent* );
28private: 29private:
29 void initFolders(); 30 void initFolders();
30 void initFolder( Folder *folder, unsigned int &count ); 31 void initFolder( Folder *folder, unsigned int &count );
31 32
32 QListView *m_messages, *m_overview; 33 QListView *m_messages, *m_overview;
33 QLabel *m_message, *m_attach; 34 QLabel *m_message, *m_attach;
34 QList<QListView> m_folders; // used in tab mode 35 QList<QListView> m_folders; // used in tab mode
35 QList<Folder> m_lstFolders; 36 QList<Folder> m_lstFolders;