Warning, file /sdk/ktechlab/src/gui/itemeditor/propertysubeditor.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /***************************************************************************
0002  *   Copyright (C) 2002 by Lucijan Busch <lucijan@gmx.at>                  *
0003  *   Copyright (C) 2006 David Saxton <david@bluehaze.org>                  *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #include "propertysubeditor.h"
0012 #include "propertyeditor.h"
0013 
0014 #include <QDebug>
0015 #include <QKeyEvent>
0016 #include <QVariant>
0017 
0018 PropertySubEditor::PropertySubEditor(QWidget *parent, Property *property)
0019     : QWidget(parent)
0020 {
0021     m_childWidget = nullptr;
0022     m_property = property;
0023     m_leaveTheSpaceForRevertButton = false;
0024 }
0025 
0026 bool PropertySubEditor::eventFilter(QObject * /*watched*/, QEvent *e)
0027 {
0028     if (e->type() == QEvent::KeyPress) // || e->type()==QEvent::AccelOverride)
0029     {
0030         QKeyEvent *ev = static_cast<QKeyEvent *>(e);
0031         PropertyEditor *list = dynamic_cast<PropertyEditor *>(parentWidget()->parentWidget());
0032         if (!list)
0033             return false; // for sanity
0034         return list->handleKeyPress(ev);
0035     }
0036     return false;
0037 }
0038 
0039 void PropertySubEditor::resizeEvent(QResizeEvent *ev)
0040 {
0041     if (m_childWidget) {
0042         m_childWidget->resize(ev->size());
0043     }
0044 }
0045 
0046 void PropertySubEditor::setWidget(QWidget *w, QWidget *focusProxy)
0047 {
0048     if (m_childWidget)
0049         m_childWidget->removeEventFilter(this);
0050 
0051     m_childWidget = w;
0052 
0053     if (!m_childWidget)
0054         return;
0055     if (focusProxy && focusProxy->focusPolicy() != Qt::NoFocus) {
0056         setFocusProxy(focusProxy);
0057         focusProxy->installEventFilter(this);
0058     } else if (m_childWidget->focusPolicy() != Qt::NoFocus)
0059         setFocusProxy(m_childWidget);
0060 
0061     m_childWidget->installEventFilter(this);
0062     //  if (m_childWidget->inherits("QFrame")) {
0063     //      static_cast<QFrame*>(m_childWidget)->setFrameStyle( QFrame::Box | QFrame::Plain );
0064     //  }
0065 }
0066 
0067 PropertySubEditor::~PropertySubEditor()
0068 {
0069 }
0070 
0071 #include "moc_propertysubeditor.cpp"