File indexing completed on 2024-05-19 05:35:25
0001 #ifndef oxygencombobox_datah 0002 #define oxygencombobox_datah 0003 0004 ////////////////////////////////////////////////////////////////////////////// 0005 // oxygencomboboxdata.h 0006 // data container for QComboBox transition 0007 // ------------------- 0008 // 0009 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr> 0010 // 0011 // SPDX-License-Identifier: MIT 0012 ////////////////////////////////////////////////////////////////////////////// 0013 0014 #include "oxygentransitiondata.h" 0015 0016 #include <QBasicTimer> 0017 #include <QComboBox> 0018 #include <QLineEdit> 0019 #include <QString> 0020 #include <QTimerEvent> 0021 0022 namespace Oxygen 0023 { 0024 //* generic data 0025 class ComboBoxData : public TransitionData 0026 { 0027 Q_OBJECT 0028 0029 public: 0030 //* constructor 0031 ComboBoxData(QObject *, QComboBox *, int); 0032 0033 //* event filter 0034 bool eventFilter(QObject *, QEvent *) override; 0035 0036 protected: 0037 //* timer event 0038 void timerEvent(QTimerEvent *) override; 0039 0040 protected Q_SLOTS: 0041 0042 //* initialize animation 0043 bool initializeAnimation(void) override; 0044 0045 //* animate 0046 bool animate(void) override; 0047 0048 private Q_SLOTS: 0049 0050 //* triggered when item is activated in combobox 0051 void indexChanged(void); 0052 0053 //* called when target is destroyed 0054 void targetDestroyed(void); 0055 0056 private: 0057 //* target rect 0058 /** return rect corresponding to the area to be updated when animating */ 0059 QRect targetRect(void) const 0060 { 0061 return _target ? _target.data()->rect().adjusted(5, 5, -5, -5) : QRect(); 0062 } 0063 0064 //* needed to start animations out of parent paintEvent 0065 QBasicTimer _timer; 0066 0067 //* target 0068 WeakPointer<QComboBox> _target; 0069 }; 0070 } 0071 0072 #endif