Warning, file /office/calligra/libs/widgets/KoAspectButton.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2007 Thomas Zander <zander@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 #ifndef KOASPECTBUTTON_H
0020 #define KOASPECTBUTTON_H
0021 
0022 #include <QAbstractButton>
0023 
0024 #include "kowidgets_export.h"
0025 
0026 /**
0027  * This button gives a visual indication of weather the 'aspect ratio' is locked.
0028  * Typically you would use this alongside 2 spinboxes with a value like a width and height.
0029  */
0030 class KOWIDGETS_EXPORT KoAspectButton : public QAbstractButton {
0031     Q_OBJECT
0032 public:
0033     /// constructor
0034     explicit KoAspectButton(QWidget *parent);
0035     ~KoAspectButton() override;
0036 
0037     /// Returns of keeping aspect ratio is on or off
0038     bool keepAspectRatio() const;
0039 
0040 public Q_SLOTS:
0041     /**
0042      * Set the visual indicator to be locked or not.
0043      * This also emits the keepAspectRatioChanged if the value has changed.
0044      * @param keep if true, lock the aspect ratio.
0045      */
0046     void setKeepAspectRatio(bool keep);
0047 
0048 Q_SIGNALS:
0049     /**
0050      * This signal is emitted every time the button changes value, either by user interaction or
0051      *  by programatically setting it.
0052      */
0053     void keepAspectRatioChanged(bool keep);
0054 
0055 protected:
0056     /// reimplemented
0057     void mouseReleaseEvent(QMouseEvent *) override;
0058     void paintEvent (QPaintEvent *) override;
0059     QSize sizeHint () const override;
0060     void keyReleaseEvent (QKeyEvent *e) override;
0061 
0062 private:
0063     class Private;
0064     Private * const d;
0065 };
0066 
0067 #endif