File indexing completed on 2024-05-19 04:36:39
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZUI_SLIDER_DOUBLE_SPINBOX_H 0021 #define TIKZUI_SLIDER_DOUBLE_SPINBOX_H 0022 0023 #include "tikzui_export.h" 0024 0025 #include <QDoubleSpinBox> 0026 0027 class SliderDoubleSpinBoxPrivate; 0028 0029 /** 0030 * A modified QSpinBox showing a progress bar instead of an line edit. 0031 */ 0032 class TIKZKITUI_EXPORT SliderDoubleSpinBox : public QDoubleSpinBox 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** 0038 * Default constructor with an optional @p parent widget. 0039 */ 0040 explicit SliderDoubleSpinBox(QWidget * parent = nullptr); 0041 0042 /** 0043 * Virtual destructor. 0044 */ 0045 virtual ~SliderDoubleSpinBox(); 0046 0047 protected: 0048 /** 0049 * Reimplemented to draw progress bar on top of spin box. 0050 */ 0051 void paintEvent(QPaintEvent * event) override; 0052 0053 /** 0054 * Reimplemented, to show the line edit on demand. 0055 */ 0056 void mousePressEvent(QMouseEvent * event) override; 0057 0058 /** 0059 * Reimplemented for internal reasons. 0060 */ 0061 void mouseReleaseEvent(QMouseEvent * event) override; 0062 0063 /** 0064 * Reimplemented, to make the spin box behave as a slider in the main area. 0065 */ 0066 void mouseMoveEvent(QMouseEvent * event) override; 0067 0068 /** 0069 * Reimplemented, to avoid showing a context menu. 0070 */ 0071 void contextMenuEvent(QContextMenuEvent * event) override; 0072 0073 /** 0074 * Reimplemented, to make the spin box behave as a slider in the main area. 0075 */ 0076 void keyPressEvent(QKeyEvent * event) override; 0077 0078 private: 0079 friend SliderDoubleSpinBoxPrivate; 0080 SliderDoubleSpinBoxPrivate * const d; 0081 }; 0082 0083 #endif //TIKZUI_SLIDER_DOUBLE_SPINBOX_H 0084 0085 // kate: indent-width 4; replace-tabs on;