Falkon Develop
Cross-platform Qt-based web browser
mactoolbutton.cpp
Go to the documentation of this file.
1/* ============================================================
2* Falkon - Qt web browser
3* Copyright (C) 2013-2017 David Rosca <nowrep@gmail.com>
4* Copyright (C) 2013-2014 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
5*
6* This program is free software: you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation, either version 3 of the License, or
9* (at your option) any later version.
10*
11* This program is distributed in the hope that it will be useful,
12* but WITHOUT ANY WARRANTY; without even the implied warranty of
13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14* GNU General Public License for more details.
15*
16* You should have received a copy of the GNU General Public License
17* along with this program. If not, see <http://www.gnu.org/licenses/>.
18* ============================================================ */
19#include "mactoolbutton.h"
20
21#ifdef Q_OS_MACOS
22MacToolButton::MacToolButton(QWidget* parent)
23 : QPushButton(parent)
24 , m_autoRise(false)
25 , m_buttonFixedSize(18, 18)
26{
27}
28
29void MacToolButton::setIconSize(const QSize &size)
30{
31 QPushButton::setIconSize(size);
32 m_buttonFixedSize = QSize(size.width() + 2, size.height() + 2);
33}
34
35void MacToolButton::setAutoRaise(bool enable)
36{
37 m_autoRise = enable;
38 setFlat(enable);
39 if (enable) {
40 setFixedSize(m_buttonFixedSize);
41 }
42}
43
44bool MacToolButton::autoRaise() const
45{
46 return m_autoRise;
47}
48#else
50 : QToolButton(parent)
51{
52}
53#endif
MacToolButton(QWidget *parent=nullptr)