mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
macOS; Use transient scrollbars unless they are disabled in system preferences
This commit is contained in:
parent
180c15bcb1
commit
537a27d098
@ -1104,6 +1104,12 @@ class Application(QApplication):
|
||||
pcache[v] = p
|
||||
v = pcache[v]
|
||||
icon_map[getattr(QStyle, 'SP_'+k)] = v
|
||||
transient_scroller = 0
|
||||
if isosx:
|
||||
transient_scroller = plugins['cocoa'][0].transient_scroller()
|
||||
try:
|
||||
self.pi.load_style(icon_map, transient_scroller)
|
||||
except TypeError:
|
||||
self.pi.load_style(icon_map)
|
||||
|
||||
def _send_file_open_events(self):
|
||||
|
@ -138,9 +138,10 @@ class CalibreStyle: public QProxyStyle {
|
||||
QHash<int, QString> icon_map;
|
||||
QByteArray desktop_environment;
|
||||
QDialogButtonBox::ButtonLayout button_layout;
|
||||
int transient_scroller;
|
||||
|
||||
public:
|
||||
CalibreStyle(QStyle *base, QHash<int, QString> icmap) : QProxyStyle(base), icon_map(icmap) {
|
||||
CalibreStyle(QStyle *base, QHash<int, QString> icmap, int transient_scroller) : QProxyStyle(base), icon_map(icmap), transient_scroller(transient_scroller) {
|
||||
setObjectName(QString("calibre"));
|
||||
desktop_environment = detectDesktopEnvironment();
|
||||
button_layout = static_cast<QDialogButtonBox::ButtonLayout>(QProxyStyle::styleHint(SH_DialogButtonLayout));
|
||||
@ -163,6 +164,8 @@ class CalibreStyle: public QProxyStyle {
|
||||
return button_layout;
|
||||
case SH_FormLayoutFieldGrowthPolicy:
|
||||
return QFormLayout::FieldsStayAtSizeHint; // Do not have fields expand to fill all available space in QFormLayout
|
||||
case SH_ScrollBar_Transient:
|
||||
return transient_scroller;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -320,9 +323,9 @@ class CalibreStyle: public QProxyStyle {
|
||||
}
|
||||
};
|
||||
|
||||
int load_style(QHash<int,QString> icon_map) {
|
||||
int load_style(QHash<int,QString> icon_map, int transient_scroller) {
|
||||
QStyle *base_style = QStyleFactory::create(QString("Fusion"));
|
||||
QApplication::setStyle(new CalibreStyle(base_style, icon_map));
|
||||
QApplication::setStyle(new CalibreStyle(base_style, icon_map, transient_scroller));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,6 @@ private:
|
||||
QColor m_dark, m_light;
|
||||
};
|
||||
|
||||
int load_style(QHash<int,QString> icon_map);
|
||||
int load_style(QHash<int,QString> icon_map, int transient_scroller=0);
|
||||
void set_no_activate_on_click(QWidget *widget);
|
||||
void draw_snake_spinner(QPainter &painter, QRect rect, int angle, const QColor & light, const QColor & dark);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
%ModuleHeaderCode
|
||||
#include <QPainter>
|
||||
int load_style(QHash<int,QString> icon_map);
|
||||
int load_style(QHash<int,QString> icon_map, int transient_scroller);
|
||||
void set_no_activate_on_click(QWidget *widget);
|
||||
void draw_snake_spinner(QPainter &painter, QRect rect, int angle, const QColor & light, const QColor & dark);
|
||||
%End
|
||||
@ -55,6 +55,6 @@ protected:
|
||||
|
||||
};
|
||||
|
||||
int load_style(QHash<int,QString> icon_map);
|
||||
int load_style(QHash<int,QString> icon_map, int transient_scroller);
|
||||
void set_no_activate_on_click(QWidget *widget);
|
||||
void draw_snake_spinner(QPainter &painter, QRect rect, int angle, const QColor & light, const QColor & dark);
|
||||
|
Loading…
x
Reference in New Issue
Block a user