summaryrefslogtreecommitdiffstats
path: root/tools/qtconfig/previewwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qtconfig/previewwidget.cpp')
-rw-r--r--tools/qtconfig/previewwidget.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/tools/qtconfig/previewwidget.cpp b/tools/qtconfig/previewwidget.cpp
index 011ee4e..c9066df 100644
--- a/tools/qtconfig/previewwidget.cpp
+++ b/tools/qtconfig/previewwidget.cpp
@@ -40,32 +40,32 @@
****************************************************************************/
#include "previewwidget.h"
+#include "ui_previewwidget.h"
#include <QtEvents>
QT_BEGIN_NAMESPACE
-PreviewWidget::PreviewWidget( QWidget *parent, const char *name )
- : PreviewWidgetBase( parent, name )
+PreviewWidget::PreviewWidget(QWidget *parent)
+ : QWidget(parent), ui(new Ui::PreviewWidget)
{
+ ui->setupUi(this);
+
// install event filter on child widgets
- QObjectList l = queryList("QWidget");
- for (int i = 0; i < l.size(); ++i) {
- QObject * obj = l.at(i);
- obj->installEventFilter(this);
- ((QWidget*)obj)->setFocusPolicy(Qt::NoFocus);
+ QList<QWidget *> l = findChildren<QWidget *>();
+ foreach(QWidget *w, l) {
+ w->installEventFilter(this);
+ w->setFocusPolicy(Qt::NoFocus);
}
}
-
-void PreviewWidget::closeEvent(QCloseEvent *e)
+PreviewWidget::~PreviewWidget()
{
- e->ignore();
+ delete ui;
}
-
bool PreviewWidget::eventFilter(QObject *, QEvent *e)
{
- switch ( e->type() ) {
+ switch (e->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
case QEvent::MouseButtonDblClick:
@@ -81,4 +81,9 @@ bool PreviewWidget::eventFilter(QObject *, QEvent *e)
return false;
}
+void PreviewWidget::closeEvent(QCloseEvent *e)
+{
+ e->ignore();
+}
+
QT_END_NAMESPACE