~ubuntu-branches/debian/sid/kexi/sid

« back to all changes in this revision

Viewing changes to src/kexiutils/KexiLinkButton.h

  • Committer: Package Import Robot
  • Author(s): Pino Toscano
  • Date: 2017-06-24 20:10:10 UTC
  • Revision ID: package-import@ubuntu.com-20170624201010-5lrzd5r2vwthwifp
Tags: upstream-3.0.1.1
Import upstream version 3.0.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2012 Jarosław Staniek <staniek@kde.org>
 
3
 
 
4
   This program is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This program is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public License for more details.
 
13
 
 
14
   You should have received a copy of the GNU Library General Public License
 
15
   along with this program; see the file COPYING.  If not, write to
 
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 * Boston, MA 02110-1301, USA.
 
18
 */
 
19
 
 
20
#ifndef KEXILINKBUTTON_H
 
21
#define KEXILINKBUTTON_H
 
22
 
 
23
#include "kexiutils_export.h"
 
24
 
 
25
#include <QPushButton>
 
26
 
 
27
class KGuiItem;
 
28
 
 
29
//! A flat icon-based button without background that behaves like a link
 
30
class KEXIUTILS_EXPORT KexiLinkButton : public QPushButton
 
31
{
 
32
    Q_OBJECT
 
33
public:
 
34
    explicit KexiLinkButton(QWidget* parent = 0);
 
35
 
 
36
    explicit KexiLinkButton(const QIcon &icon, QWidget* parent = 0);
 
37
 
 
38
    explicit KexiLinkButton(const KGuiItem &item, QWidget *parent = 0);
 
39
 
 
40
    explicit KexiLinkButton(const QPixmap &pixmap, QWidget* parent = 0);
 
41
 
 
42
    virtual ~KexiLinkButton();
 
43
 
 
44
    /*! If true, foreground color of the current palette is always used for painting
 
45
        the button's icon. This is done by replacing color.
 
46
        The foreground color is QPalette::Text by default, and can be changed
 
47
        using setForegroundRole().
 
48
        The icon is expected to be monochrome.
 
49
        Works well also after palette change.
 
50
        False by default. */
 
51
    void setUsesForegroundColor(bool set);
 
52
 
 
53
    /*! @return true if foreground color of the current palette is always used for painting
 
54
        the button's icon. */
 
55
    bool usesForegroundColor() const;
 
56
 
 
57
    void setIcon(const QIcon &icon);
 
58
 
 
59
protected:
 
60
    virtual void changeEvent(QEvent* event);
 
61
 
 
62
private:
 
63
    void init();
 
64
    void updateIcon(const QIcon &icon);
 
65
 
 
66
    class Private;
 
67
    Private * const d;
 
68
};
 
69
 
 
70
#endif