clean: remove gdappstyle file

fix #516
This commit is contained in:
Xiao YiFang 2023-04-17 23:40:38 +08:00 committed by YiFang Xiao
parent 57e5e707c2
commit e6cd18e1b3
5 changed files with 0 additions and 87 deletions

View file

@ -267,8 +267,6 @@ set(PROJECT_SOURCES
ftshelpers.hh
fulltextsearch.cc
fulltextsearch.hh
gdappstyle.cc
gdappstyle.hh
gddebug.cc
gddebug.hh
german.cc

View file

@ -352,7 +352,6 @@ HEADERS += \
src/common/folding.hh \
src/ftshelpers.hh \
src/fulltextsearch.hh \
src/gdappstyle.hh \
src/gestures.hh \
src/headwordsmodel.hh \
src/history.hh \
@ -474,7 +473,6 @@ SOURCES += \
src/common/folding.cc \
src/ftshelpers.cc \
src/fulltextsearch.cc \
src/gdappstyle.cc \
src/gestures.cc \
src/headwordsmodel.cc \
src/history.cc \

View file

@ -1,52 +0,0 @@
/* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "gdappstyle.hh"
#include "dictionarybar.hh"
#include <QWidget>
#include <QToolButton>
GdAppStyle::GdAppStyle(QProxyStyle * parent) : QProxyStyle(parent) {}
int GdAppStyle::pixelMetric ( PixelMetric metric, const QStyleOption * option, const QWidget * widget) const
{
int defaultVal = QProxyStyle::pixelMetric(metric, option, widget);
if ( dictionaryBarButton( widget ) )
{
if ( metric == QStyle::PM_ButtonShiftVertical || metric == QStyle::PM_ButtonShiftHorizontal )
{
if (option ->state & State_Sunken ) {
return defaultVal;
}
if ( option ->state & State_On ) {
// No shift for for the checked tool buttons on the dictionary bar,
// that's why the whole thing with QProxyStyle is neded, to achieve this.
return 0;
}
}
}
// Qt don't upscale icons for high dpi scales
// We limit maximum small icon size to 21 pixel
// (standard icon size for Lingvo dictionaries)
if( metric == QStyle::PM_SmallIconSize )
return defaultVal < 21 ? defaultVal : 21;
return defaultVal;
}
bool GdAppStyle::dictionaryBarButton(const QWidget * widget) const {
if (widget) {
const QWidget * parent = widget->parentWidget();
if ( parent &&
qobject_cast<const DictionaryBar *>( parent ) &&
qobject_cast<const QToolButton *>( widget ) )
return true;
}
return false;
}

View file

@ -1,30 +0,0 @@
/* This file is (c) 2012 Tvangeste <i.4m.l33t@yandex.ru>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#ifndef GDAPPSTYLE_HH
#define GDAPPSTYLE_HH
#include <QtGlobal>
#include <QStyle>
#include <QProxyStyle>
#include <QStyleOption>
class GdAppStyle : public QProxyStyle
{
Q_OBJECT
public:
explicit GdAppStyle(QProxyStyle *style = 0);
virtual int pixelMetric ( PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const;
signals:
public slots:
private:
/// is this widget a tool button on the dictionary bar?
bool dictionaryBarButton(const QWidget * widget) const;
};
#endif // GDAPPSTYLE_HH

View file

@ -3,7 +3,6 @@
#include <stdio.h>
#include <QIcon>
#include "gdappstyle.hh"
#include "mainwindow.hh"
#include "config.hh"
#include <QWebEngineProfile>