mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
Added 'MacToolButton' as a replacement for QToolButton on Mac
This commit is contained in:
parent
72c66cb218
commit
bb9bccf580
@ -121,7 +121,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<widget class="MacToolButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -132,6 +132,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../data/icons.qrc"/>
|
||||
</resources>
|
||||
|
@ -214,7 +214,8 @@ SOURCES += \
|
||||
autofill/autofillwidget.cpp \
|
||||
tools/menubar.cpp \
|
||||
navigation/navigationcontainer.cpp \
|
||||
tools/horizontallistwidget.cpp
|
||||
tools/horizontallistwidget.cpp \
|
||||
tools/mactoolbutton.cpp
|
||||
|
||||
HEADERS += \
|
||||
webview/tabpreview.h \
|
||||
@ -383,7 +384,8 @@ HEADERS += \
|
||||
autofill/autofillwidget.h \
|
||||
tools/menubar.h \
|
||||
navigation/navigationcontainer.h \
|
||||
tools/horizontallistwidget.h
|
||||
tools/horizontallistwidget.h \
|
||||
tools/mactoolbutton.h
|
||||
|
||||
FORMS += \
|
||||
preferences/autofillmanager.ui \
|
||||
|
@ -21,7 +21,7 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<widget class="MacToolButton" name="closeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -51,7 +51,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="previous">
|
||||
<widget class="MacToolButton" name="previous">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -67,7 +67,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="next">
|
||||
<widget class="MacToolButton" name="next">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -105,6 +105,11 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>FocusSelectLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
|
@ -31,7 +31,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="changeDictPath">
|
||||
<widget class="MacToolButton" name="changeDictPath">
|
||||
<property name="text">
|
||||
<string>Change...</string>
|
||||
</property>
|
||||
@ -123,6 +123,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -165,7 +165,7 @@
|
||||
<widget class="QLineEdit" name="newTabUrl"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="newTabUseCurrent">
|
||||
<widget class="MacToolButton" name="newTabUseCurrent">
|
||||
<property name="text">
|
||||
<string>Use current</string>
|
||||
</property>
|
||||
@ -307,7 +307,7 @@
|
||||
<widget class="QLineEdit" name="homepage"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="useCurrentBut">
|
||||
<widget class="MacToolButton" name="useCurrentBut">
|
||||
<property name="text">
|
||||
<string>Use current</string>
|
||||
</property>
|
||||
@ -952,7 +952,7 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="customColorToolButton">
|
||||
<widget class="MacToolButton" name="customColorToolButton">
|
||||
<property name="toolTip">
|
||||
<string>Select color</string>
|
||||
</property>
|
||||
@ -962,7 +962,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="resetProgressBarcolor">
|
||||
<widget class="MacToolButton" name="resetProgressBarcolor">
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
@ -1307,7 +1307,7 @@
|
||||
<widget class="QLineEdit" name="cachePath"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="changeCachePath">
|
||||
<widget class="MacToolButton" name="changeCachePath">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -1892,7 +1892,7 @@
|
||||
<widget class="QLineEdit" name="downLoc"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="downButt">
|
||||
<widget class="MacToolButton" name="downButt">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -1997,7 +1997,7 @@
|
||||
<widget class="QLineEdit" name="externalDownExecutable"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="chooseExternalDown">
|
||||
<widget class="MacToolButton" name="chooseExternalDown">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -2441,7 +2441,7 @@
|
||||
<widget class="QLineEdit" name="userStyleSheet"/>
|
||||
</item>
|
||||
<item row="11" column="2">
|
||||
<widget class="QToolButton" name="chooseUserStylesheet">
|
||||
<widget class="MacToolButton" name="chooseUserStylesheet">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
@ -2573,6 +2573,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>afterLaunch</tabstop>
|
||||
|
@ -83,7 +83,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<widget class="MacToolButton" name="closeButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -94,6 +94,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="../data/icons.qrc"/>
|
||||
</resources>
|
||||
|
@ -30,7 +30,7 @@
|
||||
<widget class="QLabel" name="label"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<widget class="MacToolButton" name="closeButton">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
@ -50,6 +50,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -78,7 +78,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="close">
|
||||
<widget class="MacToolButton" name="close">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -89,6 +89,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
53
src/lib/tools/mactoolbutton.cpp
Normal file
53
src/lib/tools/mactoolbutton.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2013 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2013 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#include "mactoolbutton.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
MacToolButton::MacToolButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
, m_autoRise(false)
|
||||
, m_buttonFixedSize(18, 18)
|
||||
{
|
||||
}
|
||||
|
||||
void MacToolButton::setIconSize(const QSize &size)
|
||||
{
|
||||
QPushButton::setIconSize(size);
|
||||
m_buttonFixedSize = QSize(size.width()+2, size.height()+2);
|
||||
}
|
||||
|
||||
void MacToolButton::setAutoRaise(bool enable)
|
||||
{
|
||||
m_autoRise = enable;
|
||||
setFlat(enable);
|
||||
if (enable) {
|
||||
setFixedSize(m_buttonFixedSize);
|
||||
}
|
||||
}
|
||||
|
||||
bool MacToolButton::autoRaise() const
|
||||
{
|
||||
return m_autoRise;
|
||||
}
|
||||
#else
|
||||
MacToolButton::MacToolButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
}
|
||||
#endif
|
55
src/lib/tools/mactoolbutton.h
Normal file
55
src/lib/tools/mactoolbutton.h
Normal file
@ -0,0 +1,55 @@
|
||||
/* ============================================================
|
||||
* QupZilla - WebKit based browser
|
||||
* Copyright (C) 2013 David Rosca <nowrep@gmail.com>
|
||||
* Copyright (C) 2013 S. Razi Alavizadeh <s.r.alavizadeh@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
* ============================================================ */
|
||||
#ifndef MACTOOLBUTTON_H
|
||||
#define MACTOOLBUTTON_H
|
||||
|
||||
#include "qz_namespace.h"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
#include <QPushButton>
|
||||
|
||||
class QT_QUPZILLA_EXPORT MacToolButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autoRaise READ autoRaise WRITE setAutoRaise)
|
||||
|
||||
public:
|
||||
explicit MacToolButton(QWidget* parent = 0);
|
||||
|
||||
void setIconSize(const QSize &size);
|
||||
|
||||
void setAutoRaise(bool enable);
|
||||
bool autoRaise() const;
|
||||
|
||||
private:
|
||||
bool m_autoRise;
|
||||
QSize m_buttonFixedSize;
|
||||
};
|
||||
#else
|
||||
#include <QToolButton>
|
||||
|
||||
class QT_QUPZILLA_EXPORT MacToolButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacToolButton(QWidget* parent = 0);
|
||||
};
|
||||
#endif
|
||||
#endif // MACTOOLBUTTON_H
|
@ -18,7 +18,7 @@
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QToolButton" name="closeButton">
|
||||
<widget class="MacToolButton" name="closeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -57,7 +57,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="previous">
|
||||
<widget class="MacToolButton" name="previous">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -70,7 +70,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="next">
|
||||
<widget class="MacToolButton" name="next">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -83,7 +83,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="highligh">
|
||||
<widget class="MacToolButton" name="highligh">
|
||||
<property name="text">
|
||||
<string>Highlight</string>
|
||||
</property>
|
||||
@ -93,7 +93,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="caseSensitive">
|
||||
<widget class="MacToolButton" name="caseSensitive">
|
||||
<property name="text">
|
||||
<string>Case sensitive</string>
|
||||
</property>
|
||||
@ -130,6 +130,11 @@
|
||||
<extends>QLineEdit</extends>
|
||||
<header>focusselectlineedit.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -67,7 +67,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="close">
|
||||
<widget class="MacToolButton" name="close">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
@ -78,6 +78,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>MacToolButton</class>
|
||||
<extends>QToolButton</extends>
|
||||
<header>mactoolbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="greasemonkey.qrc"/>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user