depth: 3
before_install:
- sudo apt-get update -qq
- - sudo apt-get install -qq bsdtar python-dev libpcre3-dev libssl-dev zlib1g-dev libc6-dev libpng12-dev libjpeg-dev libtiff5-dev libmng-dev libcups2-dev libfreetype6-dev libfontconfig1-dev libicu-dev libglib2.0-dev libdbus-1-dev libgtk2.0-dev libgconf2-dev unixodbc-dev libpq-dev libmysqld-dev libaio-dev libsqlite3-dev xorg-dev
+ - sudo apt-get install -qq bsdtar python-dev libpcre3-dev libssl-dev zlib1g-dev libc6-dev libpng12-dev libjpeg-dev libtiff5-dev libmng-dev libcups2-dev libfreetype6-dev libfontconfig1-dev libicu-dev libglib2.0-dev libdbus-1-dev unixodbc-dev libpq-dev libmysqld-dev libaio-dev libsqlite3-dev xorg-dev
- wget https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-linux.zip
- bsdtar xf ninja-linux.zip
before_script:
option(WITH_DBUS "Build dbus support" ON)
add_feature_info(dbus WITH_DBUS "an open source something")
-option(WITH_GTK2 "Build gtk2 support" ON)
-add_feature_info(gtk2 WITH_GTK2 "an open source something")
-
-option(WITH_GCONF2 "Build gconf2 support" ON)
-add_feature_info(gconf2 WITH_GCONF2 "an open source something")
-
option(WITH_FREETYPE "Build freetype2 support" ON)
add_feature_info(freetype2 WITH_FREETYPE "an open source something")
TYPE RECOMMENDED
)
-find_package(GTK2)
-set_package_properties(GTK2 PROPERTIES
- PURPOSE "Required for GTK style and application integration support"
- DESCRIPTION "Multi-platform toolkit for creating graphical user interfaces"
- URL "http://www.gtk.org"
- TYPE RECOMMENDED
-)
-
-find_package(GConf2)
-set_package_properties(GConf2 PROPERTIES
- PURPOSE "Required for GTK style and application integration support"
- DESCRIPTION "System for storing application preferences"
- URL "https://projects.gnome.org/gconf/"
- TYPE RECOMMENDED
-)
-
find_package(ODBC)
set_package_properties(ODBC PROPERTIES
PURPOSE "Required for ODBC database support"
katie_definition(-DQT_NO_IMAGEFORMAT_TIFF)
endif()
-if(NOT WITH_GCONF2 OR NOT GCONF2_FOUND)
- katie_definition(-DQT_NO_GCONF2)
-endif()
-
if(NOT WITH_RESOLV OR NOT RESOLV_FOUND)
katie_definition(-DQT_NO_RESOLV)
endif()
+++ /dev/null
-# - Try to find GConf2
-# Once done this will define
-#
-# GCONF2_FOUND - system has GConf2
-# GCONF2_INCLUDES - the GConf2 include directory
-# GCONF2_LIBRARIES - The libraries needed to use GConf2
-#
-# Copyright (c) 2016, Ivailo Monev, <xakepa10@gmail.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-
-if(GCONF2_INCLUDES AND GCONF2_LIBRARIES)
- set(GCONF2_FIND_QUIETLY TRUE)
-endif()
-
-if(NOT WIN32)
- include(FindPkgConfig)
- pkg_check_modules(PC_GCONF2 QUIET gconf-2.0)
-endif()
-
-find_path(GCONF2_INCLUDES
- NAMES
- gconf/gconf.h
- PATH_SUFFIXES gconf/2
- HINTS
- $ENV{GCONF2DIR}/include
- ${PC_GCONF2_INCLUDEDIR}
- ${INCLUDE_INSTALL_DIR}
-)
-
-find_library(GCONF2_LIBRARIES
- gconf-2
- HINTS
- $ENV{GCONF2DIR}/lib
- ${PC_GCONF2_LIBDIR}
- ${LIB_INSTALL_DIR}
-)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(GConf2
- VERSION_VAR PC_GCONF2_VERSION
- REQUIRED_VARS GCONF2_LIBRARIES GCONF2_INCLUDES
-)
-
-mark_as_advanced(GCONF2_INCLUDES GCONF2_LIBRARIES)
arch=('i686' 'x86_64')
url='https://github.com/fluxer/katie'
license=('LGPL' 'FDL' 'custom')
-depends=('openssl' 'zlib' 'cups' 'gtk2' 'libice' 'icu' 'libsm' 'pcre' 'gconf'
- 'libxcursor' 'libxext' 'libxfixes' 'libxi' 'libxinerama' 'libxrandr'
- 'libxrender' 'libx11' 'fontconfig' 'freetype2' 'glib2' 'libmng')
+depends=('openssl' 'zlib' 'cups' 'libice' 'icu' 'libsm' 'pcre' 'libxcursor'
+ 'libxext' 'libxfixes' 'libxi' 'libxinerama' 'libxrandr' 'libxrender'
+ 'libx11' 'fontconfig' 'freetype2' 'glib2' 'libmng')
makedepends=('cmake' 'git' 'python' 'postgresql' 'mariadb' 'unixodbc'
'unifdef')
optdepends=('postgresql-libs: PostgreSQL driver'
Build-Depends: debhelper (>= 9~), g++, python-dev (>= 2.7~), libssl-dev,
zlib1g-dev, libc6-dev, libpng12-dev, libjpeg-dev, libtiff5-dev, libmng-dev,
libcups2-dev, libfreetype6-dev, libfontconfig1-dev, libicu-dev, libpcre3-dev,
- libglib2.0-dev, libdbus-1-dev, libgtk2.0-dev, libgconf2-dev, unixodbc-dev,
- libpq-dev, libmysqld-dev, libsqlite3-dev, libaio-dev, xorg-dev, cmake, git
+ libglib2.0-dev, libdbus-1-dev, unixodbc-dev, libpq-dev, libmysqld-dev,
+ libsqlite3-dev, libaio-dev, xorg-dev, cmake, git
Package: katie-git
Architecture: i386 amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, openssl, zlib1g, libc6, libpng12,
libjpeg, libtiffxx5, libmng1, libcups2, libfreetype6, libfontconfig1,
- libpcre3, libicu52, libglib2.0, libdbus-1, libgtk2.0, libgconf2, libsqlite3
+ libpcre3, libicu52, libglib2.0, libdbus-1, libsqlite3
Recommends: unixodbc, libpq5, libmysqlclient18, xorg
Description: C++ toolkit derived from the Qt 4.8 framework
#define QT_NO_STYLE_WINDOWSVISTA
#define QT_NO_STYLE_MAC
#define QT_NO_STYLE_S60
+#define QT_NO_STYLE_GTK
+#define QT_NO_STYLE_QGTK
#define QT_NO_STATEMACHINE
#define QT_NO_XKB
#define QT_NO_XIM
#define QT_NO_OPENGL
#define QT_NO_TABLET
#define QT_NO_TABLETEVENT
+#define QT_NO_GCONF2
/* Qt build specs */
#ifndef QT_EDITION
#cmakedefine QT_NO_FSCOMPLETER
#cmakedefine QT_NO_FSFILEENGINE
#cmakedefine QT_NO_FTP
-#cmakedefine QT_NO_GCONF2
#cmakedefine QT_NO_GEOM_VARIANT
#cmakedefine QT_NO_GESTURES
#cmakedefine QT_NO_GETADDRINFO
#cmakedefine QT_NO_STRINGLISTMODEL
#cmakedefine QT_NO_STYLE_CDE
#cmakedefine QT_NO_STYLE_CLEANLOOKS
-#cmakedefine QT_NO_STYLE_GTK
-#cmakedefine QT_NO_STYLE_MAC
#cmakedefine QT_NO_STYLE_MOTIF
#cmakedefine QT_NO_STYLE_PLASTIQUE
#cmakedefine QT_NO_STYLE_PROXY
-#cmakedefine QT_NO_STYLE_QGTK
#cmakedefine QT_NO_STYLE_STYLESHEET
#cmakedefine QT_NO_STYLE_WINDOWS
#cmakedefine QT_NO_SVG
QGraphicsWidget
QGridLayout
QGroupBox
- QGtkStyle
QHeaderView
QIcon
QIconDragEvent
#include <qwindowsstyle.h>
#endif
#include <qshortcut.h>
-#ifdef Q_WS_MAC
-#include <qmacstyle_mac.h>
-#endif
QT_END_INCLUDE_NAMESPACE
/*!
Q_Q(QFileDialog);
model = new QFileSystemModel(q);
model->setObjectName(QLatin1String("qt_filesystem_model"));
-#ifdef Q_WS_MAC
- model->setNameFilterDisables(true);
-#else
model->setNameFilterDisables(false);
-#endif
model->d_func()->disableRecursiveSort = true;
QFileDialog::connect(model, SIGNAL(fileRenamed(QString,QString,QString)), q, SLOT(_q_fileRenamed(QString,QString,QString)));
QFileDialog::connect(model, SIGNAL(rootPathChanged(QString)),
By default, QWizard uses the AeroStyle on a Windows Vista system with alpha compositing
enabled, regardless of the current widget style. If this is not the case, the default
- wizard style depends on the current widget style as follows: MacStyle is the default if
- the current widget style is QMacStyle, ModernStyle is the default if the current widget
- style is QWindowsStyle, and ClassicStyle is the default in all other cases.
+ wizard style depends on the current widget style as follows: ModernStyle is the default
+ if the current widget style is QWindowsStyle, and ClassicStyle is the default in all
+ other cases.
\sa {Wizard Look and Feel}, options
*/
#include <QtGui/qgraphicsscene.h>
#include <QtGui/qstyleoption.h>
#include <QtGui/qgraphicssceneevent.h>
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
-# include <QMacStyle>
-#endif
QT_BEGIN_NAMESPACE
qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options) const
{
Q_Q(const QGraphicsWidget);
- int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle*>(q->style())) {
- height -=4;
- }
-#endif
+ const int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options);
return (qreal)height;
}
#include <qfunctions_p.h>
#include <qguiplatformplugin_p.h>
-#if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK)
-# include <qgtkstyle_p.h>
-# include <qt_x11_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
/*!
if (!platformIcon.isNull())
return platformIcon;
-#if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK)
- if (X11->desktopEnvironment == DE_GNOME) {
- QIcon gtkIcon = QGtkStylePrivate::getFilesystemIcon(info);
- if (!gtkIcon.isNull())
- return gtkIcon;
- }
-#endif
-
if (info.isRoot())
return d->getIcon(QStyle::SP_DriveHDIcon);
if (info.isFile()) {
#include "qdebug.h"
#include "qcursor_p.h"
#include "qiconloader_p.h"
-#include "qgtkstyle.h"
#include "qstyle.h"
#include "qmetaobject.h"
#include "qtimer.h"
}
// ### Fix properly for 4.6
- bool usingGtkSettings = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle");
- if (!usingGtkSettings) {
- if (groupCount == QPalette::NColorGroups)
+ if (groupCount == QPalette::NColorGroups)
QApplicationPrivate::setSystemPalette(pal);
- }
if (!appFont) {
// ### Fix properly for 4.6
- if (!usingGtkSettings) {
- QFont font(QApplication::font());
- QString fontDescription;
- // Override Qt font if KDE4 settings can be used
- if (X11->desktopVersion == 4) {
- QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
- fontDescription = kdeSettings.value(QLatin1String("font")).toString();
- if (fontDescription.isEmpty()) {
- // KDE stores fonts without quotes
- fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
- }
- }
- if (fontDescription.isEmpty())
- fontDescription = settings.value(QLatin1String("font")).toString();
- if (!fontDescription .isEmpty()) {
- font.fromString(fontDescription );
- QApplicationPrivate::setSystemFont(font);
+ QFont font(QApplication::font());
+ QString fontDescription;
+ // Override Qt font if KDE4 settings can be used
+ if (X11->desktopVersion == 4) {
+ QSettings kdeSettings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat);
+ fontDescription = kdeSettings.value(QLatin1String("font")).toString();
+ if (fontDescription.isEmpty()) {
+ // KDE stores fonts without quotes
+ fontDescription = kdeSettings.value(QLatin1String("font")).toStringList().join(QLatin1String(","));
}
}
+ if (fontDescription.isEmpty())
+ fontDescription = settings.value(QLatin1String("font")).toString();
+ if (!fontDescription .isEmpty()) {
+ font.fromString(fontDescription );
+ QApplicationPrivate::setSystemFont(font);
+ }
}
// read library (ie. plugin) path list
QApplicationPrivate::setSystemFont(fnt);
}
- // QGtkStyle sets it's own system palette
- bool gtkStyle = QApplicationPrivate::app_style && QApplicationPrivate::app_style->inherits("QGtkStyle");
+ // KDE sets it's own system palette
bool kdeColors = (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE);
- if (!gtkStyle && (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty()))) {// set app colors
+ if (kdeColors || (button || !resBG.isEmpty() || !resFG.isEmpty())) {// set app colors
bool allowX11ColorNames = QColor::allowX11ColorNames();
QColor::setAllowX11ColorNames(true);
if (data)
XFree((char *)data);
-#if !defined(QT_NO_STYLE_GTK)
- if (X11->desktopEnvironment == DE_GNOME) {
- static bool menusHaveIcons = QGtkStyle::getGConfBool(QLatin1String("/desktop/gnome/interface/menus_have_icons"), true);
- QApplication::setAttribute(Qt::AA_DontShowIconsInMenus, !menusHaveIcons);
- }
-#endif
qt_set_input_encoding();
qt_set_x11_resources(appFont, appFGCol, appBGCol, appBTNCol);
\table
\header
\o QCommonStyle derived styles (except QPlastiqueStyle)
- \o QMacStyle
\o QPlastiqueStyle
\o Qt Extended styles
\row
The form styles can be also be overridden individually by calling
setLabelAlignment(), setFormAlignment(), setFieldGrowthPolicy(),
- and setRowWrapPolicy(). For example, to simulate the form layout
- appearance of QMacStyle on all platforms, but with left-aligned
- labels, you could write:
-
- \snippet doc/src/snippets/code/src_gui_kernel_qformlayout.cpp 2
+ and setRowWrapPolicy().
\sa QGridLayout, QBoxLayout, QStackedLayout
*/
\value FieldsStayAtSizeHint
The fields never grow beyond their
- \l{QWidgetItem::sizeHint()}{effective size hint}. This is
- the default for QMacStyle.
+ \l{QWidgetItem::sizeHint()}{effective size hint}.
\value ExpandingFieldsGrow
Fields with an horizontal \l{QSizePolicy}{size policy} of
\value DontWrapRows
Fields are always laid out next to their label. This is
- the default policy for all styles except Qt Extended styles
- and QS60Style.
+ the default policy for all styles except Qt Extended styles.
\value WrapLongRows
Labels are given enough horizontal space to fit the widest label,
and the rest of the space is given to the fields. If the minimum
size of a field pair is wider than the available space, the field
is wrapped to the next line. This is the default policy for
- Qt Extended styles and and QS60Style.
+ Qt Extended styles.
\value WrapAllRows
Fields are always laid out below their label.
\brief the way in which the form's fields grow
The default value depends on the widget or application style. For
- QMacStyle, the default is FieldsStayAtSizeHint; for QCommonStyle
- derived styles (like Plastique and Windows), the default
- is ExpandingFieldsGrow; for Qt Extended styles, the default is
- AllNonFixedFieldsGrow.
+ QCommonStyle derived styles (like Plastique and Windows), the
+ default is ExpandingFieldsGrow; for Qt Extended styles, the
+ default is AllNonFixedFieldsGrow.
If none of the fields can grow and the form is resized, extra
space is distributed according to the current
\brief the way in which the form's rows wrap
The default value depends on the widget or application style. For
- Qt Extended styles and QS60Style, the default is WrapLongRows;
- for the other styles, the default is DontWrapRows.
+ Qt Extended styles, the default is WrapLongRows; for the other
+ styles, the default is DontWrapRows.
If you want to display each label above its associated field
(instead of next to it), set this property to WrapAllRows.
\property QFormLayout::formAlignment
\brief the alignment of the form layout's contents within the layout's geometry
- The default value depends on the widget or application style. For
- QMacStyle, the default is Qt::AlignHCenter | Qt::AlignTop; for the
- other styles, the default is Qt::AlignLeft | Qt::AlignTop.
+ The default value depends on the widget or application style. The
+ default is Qt::AlignLeft | Qt::AlignTop.
\sa labelAlignment, rowWrapPolicy
*/
#if defined(Q_WS_X11)
#include <qkde_p.h>
-#include <qgtkstyle_p.h>
#include <qt_x11_p.h>
#endif
stylename = QKde::kdeStyle();
break;
case DE_GNOME: {
- QStringList availableStyles = QStyleFactory::keys();
- // Set QGtkStyle for GNOME if available
- QString gtkStyleKey = QString::fromLatin1("GTK+");
- if (availableStyles.contains(gtkStyleKey)) {
- stylename = gtkStyleKey;
- break;
- }
if (X11->use_xrender)
stylename = QLatin1String("cleanlooks");
else
QString result;
#ifdef Q_WS_X11
if (X11->desktopEnvironment == DE_GNOME) {
-#ifndef QT_NO_STYLE_GTK
- result = QGtkStylePrivate::getIconThemeName();
-#endif
if (result.isEmpty()) {
result = QString::fromLatin1("gnome");
}
size policy applies to \a type.
The control type specifies the type of the widget for which this
- size policy applies. It is used by some styles, notably
- QMacStyle, to insert proper spacing between widgets. For example,
- the Mac OS X Aqua guidelines specify that push buttons should be
- separated by 12 pixels, whereas vertically stacked radio buttons
- only require 6 pixels.
+ size policy applies. It is used by some styles to insert proper
+ spacing between widgets.
\sa QStyle::layoutSpacing()
*/
Q_ASSERT(painter);
if (brush.style() == Qt::TexturePattern) {
-#ifdef Q_WS_MAC
- // Optimize pattern filling on mac by using HITheme directly
- // when filling with the standard widget background.
- // Defined in qmacstyle_mac.cpp
- extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
- qt_mac_fill_background(painter, rgn, brush);
-#else
- {
- const QRect rect(rgn.boundingRect());
- painter->setClipRegion(rgn);
- painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
- }
-#endif // Q_WS_MAC
+ const QRect rect(rgn.boundingRect());
+ painter->setClipRegion(rgn);
+ painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
} else if (brush.gradient()
&& brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
drawPrimitive() which are documented here.
\img qcdestyle.png
- \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QPlastiqueStyle, QMotifStyle
+ \sa QWindowsStyle, QPlastiqueStyle, QMotifStyle
*/
/*!
that closely resembles the Clearlooks style, introduced by Richard
Stellingwerff and Daniel Borgmann.
- \sa {Cleanlooks Style Widget Gallery}, QWindowsXPStyle, QMacStyle, QWindowsStyle,
- QCDEStyle, QMotifStyle, QPlastiqueStyle
+ \sa {Cleanlooks Style Widget Gallery}, QWindowsStyle, QCDEStyle, QMotifStyle,
+ QPlastiqueStyle
*/
/*!
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgtkpainter_p.h"
-
-#include <QtCore/qglobal.h>
-#if !defined(QT_NO_STYLE_GTK)
-
-// This class is primarily a wrapper around the gtk painter functions
-// and takes care of converting all such calls into cached Qt pixmaps.
-
-#include <qstylehelper_p.h>
-#include <QtGui/QWidget>
-#include <QtGui/QStyleOption>
-#include <QtGui/QPixmapCache>
-
-QT_BEGIN_NAMESPACE
-
-#undef GTK_OBJECT_FLAGS
-#define GTK_OBJECT_FLAGS(obj)(((GtkObject*)(obj))->flags)
-
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-# define QT_RED 3
-# define QT_GREEN 2
-# define QT_BLUE 1
-# define QT_ALPHA 0
-#else
-# define QT_RED 0
-# define QT_GREEN 1
-# define QT_BLUE 2
-# define QT_ALPHA 3
-#endif
-# define GTK_RED 2
-# define GTK_GREEN 1
-# define GTK_BLUE 0
-# define GTK_ALPHA 3
-
-// To recover alpha we apply the gtk painting function two times to
-// white, and black window backgrounds. This can be used to
-// recover the premultiplied alpha channel
-QPixmap QGtkPainter::renderTheme(uchar *bdata, uchar *wdata, const QRect &rect)
-{
- const int bytecount = rect.width() * rect.height() * 4;
- for (int index = 0; index < bytecount ; index += 4) {
- uchar val = bdata[index + GTK_BLUE];
- if (m_alpha) {
- int alphaval = qMax(bdata[index + GTK_BLUE] - wdata[index + GTK_BLUE],
- bdata[index + GTK_GREEN] - wdata[index + GTK_GREEN]);
- alphaval = qMax(alphaval, bdata[index + GTK_RED] - wdata[index + GTK_RED]) + 255;
- bdata[index + QT_ALPHA] = alphaval;
- }
- bdata[index + QT_RED] = bdata[index + GTK_RED];
- bdata[index + QT_GREEN] = bdata[index + GTK_GREEN];
- bdata[index + QT_BLUE] = val;
- }
- QImage converted((const uchar*)bdata, rect.width(), rect.height(), m_alpha ?
- QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);
-
- if (m_hflipped || m_vflipped) {
- return QPixmap::fromImage(converted.mirrored(m_hflipped, m_vflipped));
- } else {
- // on raster graphicssystem we need to do a copy here, because
- // we intend to deallocate the qimage bits shortly after...
- return QPixmap::fromImage(converted.copy());
- }
-}
-
-// This macro is responsible for painting any GtkStyle painting function onto a QPixmap
-#define DRAW_TO_CACHE(draw_func) \
- if (rect.width() > QWIDGETSIZE_MAX || rect.height() > QWIDGETSIZE_MAX) \
- return; \
- QRect pixmapRect(0, 0, rect.width(), rect.height()); \
- { \
- GdkPixmap *pixmap = gdk_pixmap_new((GdkDrawable*)(m_window->window), \
- rect.width(), rect.height(), -1); \
- if (!pixmap) \
- return; \
- style = gtk_style_attach (style, m_window->window); \
- gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true, \
- 0, 0, rect.width(), rect.height()); \
- draw_func; \
- GdkPixbuf *imgb = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\
- if (!imgb) \
- return; \
- imgb = gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0, \
- rect.width(), rect.height()); \
- uchar* bdata = (uchar*)gdk_pixbuf_get_pixels(imgb); \
- if (m_alpha) { \
- gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height()); \
- draw_func; \
- GdkPixbuf *imgw = gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect. \
- width(), rect.height()); \
- if (!imgw) \
- return; \
- imgw = gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0, \
- rect.width(), rect.height()); \
- uchar* wdata = (uchar*)gdk_pixbuf_get_pixels(imgw); \
- cache = renderTheme(bdata, wdata, rect); \
- g_object_unref(imgw); \
- } else { \
- cache = renderTheme(bdata, 0, rect); \
- } \
- gdk_drawable_unref(pixmap); \
- g_object_unref(imgb); \
- }
-
-QGtkPainter::QGtkPainter(QPainter *_painter)
- : m_window(QGtkStylePrivate::gtkWidget(QLS("GtkWindow")))
- , m_painter(_painter)
- , m_alpha(true)
- , m_hflipped(false)
- , m_vflipped(false)
- , m_usePixmapCache(true)
-{}
-
-
-static QString uniqueName(const QString &key, GtkStateType state, GtkShadowType shadow,
- const QSize &size, GtkWidget *widget = 0)
-{
- // Note the widget arg should ideally use the widget path, though would compromise performance
- QString tmp = key
- % HexString<uint>(state)
- % HexString<uint>(shadow)
- % HexString<uint>(size.width())
- % HexString<uint>(size.height())
- % HexString<quint64>(quint64(widget));
- return tmp;
-}
-
-
-GtkStateType QGtkPainter::gtkState(const QStyleOption *option)
-
-{
- GtkStateType state = GTK_STATE_NORMAL;
- if (!(option->state & QStyle::State_Enabled))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & QStyle::State_MouseOver)
- state = GTK_STATE_PRELIGHT;
-
- return state;
-}
-
-
-GtkStyle* QGtkPainter::getStyle(GtkWidget *gtkWidget)
-
-{
- Q_ASSERT(gtkWidget);
- GtkStyle* style = gtkWidget->style;
- Q_ASSERT(style);
- return style;
-}
-
-QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size)
-{
- GtkStyle *style = QGtkStylePrivate::gtkStyle();
- GtkIconSet* iconSet = gtk_icon_factory_lookup_default (iconName);
- GdkPixbuf* icon = gtk_icon_set_render_icon(iconSet,
- style,
- GTK_TEXT_DIR_LTR,
- GTK_STATE_NORMAL,
- size,
- NULL,
- "button");
- uchar* data = (uchar*)gdk_pixbuf_get_pixels(icon);
- int width = gdk_pixbuf_get_width(icon);
- int height = gdk_pixbuf_get_height(icon);
- QImage converted(width, height, QImage::Format_ARGB32);
- uchar* tdata = (uchar*)converted.bits();
-
- for ( int index = 0 ; index < height * width*4 ; index +=4 ) {
- //int index = y * rowstride + x;
- tdata[index + QT_RED] = data[index + GTK_RED];
- tdata[index + QT_GREEN] = data[index + GTK_GREEN];
- tdata[index + QT_BLUE] = data[index + GTK_BLUE];
- tdata[index + QT_ALPHA] = data[index + GTK_ALPHA];
- }
-
- g_object_unref(icon);
-
- // should we free iconset?
- return QPixmap::fromImage(converted);
-
-}
-
-// Note currently painted without alpha for performance reasons
-void QGtkPainter::paintBoxGap(GtkWidget *gtkWidget, const gchar* part,
- const QRect &paintRect, GtkStateType state,
- GtkShadowType shadow, GtkPositionType gap_side,
- gint x, gint width,
- GtkStyle *style)
-{
- if (!paintRect.isValid())
- return;
-
- QPixmap cache;
- QRect rect = paintRect;
-
- // To avoid exhausting cache on large tabframes we cheat a bit by
- // tiling the center part.
-
- const int maxHeight = 256;
- const int border = 16;
- if (rect.height() > maxHeight && (gap_side == GTK_POS_TOP || gap_side == GTK_POS_BOTTOM))
- rect.setHeight(2 * border + 1);
-
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget)
- % HexString<uchar>(gap_side)
- % HexString<gint>(width)
- % HexString<gint>(x);
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_box_gap (style,
- pixmap,
- state,
- shadow,
- NULL,
- gtkWidget,
- (gchar*)part,
- 0, 0,
- rect.width(),
- rect.height(),
- gap_side,
- x,
- width));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- if (rect.size() != paintRect.size()) {
- // We assume we can stretch the middle tab part
- // Note: the side effect of this is that pinstripe patterns will get fuzzy
- const QSize size = cache.size();
- // top part
- m_painter->drawPixmap(QRect(paintRect.left(), paintRect.top(),
- paintRect.width(), border), cache,
- QRect(0, 0, size.width(), border));
-
- // tiled center part
- QPixmap tilePart(cache.width(), 1);
- QPainter scanLinePainter(&tilePart);
- scanLinePainter.drawPixmap(QRect(0, 0, tilePart.width(), tilePart.height()), cache, QRect(0, border, size.width(), 1));
- scanLinePainter.end();
- m_painter->drawTiledPixmap(QRect(paintRect.left(), paintRect.top() + border,
- paintRect.width(), paintRect.height() - 2*border), tilePart);
-
- // bottom part
- m_painter->drawPixmap(QRect(paintRect.left(), paintRect.top() + paintRect.height() - border,
- paintRect.width(), border), cache,
- QRect(0, size.height() - border, size.width(), border));
- } else
- m_painter->drawPixmap(paintRect.topLeft(), cache);
-}
-
-void QGtkPainter::paintBox(GtkWidget *gtkWidget, const gchar* part,
- const QRect &paintRect, GtkStateType state,
- GtkShadowType shadow, GtkStyle *style,
- const QString &pmKey)
-{
- if (!paintRect.isValid())
- return;
-
- QPixmap cache;
- QRect rect = paintRect;
-
- // To avoid exhausting cache on large tabframes we cheat a bit by
- // tiling the center part.
-
- const int maxHeight = 256;
- const int maxArea = 256*512;
- const int border = 32;
- if (rect.height() > maxHeight && (rect.width()*rect.height() > maxArea))
- rect.setHeight(2 * border + 1);
-
- QString pixmapName = uniqueName(QLS(part), state, shadow,
- rect.size(), gtkWidget) % pmKey;
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_box (style,
- pixmap,
- state,
- shadow,
- NULL,
- gtkWidget,
- part,
- 0, 0,
- rect.width(),
- rect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- if (rect.size() != paintRect.size()) {
- // We assume we can stretch the middle tab part
- // Note: the side effect of this is that pinstripe patterns will get fuzzy
- const QSize size = cache.size();
- // top part
- m_painter->drawPixmap(QRect(paintRect.left(), paintRect.top(),
- paintRect.width(), border), cache,
- QRect(0, 0, size.width(), border));
-
- // tiled center part
- QPixmap tilePart(cache.width(), 1);
- QPainter scanLinePainter(&tilePart);
- scanLinePainter.drawPixmap(QRect(0, 0, tilePart.width(), tilePart.height()), cache, QRect(0, border, size.width(), 1));
- scanLinePainter.end();
- m_painter->drawTiledPixmap(QRect(paintRect.left(), paintRect.top() + border,
- paintRect.width(), paintRect.height() - 2*border), tilePart);
-
- // bottom part
- m_painter->drawPixmap(QRect(paintRect.left(), paintRect.top() + paintRect.height() - border,
- paintRect.width(), border), cache,
- QRect(0, size.height() - border, size.width(), border));
- } else
- m_painter->drawPixmap(paintRect.topLeft(), cache);
-}
-
-void QGtkPainter::paintHline(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkStyle *style, int x1, int x2, int y,
- const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget)
- % HexString<int>(x1)
- % HexString<int>(x2)
- % HexString<int>(y)
- % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_hline (style,
- pixmap,
- state,
- NULL,
- gtkWidget,
- part,
- x1, x2, y));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintVline(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkStyle *style, int y1, int y2, int x,
- const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget)
- % HexString<int>(y1)
- % HexString<int>(y2)
- % HexString<int>(x)
- % pmKey;
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_vline (style,
- pixmap,
- state,
- NULL,
- gtkWidget,
- part,
- y1, y2,
- x));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintExpander(GtkWidget *gtkWidget,
- const gchar* part, const QRect &rect,
- GtkStateType state, GtkExpanderStyle expander_state,
- GtkStyle *style, const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget)
- % HexString<uchar>(expander_state)
- % pmKey;
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_expander (style, pixmap,
- state, NULL,
- gtkWidget, part,
- rect.width()/2,
- rect.height()/2,
- expander_state));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintFocus(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkStyle *style, const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_focus (style, pixmap, state, NULL,
- gtkWidget,
- part,
- 0, 0,
- rect.width(),
- rect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintResizeGrip(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkShadowType shadow, GdkWindowEdge edge,
- GtkStyle *style, const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_resize_grip (style, pixmap, state,
- NULL, gtkWidget,
- part, edge, 0, 0,
- rect.width(),
- rect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintArrow(GtkWidget *gtkWidget, const gchar* part,
- const QRect &arrowrect, GtkArrowType arrow_type,
- GtkStateType state, GtkShadowType shadow,
- gboolean fill, GtkStyle *style, const QString &pmKey)
-{
- QRect rect = m_cliprect.isValid() ? m_cliprect : arrowrect;
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size())
- % HexString<uchar>(arrow_type)
- % pmKey;
-
- GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
- int xOffset = m_cliprect.isValid() ? arrowrect.x() - m_cliprect.x() : 0;
- int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_arrow (style, pixmap, state, shadow,
- >kCliprect,
- gtkWidget,
- part,
- arrow_type, fill,
- xOffset, yOffset,
- arrowrect.width(),
- arrowrect.height()))
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow,
- GtkOrientation orientation, GtkStyle *style)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size())
- % HexString<uchar>(orientation);
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_handle (style,
- pixmap,
- state,
- shadow,
- NULL,
- gtkWidget,
- part, 0, 0,
- rect.width(),
- rect.height(),
- orientation));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, GtkOrientation orientation,
- const QString &pmKey)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_slider (style,
- pixmap,
- state,
- shadow,
- NULL,
- gtkWidget,
- part,
- 0, 0,
- rect.width(),
- rect.height(),
- orientation));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-
-void QGtkPainter::paintShadow(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkShadowType shadow, GtkStyle *style,
- const QString &pmKey)
-
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_shadow(style, pixmap, state, shadow, NULL,
- gtkWidget, part, 0, 0, rect.width(), rect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintFlatBox(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state,
- GtkShadowType shadow, GtkStyle *style,
- const QString &pmKey)
-{
- if (!rect.isValid())
- return;
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_flat_box (style,
- pixmap,
- state,
- shadow,
- NULL,
- gtkWidget,
- part, 0, 0,
- rect.width(),
- rect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintExtention(GtkWidget *gtkWidget,
- const gchar *part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow,
- GtkPositionType gap_pos, GtkStyle *style)
-{
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget)
- % HexString<uchar>(gap_pos);
-
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_extension (style, pixmap, state, shadow,
- NULL, gtkWidget,
- (gchar*)part, 0, 0,
- rect.width(),
- rect.height(),
- gap_pos));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintOption(GtkWidget *gtkWidget, const QRect &radiorect,
- GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, const QString &detail)
-
-{
- QRect rect = m_cliprect.isValid() ? m_cliprect : radiorect;
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(detail, state, shadow, rect.size());
- GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
- int xOffset = m_cliprect.isValid() ? radiorect.x() - m_cliprect.x() : 0;
- int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_option(style, pixmap,
- state, shadow,
- >kCliprect,
- gtkWidget,
- detail.toLatin1(),
- xOffset, yOffset,
- radiorect.width(),
- radiorect.height()));
-
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-void QGtkPainter::paintCheckbox(GtkWidget *gtkWidget, const QRect &checkrect,
- GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, const QString &detail)
-
-{
- QRect rect = m_cliprect.isValid() ? m_cliprect : checkrect;
- if (!rect.isValid())
- return;
-
- QPixmap cache;
- QString pixmapName = uniqueName(detail, state, shadow, rect.size());
- GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()};
- int xOffset = m_cliprect.isValid() ? checkrect.x() - m_cliprect.x() : 0;
- int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0;
- if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
- DRAW_TO_CACHE(gtk_paint_check (style,
- pixmap,
- state,
- shadow,
- >kCliprect,
- gtkWidget,
- detail.toLatin1(),
- xOffset, yOffset,
- checkrect.width(),
- checkrect.height()));
- if (m_usePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
- }
-
- m_painter->drawPixmap(rect.topLeft(), cache);
-}
-
-QT_END_NAMESPACE
-
-#endif //!defined(QT_NO_STYLE_GTK)
-
-
-
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGTKPAINTER_H
-#define QGTKPAINTER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-#if !defined(QT_NO_STYLE_GTK)
-
-#include <QtGui/QCleanlooksStyle>
-#include <QtGui/QPainter>
-#include <QtGui/QPalette>
-#include <QtGui/QFont>
-#include <qgtkstyle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGtkPainter
-{
-public:
- QGtkPainter(QPainter *painter);
- GtkStyle *getStyle(GtkWidget *gtkWidget);
- GtkStateType gtkState(const QStyleOption *option);
-
- void setAlphaSupport(bool value) { m_alpha = value; }
- void setClipRect(const QRect &rect) { m_cliprect = rect; }
- void setFlipHorizontal(bool value) { m_hflipped = value; }
- void setFlipVertical(bool value) { m_vflipped = value; }
- void setUsePixmapCache(bool value) { m_usePixmapCache = value; }
-
- void paintBoxGap(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow, GtkPositionType gap_side, gint x,
- gint width, GtkStyle *style);
- void paintBox(GtkWidget *gtkWidget, const gchar* part,
- const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style,
- const QString &pmKey = QString());
- void paintHline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- int x1, int x2, int y, const QString &pmKey = QString());
- void paintVline(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- int y1, int y2, int x, const QString &pmKey = QString());
- void paintExpander(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state,
- GtkExpanderStyle expander_state, GtkStyle *style, const QString &pmKey = QString());
- void paintFocus(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkStyle *style,
- const QString &pmKey = QString());
- void paintResizeGrip(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GdkWindowEdge edge, GtkStyle *style, const QString &pmKey = QString());
- void paintArrow(GtkWidget *gtkWidget, const gchar* part, const QRect &arrowrect, GtkArrowType arrow_type, GtkStateType state, GtkShadowType shadow,
- gboolean fill, GtkStyle *style, const QString &pmKey = QString());
- void paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRect &rect,
- GtkStateType state, GtkShadowType shadow, GtkOrientation orientation, GtkStyle *style);
- void paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, GtkOrientation orientation, const QString &pmKey = QString());
- void paintShadow(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkStyle *style, const QString &pmKey = QString());
- void paintFlatBox(GtkWidget *gtkWidget, const gchar* part, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString & = QString());
- void paintExtention(GtkWidget *gtkWidget, const gchar *part, const QRect &rect, GtkStateType state, GtkShadowType shadow,
- GtkPositionType gap_pos, GtkStyle *style);
- void paintOption(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
- void paintCheckbox(GtkWidget *gtkWidget, const QRect &rect, GtkStateType state, GtkShadowType shadow, GtkStyle *style, const QString &detail);
-
- static QPixmap getIcon(const char* iconName, GtkIconSize size = GTK_ICON_SIZE_BUTTON);
-private:
- QPixmap renderTheme(uchar *bdata, uchar *wdata, const QRect&);
-
- GtkWidget *m_window;
- QPainter *m_painter;
- bool m_alpha;
- bool m_hflipped;
- bool m_vflipped;
- bool m_usePixmapCache;
- QRect m_cliprect;
-
-};
-
-QT_END_NAMESPACE
-
-#endif //!defined(QT_NO_STYLE_QGTK)
-
-#endif // QGTKPAINTER_H
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qgtkstyle.h"
-
-#if !defined(QT_NO_STYLE_GTK)
-
-#include <qapplication_p.h>
-#include <QtCore/QSettings>
-#include <QtGui/QDialogButtonBox>
-#include <QtGui/QStatusBar>
-#include <QtGui/QLineEdit>
-#include <QtGui/QWidget>
-#include <QtGui/QListView>
-#include <QtGui/QApplication>
-#include <QtGui/QStyleOption>
-#include <QtGui/QPushButton>
-#include <QtGui/QPainter>
-#include <QtGui/QMainWindow>
-#include <QtGui/QToolBar>
-#include <QtGui/QHeaderView>
-#include <QtGui/QMenuBar>
-#include <QtGui/QComboBox>
-#include <QtGui/QSpinBox>
-#include <QtGui/QScrollBar>
-#include <QtGui/QAbstractButton>
-#include <QtGui/QToolButton>
-#include <QtGui/QGroupBox>
-#include <QtGui/QRadioButton>
-#include <QtGui/QCheckBox>
-#include <QtGui/QTreeView>
-#include <QtGui/QStyledItemDelegate>
-#include <qpixmapcache.h>
-#undef signals // Collides with GTK stymbols
-#include <qgtkpainter_p.h>
-#include <qstylehelper_p.h>
-#include <qgtkstyle_p.h>
-#include <qcleanlooksstyle_p.h>
-#include "qguicommon_p.h"
-
-
-QT_BEGIN_NAMESPACE
-
-static const char * const dock_widget_close_xpm[] =
- {
- "11 13 5 1",
- " c None",
- ". c #D5CFCB",
- "+ c #6C6A67",
- "@ c #6C6A67",
- "$ c #B5B0AC",
- " ",
- " @@@@@@@@@ ",
- "@+ +@",
- "@ +@ @+ @",
- "@ @@@ @@@ @",
- "@ @@@@@ @",
- "@ @@@ @",
- "@ @@@@@ @",
- "@ @@@ @@@ @",
- "@ +@ @+ @",
- "@+ +@",
- " @@@@@@@@@ ",
- " "
- };
-
-static const char * const dock_widget_restore_xpm[] =
- {
- "11 13 5 1",
- " c None",
- ". c #D5CFCB",
- "+ c #6C6A67",
- "@ c #6C6A67",
- "# c #6C6A67",
- " ",
- " @@@@@@@@@ ",
- "@+ +@",
- "@ #@@@# @",
- "@ @ @ @",
- "@ #@@@# @ @",
- "@ @ @ @ @",
- "@ @ @@@ @",
- "@ @ @ @",
- "@ #@@@@ @",
- "@+ +@",
- " @@@@@@@@@ ",
- " "
- };
-
-static const int groupBoxBottomMargin = 2; // space below the groupbox
-static const int groupBoxTitleMargin = 6; // space between contents and title
-static const int groupBoxTopMargin = 2;
-
-/*!
- Returns the configuration string for \a value.
- Returns \a fallback if \a value is not found.
- */
-QString QGtkStyle::getGConfString(const QString &value, const QString &fallback)
-{
- return QGtkStylePrivate::getGConfString(value, fallback);
-}
-
-/*!
- Returns the configuration boolean for \a key.
- Returns \a fallback if \a key is not found.
- */
-bool QGtkStyle::getGConfBool(const QString &key, bool fallback)
-{
- return QGtkStylePrivate::getGConfBool(key, fallback);
-}
-
-static GdkColor fromQColor(const QColor &color)
-{
- GdkColor retval;
- retval.red = color.red() * 255;
- retval.green = color.green() * 255;
- retval.blue = color.blue() * 255;
- return retval;
-}
-
-/*!
- \class QGtkStyle
- \brief The QGtkStyle class provides a widget style rendered by GTK+
- \since 4.5
-
- The QGtkStyle style provides a look and feel that integrates well
- into GTK-based desktop environments such as the XFCe and GNOME.
-
- It does this by making use of the GTK+ theme engine, ensuring
- that Qt applications look and feel native on these platforms.
-
- Note: The style requires GTK+ version 2.10 or later.
- The Qt3-based "Qt" GTK+ theme engine will not work with QGtkStyle.
-
- \sa {Cleanlooks Style Widget Gallery}, QWindowsXPStyle, QMacStyle, QWindowsStyle,
- QCDEStyle, QMotifStyle, QPlastiqueStyle, QCleanlooksStyle
-*/
-
-/*!
- Constructs a QGtkStyle object.
-*/
-QGtkStyle::QGtkStyle()
- : QCleanlooksStyle(*new QGtkStylePrivate)
-{
- Q_D(QGtkStyle);
- d->init();
-}
-
-/*!
- \internal
-
- Constructs a QGtkStyle object.
-*/
-QGtkStyle::QGtkStyle(QGtkStylePrivate &dd)
- : QCleanlooksStyle(dd)
-{
- Q_D(QGtkStyle);
- d->init();
-}
-
-
-/*!
- Destroys the QGtkStyle object.
-*/
-QGtkStyle::~QGtkStyle()
-{
-}
-
-/*!
- \reimp
-*/
-QPalette QGtkStyle::standardPalette() const
-{
- Q_D(const QGtkStyle);
-
- QPalette palette = QCleanlooksStyle::standardPalette();
- if (d->isThemeAvailable()) {
- GtkStyle *style = d->gtkStyle();
- GtkWidget *gtkButton = d->gtkWidget(QLatin1String("GtkButton"));
- GtkWidget *gtkEntry = d->getTextColorWidget();
- GdkColor gdkBg, gdkBase, gdkText, gdkForeground, gdkSbg, gdkSfg, gdkaSbg, gdkaSfg;
- QColor bg, base, text, fg, highlight, highlightText, inactiveHighlight, inactiveHighlightedTExt;
- gdkBg = style->bg[GTK_STATE_NORMAL];
- gdkForeground = gtkButton->style->fg[GTK_STATE_NORMAL];
-
- // Our base and selected color is primarily used for text
- // so we assume a gtkEntry will have the most correct value
- gdkBase = gtkEntry->style->base[GTK_STATE_NORMAL];
- gdkText = gtkEntry->style->text[GTK_STATE_NORMAL];
- gdkSbg = gtkEntry->style->base[GTK_STATE_SELECTED];
- gdkSfg = gtkEntry->style->text[GTK_STATE_SELECTED];
-
- // The ACTIVE base color is really used for inactive windows
- gdkaSbg = gtkEntry->style->base[GTK_STATE_ACTIVE];
- gdkaSfg = gtkEntry->style->text[GTK_STATE_ACTIVE];
-
- bg = QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
- text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- fg = QColor(gdkForeground.red>>8, gdkForeground.green>>8, gdkForeground.blue>>8);
- base = QColor(gdkBase.red>>8, gdkBase.green>>8, gdkBase.blue>>8);
- highlight = QColor(gdkSbg.red>>8, gdkSbg.green>>8, gdkSbg.blue>>8);
- highlightText = QColor(gdkSfg.red>>8, gdkSfg.green>>8, gdkSfg.blue>>8);
- inactiveHighlight = QColor(gdkaSbg.red>>8, gdkaSbg.green>>8, gdkaSbg.blue>>8);
- inactiveHighlightedTExt = QColor(gdkaSfg.red>>8, gdkaSfg.green>>8, gdkaSfg.blue>>8);
-
- palette.setColor(QPalette::HighlightedText, highlightText);
-
-
- palette.setColor(QPalette::Light, bg.lighter(125));
- palette.setColor(QPalette::Shadow, bg.darker(130));
- palette.setColor(QPalette::Dark, bg.darker(120));
- palette.setColor(QPalette::Text, text);
- palette.setColor(QPalette::WindowText, fg);
- palette.setColor(QPalette::ButtonText, fg);
- palette.setColor(QPalette::Base, base);
-
- QColor alternateRowColor = palette.base().color().lighter(93); // ref gtkstyle.c draw_flat_box
- GtkWidget *gtkTreeView = d->gtkWidget(QLatin1String("GtkTreeView"));
- GdkColor *gtkAltBase = NULL;
- gtk_widget_style_get(gtkTreeView, "odd-row-color", >kAltBase, NULL);
- if (gtkAltBase) {
- alternateRowColor = QColor(gtkAltBase->red>>8, gtkAltBase->green>>8, gtkAltBase->blue>>8);
- gdk_color_free(gtkAltBase);
- }
- palette.setColor(QPalette::AlternateBase, alternateRowColor);
-
- palette.setColor(QPalette::Window, bg);
- palette.setColor(QPalette::Button, bg);
- palette.setColor(QPalette::Background, bg);
- QColor disabled((fg.red() + bg.red()) / 2,
- (fg.green() + bg.green())/ 2,
- (fg.blue() + bg.blue()) / 2);
- palette.setColor(QPalette::Disabled, QPalette::Text, disabled);
- palette.setColor(QPalette::Disabled, QPalette::WindowText, disabled);
- palette.setColor(QPalette::Disabled, QPalette::Foreground, disabled);
- palette.setColor(QPalette::Disabled, QPalette::ButtonText, disabled);
- palette.setColor(QPalette::Highlight, highlight);
- // calculate disabled colors by removing saturation
- highlight.setHsv(highlight.hue(), 0, highlight.value(), highlight.alpha());
- highlightText.setHsv(highlightText.hue(), 0, highlightText.value(), highlightText.alpha());
- palette.setColor(QPalette::Disabled, QPalette::Highlight, highlight);
- palette.setColor(QPalette::Disabled, QPalette::HighlightedText, highlightText);
-
- palette.setColor(QPalette::Inactive, QPalette::HighlightedText, inactiveHighlightedTExt);
- palette.setColor(QPalette::Inactive, QPalette::Highlight, inactiveHighlight);
-
- style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
- gtk_window_get_type());
- if (style) {
- gdkText = style->fg[GTK_STATE_NORMAL];
- text = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- palette.setColor(QPalette::ToolTipText, text);
- }
- }
- return palette;
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::polish(QPalette &palette)
-{
- Q_D(QGtkStyle);
-
- // QCleanlooksStyle will alter the palette, hence we do
- // not want to polish the palette unless we are using it as
- // the fallback
- if (!d->isThemeAvailable())
- QCleanlooksStyle::polish(palette);
- else
- palette = palette.resolve(standardPalette());
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::polish(QApplication *app)
-{
- Q_D(QGtkStyle);
-
- QCleanlooksStyle::polish(app);
- // Custom fonts and palettes with QtConfig are intentionally
- // not supported as these should be entirely determined by
- // current Gtk settings
- if (app->desktopSettingsAware() && d->isThemeAvailable()) {
- QApplicationPrivate::setSystemPalette(standardPalette());
- QApplicationPrivate::setSystemFont(d->getThemeFont());
- d->applyCustomPaletteHash();
- if (!d->isKDE4Session()) {
- qt_filedialog_open_filename_hook = &QGtkStylePrivate::openFilename;
- qt_filedialog_save_filename_hook = &QGtkStylePrivate::saveFilename;
- qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames;
- qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory;
- qApp->installEventFilter(&d->filter);
- }
- }
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::unpolish(QApplication *app)
-{
- Q_D(QGtkStyle);
-
- QCleanlooksStyle::unpolish(app);
- QPixmapCache::clear();
-
- if (app->desktopSettingsAware() && d->isThemeAvailable()
- && !d->isKDE4Session()) {
- qt_filedialog_open_filename_hook = 0;
- qt_filedialog_save_filename_hook = 0;
- qt_filedialog_open_filenames_hook = 0;
- qt_filedialog_existing_directory_hook = 0;
- qApp->removeEventFilter(&d->filter);
- }
-}
-
-/*!
- \reimp
-*/
-
-void QGtkStyle::polish(QWidget *widget)
-{
- Q_D(QGtkStyle);
-
- QCleanlooksStyle::polish(widget);
- if (!d->isThemeAvailable())
- return;
- if (qobject_cast<QAbstractButton*>(widget)
- || qobject_cast<QToolButton*>(widget)
- || qobject_cast<QComboBox*>(widget)
- || qobject_cast<QGroupBox*>(widget)
- || qobject_cast<QScrollBar*>(widget)
- || qobject_cast<QSlider*>(widget)
- || qobject_cast<QAbstractSpinBox*>(widget)
- || qobject_cast<QSpinBox*>(widget)
- || qobject_cast<QHeaderView*>(widget))
- widget->setAttribute(Qt::WA_Hover);
- else if (QTreeView *tree = qobject_cast<QTreeView *> (widget))
- tree->viewport()->setAttribute(Qt::WA_Hover);
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::unpolish(QWidget *widget)
-{
- QCleanlooksStyle::unpolish(widget);
-}
-
-/*!
- \reimp
-*/
-int QGtkStyle::pixelMetric(PixelMetric metric,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable())
- return QCleanlooksStyle::pixelMetric(metric, option, widget);
-
- switch (metric) {
- case PM_DefaultFrameWidth:
- if (qobject_cast<const QFrame*>(widget)) {
- if (GtkStyle *style =
- gtk_rc_get_style_by_paths(gtk_settings_get_default(),
- "*.GtkScrolledWindow",
- "*.GtkScrolledWindow",
- gtk_window_get_type()))
- return qMax(style->xthickness, style->ythickness);
- }
- return 2;
-
- case PM_MenuButtonIndicator:
- return 20;
-
- case PM_TabBarBaseOverlap:
- return 1;
-
- case PM_ToolBarSeparatorExtent:
- return 11;
-
- case PM_ToolBarFrameWidth:
- return 1;
-
- case PM_ToolBarItemSpacing:
- return 0;
-
- case PM_ButtonShiftHorizontal: {
- GtkWidget *gtkButton = d->gtkWidget(QLatin1String("GtkButton"));
- guint horizontal_shift;
- gtk_widget_style_get(gtkButton, "child-displacement-x", &horizontal_shift, NULL);
- return horizontal_shift;
- }
-
- case PM_ButtonShiftVertical: {
- GtkWidget *gtkButton = d->gtkWidget(QLatin1String("GtkButton"));
- guint vertical_shift;
- gtk_widget_style_get(gtkButton, "child-displacement-y", &vertical_shift, NULL);
- return vertical_shift;
- }
-
- case PM_MenuBarPanelWidth:
- return 0;
-
- case PM_MenuPanelWidth: {
- GtkWidget *gtkMenu = d->gtkWidget(QLatin1String("GtkMenu"));
- guint horizontal_padding = 0;
- // horizontal-padding is used by Maemo to get thicker borders
- if (!gtk_check_version(2, 10, 0))
- gtk_widget_style_get(gtkMenu, "horizontal-padding", &horizontal_padding, NULL);
- int padding = qMax<int>(gtkMenu->style->xthickness, horizontal_padding);
- return padding;
- }
-
- case PM_ButtonIconSize: {
- int retVal = 24;
- GtkSettings *settings = gtk_settings_get_default();
- gchararray icon_sizes;
- g_object_get(settings, "gtk-icon-sizes", &icon_sizes, NULL);
- QStringList values = QString(QLS(icon_sizes)).split(QLatin1Char(':'));
- g_free(icon_sizes);
- QChar splitChar(QLatin1Char(','));
- foreach (const QString &value, values) {
- if (value.startsWith(QLS("gtk-button="))) {
- QString iconSize = value.right(value.size() - 11);
-
- if (iconSize.contains(splitChar))
- retVal = iconSize.split(splitChar)[0].toInt();
- break;
- }
- }
- return retVal;
- }
-
- case PM_MenuVMargin:
-
- case PM_MenuHMargin:
- return 0;
-
- case PM_DockWidgetTitleMargin:
- return 0;
-
- case PM_DockWidgetTitleBarButtonMargin:
- return 5;
-
- case PM_TabBarTabVSpace:
- return 12;
-
- case PM_TabBarTabHSpace:
- return 14;
-
- case PM_TabBarTabShiftVertical:
- return 2;
-
- case PM_ToolBarHandleExtent:
- return 9;
-
- case PM_SplitterWidth:
- return 6;
-
- case PM_SliderThickness:
- case PM_SliderControlThickness: {
- GtkWidget *gtkScale = d->gtkWidget(QLatin1String("GtkHScale"));
- gint val;
- gtk_widget_style_get(gtkScale, "slider-width", &val, NULL);
- if (metric == PM_SliderControlThickness)
- return val + 2*gtkScale->style->ythickness;
- return val;
- }
-
- case PM_ScrollBarExtent: {
- gint sliderLength;
- gint trough_border;
- GtkWidget *hScrollbar = d->gtkWidget(QLS("GtkHScrollbar"));
- gtk_widget_style_get(hScrollbar,
- "trough-border", &trough_border,
- "slider-width", &sliderLength,
- NULL);
- return sliderLength + trough_border*2;
- }
-
- case PM_ScrollBarSliderMin:
- return 34;
-
- case PM_SliderLength:
- gint val;
- gtk_widget_style_get(d->gtkWidget(QLS("GtkHScale")), "slider-length", &val, NULL);
- return val;
-
- case PM_ExclusiveIndicatorWidth:
- case PM_ExclusiveIndicatorHeight:
- case PM_IndicatorWidth:
- case PM_IndicatorHeight: {
- GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
- gint size, spacing;
- gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, "indicator-size", &size, NULL);
- return size + 2 * spacing;
- }
-
- case PM_MenuBarVMargin: {
- GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
- return qMax(0, gtkMenubar->style->ythickness);
- }
- case PM_ScrollView_ScrollBarSpacing:
- {
- gint spacing = 3;
- GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
- Q_ASSERT(gtkScrollWindow);
- gtk_widget_style_get(gtkScrollWindow, "scrollbar-spacing", &spacing, NULL);
- return spacing;
- }
- case PM_SubMenuOverlap: {
- gint offset = 0;
- GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
- gtk_widget_style_get(gtkMenu, "horizontal-offset", &offset, NULL);
- return offset;
- }
- default:
- return QCleanlooksStyle::pixelMetric(metric, option, widget);
- }
-}
-
-/*!
- \reimp
-*/
-int QGtkStyle::styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget,
-
- QStyleHintReturn *returnData = 0) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable())
- return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
-
- switch (hint) {
-
- case SH_DialogButtonLayout: {
- int ret = QDialogButtonBox::GnomeLayout;
- gboolean alternateOrder = 0;
- GtkSettings *settings = gtk_settings_get_default();
- g_object_get(settings, "gtk-alternative-button-order", &alternateOrder, NULL);
-
- if (alternateOrder)
- ret = QDialogButtonBox::WinLayout;
-
- return ret;
- }
-
- break;
-
- case SH_ToolButtonStyle:
- {
- if (d->isKDE4Session())
- return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
- GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
- GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
- g_object_get(gtkToolbar, "toolbar-style", &toolbar_style, NULL);
- switch (toolbar_style) {
- case GTK_TOOLBAR_TEXT:
- return Qt::ToolButtonTextOnly;
- case GTK_TOOLBAR_BOTH:
- return Qt::ToolButtonTextUnderIcon;
- case GTK_TOOLBAR_BOTH_HORIZ:
- return Qt::ToolButtonTextBesideIcon;
- case GTK_TOOLBAR_ICONS:
- default:
- return Qt::ToolButtonIconOnly;
- }
- }
- break;
- case SH_SpinControls_DisableOnBounds:
- return int(true);
-
- case SH_DitherDisabledText:
- return int(false);
-
- case SH_ComboBox_Popup: {
- GtkWidget *gtkComboBox = d->gtkWidget(QLS("GtkComboBox"));
- gboolean appears_as_list;
- gtk_widget_style_get((GtkWidget*)gtkComboBox, "appears-as-list", &appears_as_list, NULL);
- return appears_as_list ? 0 : 1;
- }
-
- case SH_MenuBar_AltKeyNavigation:
- return int(false);
-
- case SH_EtchDisabledText:
- return int(false);
-
- case SH_Menu_SubMenuPopupDelay: {
- gint delay = 225;
- GtkSettings *settings = gtk_settings_get_default();
- g_object_get(settings, "gtk-menu-popup-delay", &delay, NULL);
- return delay;
- }
-
- case SH_ScrollView_FrameOnlyAroundContents: {
- gboolean scrollbars_within_bevel = false;
- if (widget && widget->isWindow())
- scrollbars_within_bevel = true;
- else if (!gtk_check_version(2, 12, 0)) {
- GtkWidget *gtkScrollWindow = d->gtkWidget(QLS("GtkScrolledWindow"));
- gtk_widget_style_get(gtkScrollWindow, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
- }
- return !scrollbars_within_bevel;
- }
-
- case SH_DialogButtonBox_ButtonsHaveIcons: {
- static bool buttonsHaveIcons = d->getGConfBool(QLS("/desktop/gnome/interface/buttons_have_icons"));
- return buttonsHaveIcons;
- }
-
- case SH_UnderlineShortcut: {
- gboolean underlineShortcut = true;
- if (!gtk_check_version(2, 12, 0)) {
- GtkSettings *settings = gtk_settings_get_default();
- g_object_get(settings, "gtk-enable-mnemonics", &underlineShortcut, NULL);
- }
- return underlineShortcut;
- }
-
- default:
- return QCleanlooksStyle::styleHint(hint, option, widget, returnData);
- }
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::drawPrimitive(PrimitiveElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable()) {
- QCleanlooksStyle::drawPrimitive(element, option, painter, widget);
- return;
- }
-
- GtkStyle* style = d->gtkStyle();
- QGtkPainter gtkPainter(painter);
-
- switch (element) {
- case PE_Frame: {
- if (widget && widget->inherits("QComboBoxPrivateContainer")){
- QStyleOption copy = *option;
- copy.state |= State_Raised;
- proxy()->drawPrimitive(PE_PanelMenu, ©, painter, widget);
- break;
- }
- // Drawing the entire itemview frame is very expensive, especially on the native X11 engine
- // Instead we cheat a bit and draw a border image without the center part, hence only scaling
- // thin rectangular images
- const int pmSize = 64;
- const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget);
- const QString pmKey = QLatin1String("windowframe") % HexString<uint>(option->state);
-
- QPixmap pixmap;
- QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize));
-
- // Only draw through style once
- if (!QPixmapCache::find(pmKey, pixmap)) {
- pixmap = QPixmap(pmSize, pmSize);
- pixmap.fill(Qt::transparent);
- QPainter pmPainter(&pixmap);
- QGtkPainter gtkFramePainter(&pmPainter);
- gtkFramePainter.setUsePixmapCache(false); // Don't cache twice
-
- GtkShadowType shadow_type = GTK_SHADOW_NONE;
- if (option->state & State_Sunken)
- shadow_type = GTK_SHADOW_IN;
- else if (option->state & State_Raised)
- shadow_type = GTK_SHADOW_OUT;
-
- GtkStyle *style = gtk_rc_get_style_by_paths(gtk_settings_get_default(),
- "*.GtkScrolledWindow", "*.GtkScrolledWindow", gtk_window_get_type());
- if (style)
- gtkFramePainter.paintShadow(d->gtkWidget(QLS("GtkFrame")), "viewport", pmRect,
- option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- shadow_type, style);
- QPixmapCache::insert(pmKey, pixmap);
- }
-
- QRect rect = option->rect;
- const int rw = rect.width() - border;
- const int rh = rect.height() - border;
- const int pw = pmRect.width() - border;
- const int ph = pmRect.height() - border;
-
- // Sidelines
- painter->drawPixmap(rect.adjusted(border, 0, -border, -rh), pixmap, pmRect.adjusted(border, 0, -border,-ph));
- painter->drawPixmap(rect.adjusted(border, rh, -border, 0), pixmap, pmRect.adjusted(border, ph,-border,0));
- painter->drawPixmap(rect.adjusted(0, border, -rw, -border), pixmap, pmRect.adjusted(0, border, -pw, -border));
- painter->drawPixmap(rect.adjusted(rw, border, 0, -border), pixmap, pmRect.adjusted(pw, border, 0, -border));
-
- // Corners
- painter->drawPixmap(rect.adjusted(0, 0, -rw, -rh), pixmap, pmRect.adjusted(0, 0, -pw,-ph));
- painter->drawPixmap(rect.adjusted(rw, 0, 0, -rh), pixmap, pmRect.adjusted(pw, 0, 0,-ph));
- painter->drawPixmap(rect.adjusted(0, rh, -rw, 0), pixmap, pmRect.adjusted(0, ph, -pw,0));
- painter->drawPixmap(rect.adjusted(rw, rh, 0, 0), pixmap, pmRect.adjusted(pw, ph, 0,0));
- }
- break;
-
- case PE_PanelTipLabel: {
- GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
- style = gtk_rc_get_style_by_paths(gtk_settings_get_default(), "gtk-tooltips", "GtkWindow",
- gtk_window_get_type());
- gtkPainter.paintFlatBox(gtkWindow, "tooltip", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, style);
- }
- break;
-
- case PE_PanelStatusBar: {
- if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
- option->palette.resolve() & (1 << QPalette::Window)) {
- // Respect custom palette
- painter->fillRect(option->rect, option->palette.window());
- break;
- }
- GtkShadowType shadow_type;
- GtkWidget *gtkStatusbarFrame = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
- gtk_widget_style_get(gtkStatusbarFrame->parent, "shadow-type", &shadow_type, NULL);
- gtkPainter.paintShadow(gtkStatusbarFrame, "frame", option->rect, GTK_STATE_NORMAL,
- shadow_type, gtkStatusbarFrame->style);
- }
- break;
-
- case PE_IndicatorHeaderArrow:
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- GtkWidget *gtkTreeHeader = d->gtkWidget(QLS("GtkTreeView.GtkButton"));
- GtkStateType state = gtkPainter.gtkState(option);
- style = gtkTreeHeader->style;
- GtkArrowType type = GTK_ARROW_UP;
- QImage arrow;
- // This sorting indicator inversion is intentional, and follows the GNOME HIG.
- // See http://library.gnome.org/devel/hig-book/stable/controls-lists.html.en#controls-lists-sortable
- if (header->sortIndicator & QStyleOptionHeader::SortUp)
- type = GTK_ARROW_UP;
- else if (header->sortIndicator & QStyleOptionHeader::SortDown)
- type = GTK_ARROW_DOWN;
-
- gtkPainter.paintArrow(gtkTreeHeader, "button", option->rect.adjusted(1, 1, -1, -1), type, state,
- GTK_SHADOW_NONE, FALSE, style);
- }
- break;
-
- case PE_FrameFocusRect:
- if (!widget || qobject_cast<const QAbstractItemView*>(widget))
- QCleanlooksStyle::drawPrimitive(element, option, painter, widget);
- else {
- // ### this mess should move to subcontrolrect
- QRect frameRect = option->rect.adjusted(1, 1, -1, -2);
-
- if (qobject_cast<const QTabBar*>(widget)) {
- GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
- style = gtkPainter.getStyle(gtkNotebook);
- gtkPainter.paintFocus(gtkNotebook, "tab", frameRect.adjusted(-1, 1, 1, 1), GTK_STATE_ACTIVE, style);
- } else {
- gtkPainter.paintFocus(NULL, "tab", frameRect, GTK_STATE_ACTIVE, style);
- }
- }
- break;
-
- case PE_IndicatorBranch:
- if (option->state & State_Children) {
- QRect rect = option->rect;
- rect = QRect(0, 0, 12, 12);
- rect.moveCenter(option->rect.center());
- rect.translate(2, 0);
- GtkExpanderStyle openState = GTK_EXPANDER_EXPANDED;
- GtkExpanderStyle closedState = GTK_EXPANDER_COLLAPSED;
- GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
-
- GtkStateType state = GTK_STATE_NORMAL;
- if (!(option->state & State_Enabled))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & State_MouseOver)
- state = GTK_STATE_PRELIGHT;
-
- gtkPainter.paintExpander(gtkTreeView, "treeview", rect, state,
- option->state & State_Open ? openState : closedState , gtkTreeView->style);
- }
- break;
-
- case PE_PanelItemViewRow:
- // This primitive is only used to draw selection behind selected expander arrows.
- // We try not to decorate the tree branch background unless you inherit from StyledItemDelegate
- // The reason for this is that a lot of code that relies on custom item delegates will look odd having
- // a gradient on the branch but a flat shaded color on the item itself.
- QCommonStyle::drawPrimitive(element, option, painter, widget);
- if (!(option->state & State_Selected)) {
- break;
- } else {
- if (const QAbstractItemView *view = qobject_cast<const QAbstractItemView*>(widget)) {
- if (!qobject_cast<QStyledItemDelegate*>(view->itemDelegate()))
- break;
- }
- } // fall through
-
- case PE_PanelItemViewItem:
- if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- uint resolve_mask = vopt->palette.resolve();
- if (vopt->backgroundBrush.style() != Qt::NoBrush
- || (resolve_mask & (1 << QPalette::Base)))
- {
- QPointF oldBO = painter->brushOrigin();
- painter->setBrushOrigin(vopt->rect.topLeft());
- painter->fillRect(vopt->rect, vopt->backgroundBrush);
- painter->setBrushOrigin(oldBO);
- if (!(option->state & State_Selected))
- break;
- }
- if (GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"))) {
- const char *detail = "cell_even_ruled";
- if (vopt && vopt->features & QStyleOptionViewItemV2::Alternate)
- detail = "cell_odd_ruled";
- bool isActive = option->state & State_Active;
- QString key;
- if (isActive ) {
- // Required for active/non-active window appearance
- key = QLS("a");
- GTK_WIDGET_SET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
- }
- bool isEnabled = (widget ? widget->isEnabled() : (vopt->state & QStyle::State_Enabled));
- gtkPainter.paintFlatBox(gtkTreeView, detail, option->rect,
- option->state & State_Selected ? GTK_STATE_SELECTED :
- isEnabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_OUT, gtkTreeView->style, key);
- if (isActive )
- GTK_WIDGET_UNSET_FLAGS(gtkTreeView, GTK_HAS_FOCUS);
- }
- }
- break;
- case PE_IndicatorToolBarSeparator:
- {
- const int margin = 6;
- GtkWidget *gtkSeparator = d->gtkWidget(QLS("GtkToolbar.GtkSeparatorToolItem"));
- if (option->state & State_Horizontal) {
- const int offset = option->rect.width()/2;
- QRect rect = option->rect.adjusted(offset, margin, 0, -margin);
- painter->setPen(QPen(option->palette.background().color().darker(110)));
- gtkPainter.paintVline( gtkSeparator, "vseparator",
- rect, GTK_STATE_NORMAL, gtkSeparator->style,
- 0, rect.height(), 0);
- } else { //Draw vertical separator
- const int offset = option->rect.height()/2;
- QRect rect = option->rect.adjusted(margin, offset, -margin, 0);
- painter->setPen(QPen(option->palette.background().color().darker(110)));
- gtkPainter.paintHline( gtkSeparator, "hseparator",
- rect, GTK_STATE_NORMAL, gtkSeparator->style,
- 0, rect.width(), 0);
- }
- }
- break;
-
- case PE_IndicatorToolBarHandle: {
- GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
- GtkShadowType shadow_type;
- gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
- //Note when the toolbar is horizontal, the handle is vertical
- painter->setClipRect(option->rect);
- gtkPainter.paintHandle(gtkToolbar, "toolbar", option->rect.adjusted(-1, -1 ,0 ,1),
- GTK_STATE_NORMAL, shadow_type, !(option->state & State_Horizontal) ?
- GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, gtkToolbar->style);
- }
- break;
-
- case PE_IndicatorArrowUp:
- case PE_IndicatorArrowDown:
- case PE_IndicatorArrowLeft:
- case PE_IndicatorArrowRight: {
-
-
- GtkArrowType type = GTK_ARROW_UP;
-
- switch (element) {
-
- case PE_IndicatorArrowDown:
- type = GTK_ARROW_DOWN;
- break;
-
- case PE_IndicatorArrowLeft:
- type = GTK_ARROW_LEFT;
- break;
-
- case PE_IndicatorArrowRight:
- type = GTK_ARROW_RIGHT;
- break;
-
- default:
- break;
- }
- int size = qMin(option->rect.height(), option->rect.width());
- int border = (size > 9) ? (size/4) : 0; //Allow small arrows to have exact dimensions
- int bsx = 0, bsy = 0;
- if (option->state & State_Sunken) {
- bsx = proxy()->pixelMetric(PM_ButtonShiftHorizontal);
- bsy = proxy()->pixelMetric(PM_ButtonShiftVertical);
- }
- QRect arrowRect = option->rect.adjusted(border + bsx, border + bsy, -border + bsx, -border + bsy);
- GtkShadowType shadow = option->state & State_Sunken ? GTK_SHADOW_IN : GTK_SHADOW_OUT;
- GtkStateType state = gtkPainter.gtkState(option);
-
- QColor arrowColor = option->palette.buttonText().color();
- GtkWidget *gtkArrow = d->gtkWidget(QLS("GtkArrow"));
- GdkColor color = fromQColor(arrowColor);
- gtk_widget_modify_fg (gtkArrow, state, &color);
- gtkPainter.paintArrow(gtkArrow, "button", arrowRect,
- type, state, shadow, FALSE, gtkArrow->style,
- QString::number(arrowColor.rgba(), 16));
- // Passing NULL will revert the color change
- gtk_widget_modify_fg (gtkArrow, state, NULL);
- }
- break;
-
- case PE_FrameGroupBox:
- // Do nothing here, the GNOME groupboxes are flat
- break;
-
- case PE_PanelMenu: {
- GtkWidget *gtkMenu = d->gtkWidget(QLS("GtkMenu"));
- gtkPainter.setAlphaSupport(false); // Note, alpha disabled for performance reasons
- gtkPainter.paintBox(gtkMenu, "menu", option->rect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, gtkMenu->style, QString());
- }
- break;
-
- case PE_FrameMenu:
- //This is actually done by PE_Widget due to a clipping issue
- //Otherwise Menu items will not be able to span the entire menu width
-
- // This is only used by floating tool bars
- if (qobject_cast<const QToolBar *>(widget)) {
- GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
- gtkPainter.paintBox( gtkMenubar, "toolbar", option->rect,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
- gtkPainter.paintBox( gtkMenubar, "menu", option->rect,
- GTK_STATE_NORMAL, GTK_SHADOW_OUT, style);
- }
- break;
-
- case PE_FrameLineEdit: {
- GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
-
-
- gboolean interior_focus;
- gint focus_line_width;
- QRect rect = option->rect;
- gtk_widget_style_get(gtkEntry,
- "interior-focus", &interior_focus,
- "focus-line-width", &focus_line_width, NULL);
-
- // See https://bugzilla.mozilla.org/show_bug.cgi?id=405421 for info about this hack
- g_object_set_data(G_OBJECT(gtkEntry), "transparent-bg-hint", GINT_TO_POINTER(TRUE));
-
- if (!interior_focus && option->state & State_HasFocus)
- rect.adjust(focus_line_width, focus_line_width, -focus_line_width, -focus_line_width);
-
- if (option->state & State_HasFocus)
- GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- gtkPainter.paintShadow(gtkEntry, "entry", rect, option->state & State_Enabled ?
- GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_IN, gtkEntry->style,
- option->state & State_HasFocus ? QLS("focus") : QString());
- if (!interior_focus && option->state & State_HasFocus)
- gtkPainter.paintShadow(gtkEntry, "entry", option->rect, option->state & State_Enabled ?
- GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_IN, gtkEntry->style, QLS("GtkEntryShadowIn"));
-
- if (option->state & State_HasFocus)
- GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- }
- break;
-
- case PE_PanelLineEdit:
- if (const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
- GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
- if (panel->lineWidth > 0)
- proxy()->drawPrimitive(PE_FrameLineEdit, option, painter, widget);
- uint resolve_mask = option->palette.resolve();
- QRect textRect = option->rect.adjusted(gtkEntry->style->xthickness, gtkEntry->style->ythickness,
- -gtkEntry->style->xthickness, -gtkEntry->style->ythickness);
-
- if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
- resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
- painter->fillRect(textRect, option->palette.base());
- else
- gtkPainter.paintFlatBox( gtkEntry, "entry_bg", textRect,
- option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, gtkEntry->style);
- }
- break;
-
- case PE_FrameTabWidget:
- if (const QStyleOptionTabWidgetFrame *frame = qstyleoption_cast<const QStyleOptionTabWidgetFrame*>(option)) {
- GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
- style = gtkPainter.getStyle(gtkNotebook);
- gtkPainter.setAlphaSupport(false);
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = GTK_STATE_NORMAL; // Only state supported by gtknotebook
- bool reverse = (option->direction == Qt::RightToLeft);
- gtk_widget_set_direction(gtkNotebook, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- if (const QStyleOptionTabWidgetFrameV2 *tabframe = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2*>(option)) {
- GtkPositionType frameType = GTK_POS_TOP;
- QTabBar::Shape shape = frame->shape;
- int gapStart = 0;
- int gapSize = 0;
- if (shape == QTabBar::RoundedNorth || shape == QTabBar::RoundedSouth) {
- frameType = (shape == QTabBar::RoundedNorth) ? GTK_POS_TOP : GTK_POS_BOTTOM;
- gapStart = tabframe->selectedTabRect.left();
- gapSize = tabframe->selectedTabRect.width();
- } else {
- frameType = (shape == QTabBar::RoundedWest) ? GTK_POS_LEFT : GTK_POS_RIGHT;
- gapStart = tabframe->selectedTabRect.y();
- gapSize = tabframe->selectedTabRect.height();
- }
- gtkPainter.paintBoxGap(gtkNotebook, "notebook", option->rect, state, shadow, frameType,
- gapStart, gapSize, style);
- break; // done
- }
-
- // Note this is only the fallback option
- gtkPainter.paintBox(gtkNotebook, "notebook", option->rect, state, shadow, style);
- }
- break;
-
- case PE_PanelButtonCommand:
- case PE_PanelButtonTool: {
- bool isDefault = false;
- bool isTool = (element == PE_PanelButtonTool);
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton*>(option))
- isDefault = btn->features & QStyleOptionButton::DefaultButton;
-
- // don't draw a frame for tool buttons that have the autoRaise flag and are not enabled or on
- if (isTool && !(option->state & State_Enabled || option->state & State_On) && (option->state & State_AutoRaise))
- break;
- // don't draw a frame for dock widget buttons, unless we are hovering
- if (widget && widget->inherits("QDockWidgetTitleButton") && !(option->state & State_MouseOver))
- break;
-
- GtkStateType state = gtkPainter.gtkState(option);
- if (option->state & State_On || option->state & State_Sunken)
- state = GTK_STATE_ACTIVE;
- GtkWidget *gtkButton = isTool ? d->gtkWidget(QLS("GtkToolButton.GtkButton")) : d->gtkWidget(QLS("GtkButton"));
- gint focusWidth, focusPad;
- gboolean interiorFocus = false;
- gtk_widget_style_get (gtkButton,
- "focus-line-width", &focusWidth,
- "focus-padding", &focusPad,
- "interior-focus", &interiorFocus, NULL);
-
- style = gtkButton->style;
-
- QRect buttonRect = option->rect;
-
- QString key;
- if (isDefault) {
- key += QLS("def");
- GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
- gtkPainter.paintBox(gtkButton, "buttondefault", buttonRect, state, GTK_SHADOW_IN,
- style, isDefault ? QLS("d") : QString());
- }
-
- bool hasFocus = option->state & State_HasFocus;
-
- if (hasFocus) {
- key += QLS("def");
- GTK_WIDGET_SET_FLAGS(gtkButton, GTK_HAS_FOCUS);
- }
-
- if (!interiorFocus)
- buttonRect = buttonRect.adjusted(focusWidth, focusWidth, -focusWidth, -focusWidth);
-
- GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
- GTK_SHADOW_IN : GTK_SHADOW_OUT;
-
- gtkPainter.paintBox(gtkButton, "button", buttonRect, state, shadow,
- style, key);
- if (isDefault)
- GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_DEFAULT);
- if (hasFocus)
- GTK_WIDGET_UNSET_FLAGS(gtkButton, GTK_HAS_FOCUS);
- }
- break;
-
- case PE_IndicatorRadioButton: {
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = gtkPainter.gtkState(option);
-
- if (option->state & State_Sunken)
- state = GTK_STATE_ACTIVE;
-
- if (option->state & State_NoChange)
- shadow = GTK_SHADOW_ETCHED_IN;
- else if (option->state & State_On)
- shadow = GTK_SHADOW_IN;
- else
- shadow = GTK_SHADOW_OUT;
-
- GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
- gint spacing;
- gtk_widget_style_get(gtkRadioButton, "indicator-spacing", &spacing, NULL);
- QRect buttonRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
- gtkPainter.setClipRect(option->rect);
- // ### Note: Ubuntulooks breaks when the proper widget is passed
- // Murrine engine requires a widget not to get RGBA check - warnings
- GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
- QString key(QLS("radiobutton"));
- if (option->state & State_HasFocus) { // Themes such as Nodoka check this flag
- key += QLatin1Char('f');
- GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
- }
- gtkPainter.paintOption(gtkCheckButton , buttonRect, state, shadow, gtkRadioButton->style, key);
- if (option->state & State_HasFocus)
- GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
- }
- break;
-
- case PE_IndicatorCheckBox: {
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = gtkPainter.gtkState(option);
-
- if (option->state & State_Sunken)
- state = GTK_STATE_ACTIVE;
-
- if (option->state & State_NoChange)
- shadow = GTK_SHADOW_ETCHED_IN;
- else if (option->state & State_On)
- shadow = GTK_SHADOW_IN;
- else
- shadow = GTK_SHADOW_OUT;
-
- int spacing;
-
- GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
- QString key(QLS("checkbutton"));
- if (option->state & State_HasFocus) { // Themes such as Nodoka checks this flag
- key += QLatin1Char('f');
- GTK_WIDGET_SET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
- }
-
- // Some styles such as aero-clone assume they can paint in the spacing area
- gtkPainter.setClipRect(option->rect);
-
- gtk_widget_style_get(gtkCheckButton, "indicator-spacing", &spacing, NULL);
-
- QRect checkRect = option->rect.adjusted(spacing, spacing, -spacing, -spacing);
-
- gtkPainter.paintCheckbox(gtkCheckButton, checkRect, state, shadow, gtkCheckButton->style,
- key);
- if (option->state & State_HasFocus)
- GTK_WIDGET_UNSET_FLAGS(gtkCheckButton, GTK_HAS_FOCUS);
-
- }
- break;
-
-#ifndef QT_NO_TABBAR
-
- case PE_FrameTabBarBase:
- if (const QStyleOptionTabBarBase *tbb
- = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
- QRect tabRect = tbb->rect;
- painter->save();
- painter->setPen(QPen(option->palette.dark().color().dark(110), 0));
- switch (tbb->shape) {
-
- case QTabBar::RoundedNorth:
- painter->drawLine(tabRect.topLeft(), tabRect.topRight());
- break;
-
- case QTabBar::RoundedWest:
- painter->drawLine(tabRect.left(), tabRect.top(), tabRect.left(), tabRect.bottom());
- break;
-
- case QTabBar::RoundedSouth:
- painter->drawLine(tbb->rect.left(), tbb->rect.bottom(),
- tabRect.right(), tabRect.bottom());
- break;
-
- case QTabBar::RoundedEast:
- painter->drawLine(tabRect.topRight(), tabRect.bottomRight());
- break;
-
- case QTabBar::TriangularNorth:
- case QTabBar::TriangularEast:
- case QTabBar::TriangularWest:
- case QTabBar::TriangularSouth:
- painter->restore();
- QWindowsStyle::drawPrimitive(element, option, painter, widget);
- return;
- }
-
- painter->restore();
- }
- return;
-
-#endif // QT_NO_TABBAR
-
- case PE_Widget:
- break;
-
- default:
- QCleanlooksStyle::drawPrimitive(element, option, painter, widget);
- }
-}
-
-/*!
- \reimp
-*/
-void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
-
- QPainter *painter, const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable()) {
- QCleanlooksStyle::drawComplexControl(control, option, painter, widget);
- return;
- }
-
- GtkStyle* style = d->gtkStyle();
- QGtkPainter gtkPainter(painter);
- QColor button = option->palette.button().color();
- QColor dark;
- QColor grooveColor;
- QColor darkOutline;
- dark.setHsv(button.hue(),
- qMin(255, (int)(button.saturation()*1.9)),
- qMin(255, (int)(button.value()*0.7)));
- grooveColor.setHsv(button.hue(),
- qMin(255, (int)(button.saturation()*2.6)),
- qMin(255, (int)(button.value()*0.9)));
- darkOutline.setHsv(button.hue(),
- qMin(255, (int)(button.saturation()*3.0)),
- qMin(255, (int)(button.value()*0.6)));
-
- QColor alphaCornerColor;
-
- if (widget)
- alphaCornerColor = mergedColors(option->palette.color(widget->backgroundRole()), darkOutline);
- else
- alphaCornerColor = mergedColors(option->palette.background().color(), darkOutline);
-
- switch (control) {
-
- case CC_TitleBar:
- if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
- // Since this is drawn by metacity and not Gtk we
- // have to rely on Cleanlooks for a fallback
- QStyleOptionTitleBar copyOpt = *tb;
- QPalette pal = copyOpt.palette;
- // Bg color is closer to the window selection than
- // the base selection color
- GdkColor gdkBg = style->bg[GTK_STATE_SELECTED];
- QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
- pal.setBrush(QPalette::Active, QPalette::Highlight, bgColor);
- copyOpt.palette = pal;
- QCleanlooksStyle::drawComplexControl(control, ©Opt, painter, widget);
- }
- break;
-
-#ifndef QT_NO_GROUPBOX
-
- case CC_GroupBox:
- painter->save();
-
- if (const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- QRect textRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxLabel, widget);
- QRect checkBoxRect = proxy()->subControlRect(CC_GroupBox, groupBox, SC_GroupBoxCheckBox, widget);
- // Draw title
-
- if ((groupBox->subControls & QStyle::SC_GroupBoxLabel) && !groupBox->text.isEmpty()) {
- // Draw prelight background
- GtkWidget *gtkCheckButton = d->gtkWidget(QLS("GtkCheckButton"));
-
- if (option->state & State_MouseOver) {
- QRect bgRect = textRect | checkBoxRect;
- gtkPainter.paintFlatBox(gtkCheckButton, "checkbutton", bgRect.adjusted(0, 0, 0, -2),
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkCheckButton->style);
- }
-
- if (!groupBox->text.isEmpty()) {
- int alignment = int(groupBox->textAlignment);
- if (!proxy()->styleHint(QStyle::SH_UnderlineShortcut, option, widget))
- alignment |= Qt::TextHideMnemonic;
- QColor textColor = groupBox->textColor; // Note: custom textColor is currently ignored
- int labelState = GTK_STATE_INSENSITIVE;
-
- if (option->state & State_Enabled)
- labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
-
- GdkColor gdkText = gtkCheckButton->style->fg[labelState];
- textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- painter->setPen(textColor);
- QFont font = painter->font();
- font.setBold(true);
- painter->setFont(font);
- painter->drawText(textRect, Qt::TextShowMnemonic | Qt::AlignLeft| alignment, groupBox->text);
-
- if (option->state & State_HasFocus)
- gtkPainter.paintFocus( NULL, "tab", textRect.adjusted(-4, -1, 0, -3), GTK_STATE_ACTIVE, style);
- }
- }
-
- if (groupBox->subControls & SC_GroupBoxCheckBox) {
- QStyleOptionButton box;
- box.QStyleOption::operator=(*groupBox);
- box.rect = checkBoxRect;
- proxy()->drawPrimitive(PE_IndicatorCheckBox, &box, painter, widget);
- }
- }
-
- painter->restore();
- break;
-#endif // QT_NO_GROUPBOX
-
-#ifndef QT_NO_COMBOBOX
-
- case CC_ComboBox:
- // See: http://live.gnome.org/GnomeArt/Tutorials/GtkThemes/GtkComboBox
- // and http://live.gnome.org/GnomeArt/Tutorials/GtkThemes/GtkComboBoxEntry
- if (const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- bool sunken = comboBox->state & State_On; // play dead, if combobox has no items
- BEGIN_STYLE_PIXMAPCACHE(QString::fromLatin1("cb-%0-%1").arg(sunken).arg(comboBox->editable));
- QGtkPainter gtkCachedPainter(p);
- gtkCachedPainter.setUsePixmapCache(false); // cached externally
-
- bool isEnabled = (comboBox->state & State_Enabled);
- bool focus = isEnabled && (comboBox->state & State_HasFocus);
- GtkStateType state = gtkPainter.gtkState(option);
- int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, comboBox, widget);
- QStyleOptionComboBox comboBoxCopy = *comboBox;
- comboBoxCopy.rect = option->rect;
-
- bool reverse = (option->direction == Qt::RightToLeft);
- QRect rect = option->rect;
- QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
- SC_ComboBoxArrow, widget);
-
- GtkShadowType shadow = (option->state & State_Sunken || option->state & State_On ) ?
- GTK_SHADOW_IN : GTK_SHADOW_OUT;
- const QString comboBoxPath = comboBox->editable ? QLatin1String("GtkComboBoxEntry") : QLatin1String("GtkComboBox");
-
- // We use the gtk widget to position arrows and separators for us
- GtkWidget *gtkCombo = d->gtkWidget(comboBoxPath);
- GtkAllocation geometry = {0, 0, option->rect.width(), option->rect.height()};
- gtk_widget_set_direction(gtkCombo, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- gtk_widget_size_allocate(gtkCombo, &geometry);
-
- QString buttonPath = comboBox->editable ? QLatin1String("GtkComboBoxEntry.GtkToggleButton")
- : QLatin1String("GtkComboBox.GtkToggleButton");
- GtkWidget *gtkToggleButton = d->gtkWidget(buttonPath);
- gtk_widget_set_direction(gtkToggleButton, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- if (gtkToggleButton && (appears_as_list || comboBox->editable)) {
- if (focus)
- GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- // Draw the combo box as a line edit with a button next to it
- if (comboBox->editable || appears_as_list) {
- GtkStateType frameState = (state == GTK_STATE_PRELIGHT) ? GTK_STATE_NORMAL : state;
- QString entryPath = comboBox->editable ? QLatin1String("GtkComboBoxEntry.GtkEntry") : QLatin1String("GtkComboBox.GtkFrame");
- GtkWidget *gtkEntry = d->gtkWidget(entryPath);
- gtk_widget_set_direction(gtkEntry, reverse ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- QRect frameRect = option->rect;
-
- if (reverse)
- frameRect.setLeft(arrowButtonRect.right());
- else
- frameRect.setRight(arrowButtonRect.left());
-
- // Fill the line edit background
- // We could have used flat_box with "entry_bg" but that is probably not worth the overhead
- uint resolve_mask = option->palette.resolve();
- int xt = gtkEntry->style->xthickness;
- int yt = gtkEntry->style->ythickness;
- QRect contentRect = frameRect.adjusted(xt, yt, -xt, -yt);
- // Required for inner blue highlight with clearlooks
- if (focus)
- GTK_WIDGET_SET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
-
- if (widget && widget->testAttribute(Qt::WA_SetPalette) &&
- resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
- p->fillRect(contentRect, option->palette.base().color());
- else {
- gtkCachedPainter.paintFlatBox(gtkEntry, "entry_bg", contentRect,
- option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
- GTK_SHADOW_NONE, gtkEntry->style, entryPath + QString::number(focus));
- }
-
- gtkCachedPainter.paintShadow(gtkEntry, comboBox->editable ? "entry" : "frame", frameRect, frameState,
- GTK_SHADOW_IN, gtkEntry->style, entryPath +
- QString::number(focus) + QString::number(comboBox->editable) +
- QString::number(option->direction));
- if (focus)
- GTK_WIDGET_UNSET_FLAGS(gtkEntry, GTK_HAS_FOCUS);
- }
-
- GtkStateType buttonState = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled))
- buttonState = GTK_STATE_INSENSITIVE;
- else if (option->state & State_Sunken || option->state & State_On)
- buttonState = GTK_STATE_ACTIVE;
- else if (option->state & State_MouseOver && comboBox->activeSubControls & SC_ComboBoxArrow)
- buttonState = GTK_STATE_PRELIGHT;
-
- Q_ASSERT(gtkToggleButton);
- gtkCachedPainter.paintBox( gtkToggleButton, "button", arrowButtonRect, buttonState,
- shadow, gtkToggleButton->style, buttonPath +
- QString::number(focus) + QString::number(option->direction));
- if (focus)
- GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- } else {
- // Draw combo box as a button
- QRect buttonRect = option->rect;
-
- if (focus) // Clearlooks actually check the widget for the default state
- GTK_WIDGET_SET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
- gtkCachedPainter.paintBox(gtkToggleButton, "button",
- buttonRect, state,
- shadow, gtkToggleButton->style,
- buttonPath + QString::number(focus));
- if (focus)
- GTK_WIDGET_UNSET_FLAGS(gtkToggleButton, GTK_HAS_FOCUS);
-
-
- // Draw the separator between label and arrows
- QString vSeparatorPath = comboBox->editable
- ? QLatin1String("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkVSeparator")
- : QLatin1String("GtkComboBox.GtkToggleButton.GtkHBox.GtkVSeparator");
-
- if (GtkWidget *gtkVSeparator = d->gtkWidget(vSeparatorPath)) {
- QRect vLineRect(gtkVSeparator->allocation.x,
- gtkVSeparator->allocation.y,
- gtkVSeparator->allocation.width,
- gtkVSeparator->allocation.height);
-
- gtkCachedPainter.paintVline( gtkVSeparator, "vseparator",
- vLineRect, state, gtkVSeparator->style,
- 0, vLineRect.height(), 0, vSeparatorPath);
-
-
- gint interiorFocus = true;
- gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
- int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
- int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
- if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
- gtkCachedPainter.paintFocus(gtkToggleButton, "button",
- option->rect.adjusted(xt, yt, -xt, -yt),
- option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
- gtkToggleButton->style);
- }
- }
-
- if (comboBox->subControls & SC_ComboBoxArrow) {
- if (!isEnabled)
- state = GTK_STATE_INSENSITIVE;
- else if (sunken)
- state = GTK_STATE_ACTIVE;
- else if (option->state & State_MouseOver)
- state = GTK_STATE_PRELIGHT;
- else
- state = GTK_STATE_NORMAL;
-
- QString arrowPath = QLatin1String("");
- if (comboBox->editable) {
- if (appears_as_list)
- arrowPath = QLatin1String("GtkComboBoxEntry.GtkToggleButton.GtkArrow");
- else
- arrowPath = QLatin1String("GtkComboBoxEntry.GtkToggleButton.GtkHBox.GtkArrow");
- } else {
- if (appears_as_list)
- arrowPath = QLatin1String("GtkComboBox.GtkToggleButton.GtkArrow");
- else
- arrowPath = QLatin1String("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow");
- }
-
- GtkWidget *gtkArrow = d->gtkWidget(arrowPath);
- gfloat scale = 0.7;
- gint minSize = 15;
- QRect arrowWidgetRect;
-
- if (gtkArrow && !gtk_check_version(2, 12, 0)) {
- gtk_widget_style_get(gtkArrow, "arrow-scaling", &scale, NULL);
- gtk_widget_style_get(gtkCombo, "arrow-size", &minSize, NULL);
- }
- if (gtkArrow) {
- arrowWidgetRect = QRect(gtkArrow->allocation.x, gtkArrow->allocation.y,
- gtkArrow->allocation.width, gtkArrow->allocation.height);
- style = gtkArrow->style;
- }
-
- // Note that for some reason the arrow-size is not properly respected with Hildon
- // Hence we enforce the minimum "arrow-size" ourselves
- int arrowSize = qMax(qMin(rect.height() - gtkCombo->style->ythickness * 2, minSize),
- qMin(arrowWidgetRect.width(), arrowWidgetRect.height()));
- QRect arrowRect(0, 0, static_cast<int>(arrowSize * scale), static_cast<int>(arrowSize * scale));
-
- arrowRect.moveCenter(arrowWidgetRect.center());
-
- if (sunken) {
- int xoff, yoff;
- const QString toggleButtonPath = comboBox->editable
- ? QLatin1String("GtkComboBoxEntry.GtkToggleButton")
- : QLatin1String("GtkComboBox.GtkToggleButton");
-
- GtkWidget *gtkButton = d->gtkWidget(toggleButtonPath);
- gtk_widget_style_get(gtkButton, "child-displacement-x", &xoff, NULL);
- gtk_widget_style_get(gtkButton, "child-displacement-y", &yoff, NULL);
- arrowRect = arrowRect.adjusted(xoff, yoff, xoff, yoff);
- }
-
- // Some styles such as Nimbus paint outside the arrowRect
- // hence we have provide the whole widget as the cliprect
- if (gtkArrow) {
- gtkCachedPainter.setClipRect(option->rect);
- gtkCachedPainter.paintArrow( gtkArrow, "arrow", arrowRect,
- GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, TRUE,
- style, arrowPath + QString::number(option->direction));
- }
- }
- END_STYLE_PIXMAPCACHE;
- }
- break;
-#endif // QT_NO_COMBOBOX
-#ifndef QT_NO_TOOLBUTTON
-
- case CC_ToolButton:
- if (const QStyleOptionToolButton *toolbutton
- = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- QRect button, menuarea;
- button = proxy()->subControlRect(control, toolbutton, SC_ToolButton, widget);
- menuarea = proxy()->subControlRect(control, toolbutton, SC_ToolButtonMenu, widget);
- State bflags = toolbutton->state & ~(State_Sunken | State_MouseOver);
-
- if (bflags & State_AutoRaise)
- if (!(bflags & State_MouseOver))
- bflags &= ~State_Raised;
-
- State mflags = bflags;
-
- if (toolbutton->state & State_Sunken) {
- if (toolbutton->activeSubControls & SC_ToolButton)
- bflags |= State_Sunken;
- if (toolbutton->activeSubControls & SC_ToolButtonMenu)
- mflags |= State_Sunken;
- } else if (toolbutton->state & State_MouseOver) {
- if (toolbutton->activeSubControls & SC_ToolButton)
- bflags |= State_MouseOver;
- if (toolbutton->activeSubControls & SC_ToolButtonMenu)
- mflags |= State_MouseOver;
- }
-
- QStyleOption tool(0);
-
- tool.palette = toolbutton->palette;
-
- if (toolbutton->subControls & SC_ToolButton) {
- if (bflags & (State_Sunken | State_On | State_Raised | State_MouseOver)) {
- tool.rect = button;
- tool.state = bflags;
- proxy()->drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
- }
- }
-
- bool drawMenuArrow = toolbutton->features & QStyleOptionToolButton::HasMenu &&
- !(toolbutton->features & QStyleOptionToolButton::MenuButtonPopup);
- int popupArrowSize = drawMenuArrow ? 7 : 0;
-
- if (toolbutton->state & State_HasFocus) {
- QStyleOptionFocusRect fr;
- fr.QStyleOption::operator=(*toolbutton);
- fr.rect = proxy()->subControlRect(CC_ToolButton, toolbutton, SC_ToolButton, widget);
- fr.rect.adjust(1, 1, -1, -1);
- proxy()->drawPrimitive(PE_FrameFocusRect, &fr, painter, widget);
- }
-
- QStyleOptionToolButton label = *toolbutton;
- label.state = bflags;
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
- QPalette pal = toolbutton->palette;
- if (option->state & State_Enabled &&
- option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) {
- GdkColor gdkText = gtkButton->style->fg[GTK_STATE_PRELIGHT];
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- pal.setBrush(QPalette::All, QPalette::ButtonText, textColor);
- label.palette = pal;
- }
- label.rect = button.adjusted(style->xthickness, style->ythickness,
- -style->xthickness - popupArrowSize, -style->ythickness);
- proxy()->drawControl(CE_ToolButtonLabel, &label, painter, widget);
-
- if (toolbutton->subControls & SC_ToolButtonMenu) {
- tool.rect = menuarea;
- tool.state = mflags;
- if ((mflags & State_Enabled && (mflags & (State_Sunken | State_Raised | State_MouseOver))) || !(mflags & State_AutoRaise))
- proxy()->drawPrimitive(PE_IndicatorButtonDropDown, &tool, painter, widget);
-
- proxy()->drawPrimitive(PE_IndicatorArrowDown, &tool, painter, widget);
-
- } else if (drawMenuArrow) {
- QRect ir = toolbutton->rect;
- QStyleOptionToolButton newBtn = *toolbutton;
- newBtn.rect = QRect(ir.right() - popupArrowSize - style->xthickness - 3, ir.height()/2 - 1, popupArrowSize, popupArrowSize);
- proxy()->drawPrimitive(PE_IndicatorArrowDown, &newBtn, painter, widget);
- }
- }
- break;
-
-#endif // QT_NO_TOOLBUTTON
-#ifndef QT_NO_SCROLLBAR
-
- case CC_ScrollBar:
- if (const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- GtkWidget *gtkHScrollBar = d->gtkWidget(QLS("GtkHScrollbar"));
- GtkWidget *gtkVScrollBar = d->gtkWidget(QLS("GtkVScrollbar"));
-
- // Fill background in case the scrollbar is partially transparent
- painter->fillRect(option->rect, option->palette.background());
-
- QRect rect = scrollBar->rect;
- QRect scrollBarSubLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSubLine, widget);
- QRect scrollBarAddLine = proxy()->subControlRect(control, scrollBar, SC_ScrollBarAddLine, widget);
- QRect scrollBarSlider = proxy()->subControlRect(control, scrollBar, SC_ScrollBarSlider, widget);
- QRect grooveRect = proxy()->subControlRect(control, scrollBar, SC_ScrollBarGroove, widget);
- bool horizontal = scrollBar->orientation == Qt::Horizontal;
- GtkWidget * scrollbarWidget = horizontal ? gtkHScrollBar : gtkVScrollBar;
- style = scrollbarWidget->style;
- gboolean trough_under_steppers = true;
- gboolean trough_side_details = false;
- gboolean activate_slider = false;
- gboolean stepper_size = 14;
- gint trough_border = 1;
- if (!gtk_check_version(2, 10, 0)) {
- gtk_widget_style_get((GtkWidget*)(scrollbarWidget),
- "trough-border", &trough_border,
- "trough-side-details", &trough_side_details,
- "trough-under-steppers", &trough_under_steppers,
- "activate-slider", &activate_slider,
- "stepper-size", &stepper_size, NULL);
- }
- if (trough_under_steppers) {
- scrollBarAddLine.adjust(trough_border, trough_border, -trough_border, -trough_border);
- scrollBarSubLine.adjust(trough_border, trough_border, -trough_border, -trough_border);
- scrollBarSlider.adjust(horizontal ? -trough_border : 0, horizontal ? 0 : -trough_border,
- horizontal ? trough_border : 0, horizontal ? 0 : trough_border);
- }
-
- // Some styles check the position of scrollbars in order to determine
- // if lines should be painted when the scrollbar is in max or min positions.
- int maximum = 2;
- int fakePos = 0;
- bool reverse = (option->direction == Qt::RightToLeft);
- if (scrollBar->minimum == scrollBar->maximum)
- maximum = 0;
- if (scrollBar->sliderPosition == scrollBar->maximum)
- fakePos = maximum;
- else if (scrollBar->sliderPosition > scrollBar->minimum)
- fakePos = maximum - 1;
-
-
- GtkRange *range = (GtkRange*)(horizontal ? gtkHScrollBar : gtkVScrollBar);
- GtkAdjustment *adjustment = gtk_range_get_adjustment(range);
- if (adjustment) {
- gtk_adjustment_configure(adjustment, fakePos, 0, maximum, 0, 0, 0);
- } else {
- adjustment = (GtkAdjustment*) gtk_adjustment_new(fakePos, 0, maximum, 0, 0, 0);
- gtk_range_set_adjustment(range, adjustment);
- }
-
- if (scrollBar->subControls & SC_ScrollBarGroove) {
- GtkStateType state = GTK_STATE_ACTIVE;
-
- if (!(option->state & State_Enabled))
- state = GTK_STATE_INSENSITIVE;
-
- if (trough_under_steppers)
- grooveRect = option->rect;
-
- gtkPainter.paintBox( scrollbarWidget, "trough", grooveRect, state, GTK_SHADOW_IN, style);
- }
-
- //paint slider
- if (scrollBar->subControls & SC_ScrollBarSlider) {
- GtkStateType state = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled))
- state = GTK_STATE_INSENSITIVE;
- else if (activate_slider &&
- option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSlider))
- state = GTK_STATE_ACTIVE;
- else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSlider))
- state = GTK_STATE_PRELIGHT;
-
- GtkShadowType shadow = GTK_SHADOW_OUT;
-
- if (trough_under_steppers) {
- if (!horizontal)
- scrollBarSlider.adjust(trough_border, 0, -trough_border, 0);
- else
- scrollBarSlider.adjust(0, trough_border, 0, -trough_border);
- }
-
- gtkPainter.paintSlider( scrollbarWidget, "slider", scrollBarSlider, state, shadow, style,
-
- horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL, QString(QLS("%0%1")).arg(fakePos).arg(maximum));
- }
-
- if (scrollBar->subControls & SC_ScrollBarAddLine) {
- gtkVScrollBar->allocation.y = scrollBarAddLine.top();
- gtkVScrollBar->allocation.height = scrollBarAddLine.height() - rect.height() + 6;
- gtkHScrollBar->allocation.x = scrollBarAddLine.right();
- gtkHScrollBar->allocation.width = scrollBarAddLine.width() - rect.width();
-
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled) || (fakePos == maximum))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarAddLine)) {
- state = GTK_STATE_ACTIVE;
- shadow = GTK_SHADOW_IN;
-
- } else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarAddLine))
- state = GTK_STATE_PRELIGHT;
-
- gtkPainter.paintBox( scrollbarWidget,
- horizontal ? "hscrollbar" : "vscrollbar", scrollBarAddLine,
- state, shadow, style, QLS("add"));
-
- gtkPainter.paintArrow( scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarAddLine.adjusted(4, 4, -4, -4),
- horizontal ? (reverse ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT) :
- GTK_ARROW_DOWN, state, GTK_SHADOW_NONE, FALSE, style);
- }
-
- if (scrollBar->subControls & SC_ScrollBarSubLine) {
- gtkVScrollBar->allocation.y = 0;
- gtkVScrollBar->allocation.height = scrollBarSubLine.height();
- gtkHScrollBar->allocation.x = 0;
- gtkHScrollBar->allocation.width = scrollBarSubLine.width();
-
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled) || (fakePos == 0))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & State_Sunken && (scrollBar->activeSubControls & SC_ScrollBarSubLine)) {
- shadow = GTK_SHADOW_IN;
- state = GTK_STATE_ACTIVE;
-
- } else if (option->state & State_MouseOver && (scrollBar->activeSubControls & SC_ScrollBarSubLine))
- state = GTK_STATE_PRELIGHT;
-
- gtkPainter.paintBox(scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarSubLine,
- state, shadow, style, QLS("sub"));
-
- gtkPainter.paintArrow(scrollbarWidget, horizontal ? "hscrollbar" : "vscrollbar", scrollBarSubLine.adjusted(4, 4, -4, -4),
- horizontal ? (reverse ? GTK_ARROW_RIGHT : GTK_ARROW_LEFT) :
- GTK_ARROW_UP, state, GTK_SHADOW_NONE, FALSE, style);
- }
- }
- break;
-
-#endif //QT_NO_SCROLLBAR
-#ifndef QT_NO_SPINBOX
-
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
-
- GtkWidget *gtkSpinButton = spinBox->buttonSymbols == QAbstractSpinBox::NoButtons
- ? d->gtkWidget(QLS("GtkEntry"))
- : d->gtkWidget(QLS("GtkSpinButton"));
- bool isEnabled = (spinBox->state & State_Enabled);
- bool hover = isEnabled && (spinBox->state & State_MouseOver);
- bool sunken = (spinBox->state & State_Sunken);
- bool upIsActive = (spinBox->activeSubControls == SC_SpinBoxUp);
- bool downIsActive = (spinBox->activeSubControls == SC_SpinBoxDown);
- bool reverse = (spinBox->direction == Qt::RightToLeft);
-
- QRect editArea = option->rect;
- QRect editRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxEditField, widget);
- QRect upRect, downRect, buttonRect;
- if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
- upRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
- downRect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
-
- //### Move this to subControlRect
- upRect.setTop(option->rect.top());
-
- if (reverse)
- upRect.setLeft(option->rect.left());
- else
- upRect.setRight(option->rect.right());
-
- downRect.setBottom(option->rect.bottom());
-
- if (reverse)
- downRect.setLeft(option->rect.left());
- else
- downRect.setRight(option->rect.right());
-
- buttonRect = upRect | downRect;
-
- if (reverse)
- editArea.setLeft(upRect.right());
- else
- editArea.setRight(upRect.left());
- }
- if (spinBox->frame) {
- GtkStateType state = gtkPainter.gtkState(option);
-
- if (!(option->state & State_Enabled))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & State_HasFocus)
- state = GTK_STATE_NORMAL;
- else if (state == GTK_STATE_PRELIGHT)
- state = GTK_STATE_NORMAL;
-
- style = gtkPainter.getStyle(gtkSpinButton);
-
-
- QString key;
-
- if (option->state & State_HasFocus) {
- key += QLatin1Char('f');
- GTK_WIDGET_SET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
- }
-
- uint resolve_mask = option->palette.resolve();
-
- if (resolve_mask & (1 << QPalette::Base)) // Palette overridden by user
- painter->fillRect(editRect, option->palette.base().color());
- else
- gtkPainter.paintFlatBox(gtkSpinButton, "entry_bg", editArea.adjusted(style->xthickness, style->ythickness,
- -style->xthickness, -style->ythickness),
- option->state & State_Enabled ?
- GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE, GTK_SHADOW_NONE, style, key);
-
- gtkPainter.paintShadow(gtkSpinButton, "entry", editArea, state, GTK_SHADOW_IN, gtkSpinButton->style, key);
- if (spinBox->buttonSymbols != QAbstractSpinBox::NoButtons) {
- gtkPainter.paintBox(gtkSpinButton, "spinbutton", buttonRect, state, GTK_SHADOW_IN, style, key);
-
- upRect.setSize(downRect.size());
- if (!(option->state & State_Enabled))
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key);
- else if (upIsActive && sunken)
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key);
- else if (upIsActive && hover)
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key);
- else
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_up", upRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
-
- if (!(option->state & State_Enabled))
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_INSENSITIVE, GTK_SHADOW_IN, style, key);
- else if (downIsActive && sunken)
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_ACTIVE, GTK_SHADOW_IN, style, key);
- else if (downIsActive && hover)
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style, key);
- else
- gtkPainter.paintBox( gtkSpinButton, "spinbutton_down", downRect, GTK_STATE_NORMAL, GTK_SHADOW_OUT, style, key);
-
- if (option->state & State_HasFocus)
- GTK_WIDGET_UNSET_FLAGS(gtkSpinButton, GTK_HAS_FOCUS);
- }
- }
-
- if (spinBox->buttonSymbols == QAbstractSpinBox::PlusMinus) {
- int centerX = upRect.center().x();
- int centerY = upRect.center().y();
- // plus/minus
-
- if (spinBox->activeSubControls == SC_SpinBoxUp && sunken) {
- painter->drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
- painter->drawLine(1 + centerX, 1 + centerY - 2, 1 + centerX, 1 + centerY + 2);
-
- } else {
- painter->drawLine(centerX - 2, centerY, centerX + 2, centerY);
- painter->drawLine(centerX, centerY - 2, centerX, centerY + 2);
- }
- centerX = downRect.center().x();
- centerY = downRect.center().y();
-
- if (spinBox->activeSubControls == SC_SpinBoxDown && sunken) {
- painter->drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
- } else {
- painter->drawLine(centerX - 2, centerY, centerX + 2, centerY);
- }
-
- } else if (spinBox->buttonSymbols == QAbstractSpinBox::UpDownArrows) {
- int size = d->getSpinboxArrowSize();
- int w = size / 2 - 1;
- w -= w % 2 - 1; // force odd
- int h = (w + 1)/2;
- QRect arrowRect(0, 0, w, h);
- arrowRect.moveCenter(upRect.center());
- // arrows
- GtkStateType state = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled) || !(spinBox->stepEnabled & QAbstractSpinBox::StepUpEnabled))
- state = GTK_STATE_INSENSITIVE;
-
- gtkPainter.paintArrow( gtkSpinButton, "spinbutton", arrowRect, GTK_ARROW_UP, state,
- GTK_SHADOW_NONE, FALSE, style);
-
- arrowRect.moveCenter(downRect.center());
-
- if (!(option->state & State_Enabled) || !(spinBox->stepEnabled & QAbstractSpinBox::StepDownEnabled))
- state = GTK_STATE_INSENSITIVE;
-
- gtkPainter.paintArrow( gtkSpinButton, "spinbutton", arrowRect, GTK_ARROW_DOWN, state,
- GTK_SHADOW_NONE, FALSE, style);
- }
- }
- break;
-
-#endif // QT_NO_SPINBOX
-
-#ifndef QT_NO_SLIDER
-
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- GtkWidget *hScaleWidget = d->gtkWidget(QLS("GtkHScale"));
- GtkWidget *vScaleWidget = d->gtkWidget(QLS("GtkVScale"));
-
- QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget);
- QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget);
-
- bool horizontal = slider->orientation == Qt::Horizontal;
- bool ticksAbove = slider->tickPosition & QSlider::TicksAbove;
- bool ticksBelow = slider->tickPosition & QSlider::TicksBelow;
-
- QBrush oldBrush = painter->brush();
- QPen oldPen = painter->pen();
-
- QColor shadowAlpha(Qt::black);
- shadowAlpha.setAlpha(10);
- QColor highlightAlpha(Qt::white);
- highlightAlpha.setAlpha(80);
-
- gtk_widget_set_direction(hScaleWidget, slider->upsideDown ?
- GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- GtkWidget *scaleWidget = horizontal ? hScaleWidget : vScaleWidget;
- style = scaleWidget->style;
-
- if ((option->subControls & SC_SliderGroove) && groove.isValid()) {
-
- GtkRange *range = (GtkRange*)scaleWidget;
- GtkAdjustment *adjustment = gtk_range_get_adjustment(range);
- if (adjustment) {
- gtk_adjustment_configure(adjustment,
- slider->sliderPosition,
- slider->minimum,
- slider->maximum,
- slider->singleStep,
- slider->singleStep,
- slider->pageStep);
- } else {
- adjustment = (GtkAdjustment*)gtk_adjustment_new(slider->sliderPosition,
- slider->minimum,
- slider->maximum,
- slider->singleStep,
- slider->singleStep,
- slider->pageStep);
- gtk_range_set_adjustment(range, adjustment);
- }
-
- int outerSize;
- gtk_range_set_inverted(range, !horizontal);
- gtk_widget_style_get(scaleWidget, "trough-border", &outerSize, NULL);
- outerSize++;
-
- GtkStateType state = gtkPainter.gtkState(option);
- int focusFrameMargin = 2;
- QRect grooveRect = option->rect.adjusted(focusFrameMargin, outerSize + focusFrameMargin,
- -focusFrameMargin, -outerSize - focusFrameMargin);
-
- gboolean trough_side_details = false; // Indicates if the upper or lower scale background differs
- if (!gtk_check_version(2, 10, 0))
- gtk_widget_style_get((GtkWidget*)(scaleWidget), "trough-side-details", &trough_side_details, NULL);
-
- if (!trough_side_details) {
- gtkPainter.paintBox( scaleWidget, "trough", grooveRect, state,
- GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
- } else {
- QRect upperGroove = grooveRect;
- QRect lowerGroove = grooveRect;
-
- if (horizontal) {
- if (slider->upsideDown) {
- lowerGroove.setLeft(handle.center().x());
- upperGroove.setRight(handle.center().x());
- } else {
- upperGroove.setLeft(handle.center().x());
- lowerGroove.setRight(handle.center().x());
- }
- } else {
- if (!slider->upsideDown) {
- lowerGroove.setBottom(handle.center().y());
- upperGroove.setTop(handle.center().y());
- } else {
- upperGroove.setBottom(handle.center().y());
- lowerGroove.setTop(handle.center().y());
- }
- }
-
- gtkPainter.paintBox( scaleWidget, "trough-upper", upperGroove, state,
- GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
- gtkPainter.paintBox( scaleWidget, "trough-lower", lowerGroove, state,
- GTK_SHADOW_IN, style, QString(QLS("p%0")).arg(slider->sliderPosition));
- }
- }
-
- if (option->subControls & SC_SliderTickmarks) {
- painter->setPen(darkOutline);
- int tickSize = proxy()->pixelMetric(PM_SliderTickmarkOffset, option, widget);
- int available = proxy()->pixelMetric(PM_SliderSpaceAvailable, slider, widget);
- int interval = slider->tickInterval;
-
- if (interval <= 0) {
- interval = slider->singleStep;
-
- if (QStyle::sliderPositionFromValue(slider->minimum, slider->maximum, interval,
- available)
- - QStyle::sliderPositionFromValue(slider->minimum, slider->maximum,
- 0, available) < 3)
- interval = slider->pageStep;
- }
-
- if (interval <= 0)
- interval = 1;
-
- int v = slider->minimum;
- int len = proxy()->pixelMetric(PM_SliderLength, slider, widget);
- while (v <= slider->maximum + 1) {
- if (v == slider->maximum + 1 && interval == 1)
- break;
- const int v_ = qMin(v, slider->maximum);
- int pos = sliderPositionFromValue(slider->minimum, slider->maximum,
- v_, (horizontal
- ? slider->rect.width()
- : slider->rect.height()) - len,
- slider->upsideDown) + len / 2;
- int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
- if (horizontal) {
- if (ticksAbove)
- painter->drawLine(pos, slider->rect.top() + extra,
- pos, slider->rect.top() + tickSize);
- if (ticksBelow)
- painter->drawLine(pos, slider->rect.bottom() - extra,
- pos, slider->rect.bottom() - tickSize);
-
- } else {
- if (ticksAbove)
- painter->drawLine(slider->rect.left() + extra, pos,
- slider->rect.left() + tickSize, pos);
- if (ticksBelow)
- painter->drawLine(slider->rect.right() - extra, pos,
- slider->rect.right() - tickSize, pos);
- }
-
- // In the case where maximum is max int
- int nextInterval = v + interval;
- if (nextInterval < v)
- break;
- v = nextInterval;
- }
- }
-
- // Draw slider handle
- if (option->subControls & SC_SliderHandle) {
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = GTK_STATE_NORMAL;
-
- if (!(option->state & State_Enabled))
- state = GTK_STATE_INSENSITIVE;
- else if (option->state & State_MouseOver && option->activeSubControls & SC_SliderHandle)
- state = GTK_STATE_PRELIGHT;
-
- bool horizontal = option->state & State_Horizontal;
-
- if (slider->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*slider);
- fropt.rect = slider->rect.adjusted(-1, -1 ,1, 1);
-
- if (horizontal) {
- fropt.rect.setTop(handle.top() - 3);
- fropt.rect.setBottom(handle.bottom() + 4);
-
- } else {
- fropt.rect.setLeft(handle.left() - 3);
- fropt.rect.setRight(handle.right() + 3);
- }
- proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- gtkPainter.paintSlider( scaleWidget, horizontal ? "hscale" : "vscale", handle, state, shadow, style,
-
- horizontal ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
- }
- painter->setBrush(oldBrush);
- painter->setPen(oldPen);
- }
- break;
-
-#endif // QT_NO_SLIDER
-
- default:
- QCleanlooksStyle::drawComplexControl(control, option, painter, widget);
-
- break;
- }
-}
-
-
-/*!
- \reimp
-*/
-void QGtkStyle::drawControl(ControlElement element,
- const QStyleOption *option,
- QPainter *painter,
- const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable()) {
- QCleanlooksStyle::drawControl(element, option, painter, widget);
- return;
- }
-
- GtkStyle* style = d->gtkStyle();
- QGtkPainter gtkPainter(painter);
-
- switch (element) {
- case CE_ProgressBarLabel:
- if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
- if (!gtkProgressBar)
- return;
-
- QRect leftRect;
- QRect rect = bar->rect;
- GdkColor gdkText = gtkProgressBar->style->fg[GTK_STATE_NORMAL];
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- gdkText = gtkProgressBar->style->fg[GTK_STATE_PRELIGHT];
- QColor alternateTextColor= QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
-
- painter->save();
- bool vertical = false, inverted = false;
- if (const QStyleOptionProgressBarV2 *bar2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
- vertical = (bar2->orientation == Qt::Vertical);
- inverted = bar2->invertedAppearance;
- }
- if (vertical)
- rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // flip width and height
- const int progressIndicatorPos = (bar->progress - qreal(bar->minimum)) * rect.width() /
- qMax(qreal(1.0), qreal(bar->maximum) - bar->minimum);
- if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.width())
- leftRect = QRect(rect.left(), rect.top(), progressIndicatorPos, rect.height());
- if (vertical)
- leftRect.translate(rect.width() - progressIndicatorPos, 0);
-
- bool flip = (!vertical && (((bar->direction == Qt::RightToLeft) && !inverted) ||
- ((bar->direction == Qt::LeftToRight) && inverted)));
-
- QRegion rightRect = rect;
- rightRect = rightRect.subtracted(leftRect);
- painter->setClipRegion(rightRect);
- painter->setPen(flip ? alternateTextColor : textColor);
- painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
- if (!leftRect.isNull()) {
- painter->setPen(flip ? textColor : alternateTextColor);
- painter->setClipRect(leftRect);
- painter->drawText(rect, bar->text, QTextOption(Qt::AlignAbsolute | Qt::AlignHCenter | Qt::AlignVCenter));
- }
- painter->restore();
- }
- break;
- case CE_PushButtonLabel:
- if (const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- QRect ir = button->rect;
- uint tf = Qt::AlignVCenter | Qt::TextShowMnemonic;
- QPoint buttonShift;
-
- if (option->state & State_Sunken)
- buttonShift = QPoint(pixelMetric(PM_ButtonShiftHorizontal, option, widget),
- proxy()->pixelMetric(PM_ButtonShiftVertical, option, widget));
-
- if (proxy()->styleHint(SH_UnderlineShortcut, button, widget))
- tf |= Qt::TextShowMnemonic;
- else
- tf |= Qt::TextHideMnemonic;
-
- if (!button->icon.isNull()) {
- //Center both icon and text
- QPoint point;
-
- QIcon::Mode mode = button->state & State_Enabled ? QIcon::Normal : QIcon::Disabled;
- if (mode == QIcon::Normal && button->state & State_HasFocus)
- mode = QIcon::Active;
-
- QIcon::State state = QIcon::Off;
-
- if (button->state & State_On)
- state = QIcon::On;
-
- QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
- int w = pixmap.width();
- int h = pixmap.height();
-
- if (!button->text.isEmpty())
- w += button->fontMetrics.boundingRect(option->rect, tf, button->text).width() + 4;
-
- point = QPoint(ir.x() + ir.width() / 2 - w / 2,
- ir.y() + ir.height() / 2 - h / 2);
-
- if (button->direction == Qt::RightToLeft)
- point.rx() += pixmap.width();
-
- painter->drawPixmap(visualPos(button->direction, button->rect, point + buttonShift), pixmap);
-
- if (button->direction == Qt::RightToLeft)
- ir.translate(-point.x() - 2, 0);
- else
- ir.translate(point.x() + pixmap.width() + 2, 0);
-
- // left-align text if there is
- if (!button->text.isEmpty())
- tf |= Qt::AlignLeft;
-
- } else {
- tf |= Qt::AlignHCenter;
- }
-
- ir.translate(buttonShift);
-
- if (button->features & QStyleOptionButton::HasMenu)
- ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
-
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
- QPalette pal = button->palette;
- int labelState = GTK_STATE_INSENSITIVE;
- if (option->state & State_Enabled)
- labelState = (option->state & State_MouseOver && !(option->state & State_Sunken)) ?
- GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
-
- GdkColor gdkText = gtkButton->style->fg[labelState];
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- pal.setBrush(QPalette::ButtonText, textColor);
- proxy()->drawItemText(painter, ir, tf, pal, (button->state & State_Enabled),
- button->text, QPalette::ButtonText);
- }
- break;
-
- case CE_RadioButton: // Fall through
- case CE_CheckBox:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- bool isRadio = (element == CE_RadioButton);
-
- // Draw prelight background
- GtkWidget *gtkRadioButton = d->gtkWidget(QLS("GtkRadioButton"));
-
- if (option->state & State_MouseOver) {
- gtkPainter.paintFlatBox(gtkRadioButton, "checkbutton", option->rect,
- GTK_STATE_PRELIGHT, GTK_SHADOW_ETCHED_OUT, gtkRadioButton->style);
- }
-
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator
- : SE_CheckBoxIndicator, btn, widget);
- proxy()->drawPrimitive(isRadio ? PE_IndicatorRadioButton : PE_IndicatorCheckBox,
- &subopt, painter, widget);
- subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
- : SE_CheckBoxContents, btn, widget);
- // Get label text color
- QPalette pal = subopt.palette;
- int labelState = GTK_STATE_INSENSITIVE;
- if (option->state & State_Enabled)
- labelState = (option->state & State_MouseOver) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
-
- GdkColor gdkText = gtkRadioButton->style->fg[labelState];
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- pal.setBrush(QPalette::WindowText, textColor);
- subopt.palette = pal;
- proxy()->drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, painter, widget);
-
- if (btn->state & State_HasFocus) {
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*btn);
- fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect
- : SE_CheckBoxFocusRect, btn, widget);
- proxy()->drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget);
- }
- }
- break;
-
-#ifndef QT_NO_COMBOBOX
-
- case CE_ComboBoxLabel:
- if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- QRect editRect = proxy()->subControlRect(CC_ComboBox, cb, SC_ComboBoxEditField, widget);
- bool appearsAsList = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, cb, widget);
- painter->save();
- painter->setClipRect(editRect);
-
- if (!cb->currentIcon.isNull()) {
- QIcon::Mode mode = cb->state & State_Enabled ? QIcon::Normal
- : QIcon::Disabled;
- QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
- QRect iconRect(editRect);
- iconRect.setWidth(cb->iconSize.width() + 4);
-
- iconRect = alignedRect(cb->direction,
- Qt::AlignLeft | Qt::AlignVCenter,
- iconRect.size(), editRect);
-
- if (cb->editable)
- painter->fillRect(iconRect, option->palette.brush(QPalette::Base));
-
- proxy()->drawItemPixmap(painter, iconRect, Qt::AlignCenter, pixmap);
-
- if (cb->direction == Qt::RightToLeft)
- editRect.translate(-4 - cb->iconSize.width(), 0);
- else
- editRect.translate(cb->iconSize.width() + 4, 0);
- }
-
- if (!cb->currentText.isEmpty() && !cb->editable) {
- GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
- QPalette pal = cb->palette;
- int labelState = GTK_STATE_INSENSITIVE;
-
- if (option->state & State_Enabled)
- labelState = (option->state & State_MouseOver && !appearsAsList) ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL;
-
- GdkColor gdkText = gtkCombo->style->fg[labelState];
-
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
-
- pal.setBrush(QPalette::ButtonText, textColor);
-
- proxy()->drawItemText(painter, editRect.adjusted(1, 0, -1, 0),
- visualAlignment(cb->direction, Qt::AlignLeft | Qt::AlignVCenter),
- pal, cb->state & State_Enabled, cb->currentText, QPalette::ButtonText);
- }
-
- painter->restore();
- }
- break;
-
-#endif // QT_NO_COMBOBOX
-
- case CE_DockWidgetTitle:
- painter->save();
- if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
- const QStyleOptionDockWidgetV2 *v2
- = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(dwOpt);
- bool verticalTitleBar = v2 == 0 ? false : v2->verticalTitleBar;
-
- QRect rect = dwOpt->rect;
- QRect titleRect = subElementRect(SE_DockWidgetTitleBarText, option, widget).adjusted(-2, 0, -2, 0);
- QRect r = rect.adjusted(0, 0, -1, -1);
- if (verticalTitleBar)
- r.adjust(0, 0, 0, -1);
-
- if (verticalTitleBar) {
- QRect r = rect;
- QSize s = r.size();
- s.transpose();
- r.setSize(s);
-
- titleRect = QRect(r.left() + rect.bottom()
- - titleRect.bottom(),
- r.top() + titleRect.left() - rect.left(),
- titleRect.height(), titleRect.width());
-
- painter->translate(r.left(), r.top() + r.width());
- painter->rotate(-90);
- painter->translate(-r.left(), -r.top());
-
- rect = r;
- }
-
- if (!dwOpt->title.isEmpty()) {
- QString titleText
- = painter->fontMetrics().elidedText(dwOpt->title,
- Qt::ElideRight, titleRect.width());
- proxy()->drawItemText(painter,
- titleRect,
- Qt::AlignLeft | Qt::AlignVCenter | Qt::TextShowMnemonic, dwOpt->palette,
- dwOpt->state & State_Enabled, titleText,
- QPalette::WindowText);
- }
- }
- painter->restore();
- break;
-
-
-
- case CE_HeaderSection:
- painter->save();
-
- // Draws the header in tables.
- if (const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
- Q_UNUSED(header);
- GtkWidget *gtkTreeView = d->gtkWidget(QLS("GtkTreeView"));
- // Get the middle column
- GtkTreeViewColumn *column = gtk_tree_view_get_column((GtkTreeView*)gtkTreeView, 1);
- Q_ASSERT(column);
-
- GtkWidget *gtkTreeHeader = column->button;
- GtkStateType state = gtkPainter.gtkState(option);
- GtkShadowType shadow = GTK_SHADOW_OUT;
-
- if (option->state & State_Sunken)
- shadow = GTK_SHADOW_IN;
-
- gtkPainter.paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, gtkTreeHeader->style);
- }
-
- painter->restore();
- break;
-
-#ifndef QT_NO_SIZEGRIP
-
- case CE_SizeGrip: {
- GtkWidget *gtkStatusbar = d->gtkWidget(QLS("GtkStatusbar.GtkFrame"));
- QRect gripRect = option->rect.adjusted(0, 0, -gtkStatusbar->style->xthickness, -gtkStatusbar->style->ythickness);
- gtkPainter.paintResizeGrip( gtkStatusbar, "statusbar", gripRect, GTK_STATE_NORMAL,
- GTK_SHADOW_OUT, QApplication::isRightToLeft() ?
- GDK_WINDOW_EDGE_SOUTH_WEST : GDK_WINDOW_EDGE_SOUTH_EAST,
- gtkStatusbar->style);
- }
- break;
-
-#endif // QT_NO_SIZEGRIP
-
- case CE_MenuBarEmptyArea: {
- GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
- GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
- painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
- if (widget) { // See CE_MenuBarItem
- QRect menuBarRect = widget->rect();
- QPixmap pixmap(menuBarRect.size());
- pixmap.fill(Qt::transparent);
- QPainter pmPainter(&pixmap);
- QGtkPainter gtkMenuBarPainter(&pmPainter);
- GtkShadowType shadow_type;
- gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
- gtkMenuBarPainter.paintBox( gtkMenubar, "menubar", menuBarRect,
- GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
- pmPainter.end();
- painter->drawPixmap(option->rect, pixmap, option->rect);
- }
- }
- break;
-
- case CE_MenuBarItem:
- painter->save();
-
- if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- GtkWidget *gtkMenubarItem = d->gtkWidget(QLS("GtkMenuBar.GtkMenuItem"));
- GtkWidget *gtkMenubar = d->gtkWidget(QLS("GtkMenuBar"));
-
- style = gtkMenubarItem->style;
-
- if (widget) {
- // Since Qt does not currently allow filling the entire background
- // we use a hack for this by making a complete menubar each time and
- // paint with the correct offset inside it. Pixmap caching should resolve
- // most of the performance penalty.
- QRect menuBarRect = widget->rect();
- QPixmap pixmap(menuBarRect.size());
- pixmap.fill(Qt::transparent);
- QPainter pmPainter(&pixmap);
- QGtkPainter menubarPainter(&pmPainter);
- GtkShadowType shadow_type;
- gtk_widget_style_get(gtkMenubar, "shadow-type", &shadow_type, NULL);
- GdkColor gdkBg = gtkMenubar->style->bg[GTK_STATE_NORMAL]; // Theme can depend on transparency
- painter->fillRect(option->rect, QColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8));
- menubarPainter.paintBox(gtkMenubar, "menubar", menuBarRect,
- GTK_STATE_NORMAL, shadow_type, gtkMenubar->style);
- pmPainter.end();
- painter->drawPixmap(option->rect, pixmap, option->rect);
- }
-
- QStyleOptionMenuItem item = *mbi;
- bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
- bool dis = !(mbi->state & State_Enabled);
- item.rect = mbi->rect;
- GdkColor gdkText = gtkMenubarItem->style->fg[dis ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL];
- GdkColor gdkHText = gtkMenubarItem->style->fg[GTK_STATE_PRELIGHT];
- QColor normalTextColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
- item.palette.setBrush(QPalette::HighlightedText, highlightedTextColor);
- item.palette.setBrush(QPalette::Text, normalTextColor);
- item.palette.setBrush(QPalette::ButtonText, normalTextColor);
- QCommonStyle::drawControl(element, &item, painter, widget);
-
- if (act) {
- GtkShadowType shadowType = GTK_SHADOW_NONE;
- gtk_widget_style_get (gtkMenubarItem, "selected-shadow-type", &shadowType, NULL);
- gtkPainter.paintBox(gtkMenubarItem, "menuitem", option->rect.adjusted(0, 0, 0, 3),
- GTK_STATE_PRELIGHT, shadowType, gtkMenubarItem->style);
- //draw text
- QPalette::ColorRole textRole = dis ? QPalette::Text : QPalette::HighlightedText;
- uint alignment = Qt::AlignCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
-
- if (!proxy()->styleHint(SH_UnderlineShortcut, mbi, widget))
- alignment |= Qt::TextHideMnemonic;
-
- proxy()->drawItemText(painter, item.rect, alignment, item.palette, mbi->state & State_Enabled, mbi->text, textRole);
- }
- }
- painter->restore();
- break;
-
- case CE_Splitter: {
- GtkWidget *gtkWindow = d->gtkWidget(QLS("GtkWindow")); // The Murrine Engine currently assumes a widget is passed
- gtkPainter.paintHandle(gtkWindow, "splitter", option->rect, gtkPainter.gtkState(option), GTK_SHADOW_NONE,
- !(option->state & State_Horizontal) ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL,
- style);
- }
- break;
-
-#ifndef QT_NO_TOOLBAR
-
- case CE_ToolBar:
- if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
- // Reserve the beveled appearance only for mainwindow toolbars
- if (!(widget && qobject_cast<const QMainWindow*> (widget->parentWidget())))
- break;
-
- QRect rect = option->rect;
- // There is a 1 pixel gap between toolbar lines in some styles (i.e Human)
- if (toolbar->positionWithinLine != QStyleOptionToolBar::End)
- rect.adjust(0, 0, 1, 0);
-
- GtkWidget *gtkToolbar = d->gtkWidget(QLS("GtkToolbar"));
- GtkShadowType shadow_type = GTK_SHADOW_NONE;
- gtk_widget_style_get(gtkToolbar, "shadow-type", &shadow_type, NULL);
- gtkPainter.paintBox( gtkToolbar, "toolbar", rect,
- GTK_STATE_NORMAL, shadow_type, gtkToolbar->style);
- }
- break;
-
-#endif // QT_NO_TOOLBAR
-
- case CE_MenuItem:
- painter->save();
-
- // Draws one item in a popup menu.
- if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- const int windowsItemFrame = 2; // menu item frame width
- const int windowsItemHMargin = 3; // menu item hor text margin
- const int windowsItemVMargin = 26; // menu item ver text margin
- const int windowsRightBorder = 15; // right border on windows
- GtkWidget *gtkMenuItem = menuItem->checked ? d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")) :
- d->gtkWidget(QLS("GtkMenu.GtkMenuItem"));
-
- style = gtkPainter.getStyle(gtkMenuItem);
- QColor shadow = option->palette.dark().color();
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
- GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
- painter->setPen(shadow.lighter(106));
- gboolean wide_separators = 0;
- gint separator_height = 0;
- guint horizontal_padding = 3;
- QRect separatorRect = option->rect;
- if (!gtk_check_version(2, 10, 0)) {
- gtk_widget_style_get(gtkMenuSeparator,
- "wide-separators", &wide_separators,
- "separator-height", &separator_height,
- "horizontal-padding", &horizontal_padding,
- NULL);
- }
- separatorRect.setHeight(option->rect.height() - 2 * gtkMenuSeparator->style->ythickness);
- separatorRect.setWidth(option->rect.width() - 2 * (horizontal_padding + gtkMenuSeparator->style->xthickness));
- separatorRect.moveCenter(option->rect.center());
- if (wide_separators)
- gtkPainter.paintBox( gtkMenuSeparator, "hseparator",
- separatorRect, GTK_STATE_NORMAL, GTK_SHADOW_NONE, gtkMenuSeparator->style);
- else
- gtkPainter.paintHline( gtkMenuSeparator, "hseparator",
- separatorRect, GTK_STATE_NORMAL, gtkMenuSeparator->style,
- 0, option->rect.right() - 1, 1);
- painter->restore();
- break;
- }
-
- bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
-
- if (selected) {
- QRect rect = option->rect;
-#ifndef QT_NO_COMBOBOX
- if (qobject_cast<const QComboBox*>(widget))
- rect = option->rect;
-#endif
- gtkPainter.paintBox( gtkMenuItem, "menuitem", rect, GTK_STATE_PRELIGHT, GTK_SHADOW_OUT, style);
- }
-
- bool checkable = menuItem->checkType != QStyleOptionMenuItem::NotCheckable;
- bool checked = menuItem->checked;
- bool enabled = menuItem->state & State_Enabled;
- bool ignoreCheckMark = false;
-
- gint checkSize;
- gtk_widget_style_get(d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem")), "indicator-size", &checkSize, NULL);
-
- int checkcol = qMax(menuItem->maxIconWidth, qMax(20, checkSize));
-
-#ifndef QT_NO_COMBOBOX
-
- if (qobject_cast<const QComboBox*>(widget))
- ignoreCheckMark = true; // Ignore the checkmarks provided by the QComboMenuDelegate
-
-#endif
- if (!ignoreCheckMark) {
- // Check
- QRect checkRect(option->rect.left() + 7, option->rect.center().y() - checkSize/2 + 1, checkSize, checkSize);
- checkRect = visualRect(menuItem->direction, menuItem->rect, checkRect);
-
- if (checkable && menuItem->icon.isNull()) {
- // Some themes such as aero-clone draw slightly outside the paint rect
- int spacing = 1; // ### Consider using gtkCheckBox : "indicator-spacing" instead
-
- if (menuItem->checkType & QStyleOptionMenuItem::Exclusive) {
- // Radio button
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = gtkPainter.gtkState(option);
-
- if (selected)
- state = GTK_STATE_PRELIGHT;
- if (checked)
- shadow = GTK_SHADOW_IN;
-
- gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, spacing, spacing));
- gtkPainter.paintOption(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
- gtkMenuItem->style, QLS("option"));
- gtkPainter.setClipRect(QRect());
-
- } else {
- // Check box
- if (menuItem->icon.isNull()) {
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = gtkPainter.gtkState(option);
-
- if (selected)
- state = GTK_STATE_PRELIGHT;
- if (checked)
- shadow = GTK_SHADOW_IN;
-
- gtkPainter.setClipRect(checkRect.adjusted(-spacing, -spacing, -spacing, -spacing));
- gtkPainter.paintCheckbox(gtkMenuItem, checkRect.translated(-spacing, -spacing), state, shadow,
- gtkMenuItem->style, QLS("check"));
- gtkPainter.setClipRect(QRect());
- }
- }
- }
-
- } else {
- // Ignore checkmark
- if (menuItem->icon.isNull())
- checkcol = 0;
- else
- checkcol = menuItem->maxIconWidth;
- }
-
- bool dis = !(menuItem->state & State_Enabled);
- bool act = menuItem->state & State_Selected;
- const QStyleOption *opt = option;
- const QStyleOptionMenuItem *menuitem = menuItem;
- QPainter *p = painter;
- QRect vCheckRect = visualRect(opt->direction, menuitem->rect,
- QRect(menuitem->rect.x() + 3, menuitem->rect.y(),
- checkcol, menuitem->rect.height()));
-
- if (!menuItem->icon.isNull()) {
- QIcon::Mode mode = dis ? QIcon::Disabled : QIcon::Normal;
-
- if (act && !dis)
- mode = QIcon::Active;
-
- QPixmap pixmap;
- int smallIconSize = proxy()->pixelMetric(PM_SmallIconSize, option, widget);
- QSize iconSize(smallIconSize, smallIconSize);
-
-#ifndef QT_NO_COMBOBOX
- if (const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
- iconSize = combo->iconSize();
-
-#endif // QT_NO_COMBOBOX
- if (checked)
- pixmap = menuItem->icon.pixmap(iconSize, mode, QIcon::On);
- else
- pixmap = menuItem->icon.pixmap(iconSize, mode);
-
- int pixw = pixmap.width();
- int pixh = pixmap.height();
- QRect pmr(0, 0, pixw, pixh);
- pmr.moveCenter(vCheckRect.center() - QPoint(0, 1));
- painter->setPen(menuItem->palette.text().color());
- if (!ignoreCheckMark && checkable && checked) {
- QStyleOption opt = *option;
-
- if (act) {
- QColor activeColor = mergedColors(option->palette.background().color(),
- option->palette.highlight().color());
- opt.palette.setBrush(QPalette::Button, activeColor);
- }
- opt.state |= State_Sunken;
- opt.rect = vCheckRect;
- proxy()->drawPrimitive(PE_PanelButtonCommand, &opt, painter, widget);
- }
- painter->drawPixmap(pmr.topLeft(), pixmap);
- }
-
- GdkColor gdkText = gtkMenuItem->style->fg[GTK_STATE_NORMAL];
- GdkColor gdkDText = gtkMenuItem->style->fg[GTK_STATE_INSENSITIVE];
- GdkColor gdkHText = gtkMenuItem->style->fg[GTK_STATE_PRELIGHT];
- uint resolve_mask = option->palette.resolve();
- QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- QColor disabledTextColor = QColor(gdkDText.red>>8, gdkDText.green>>8, gdkDText.blue>>8);
- if (resolve_mask & (1 << QPalette::ButtonText)) {
- textColor = option->palette.buttonText().color();
- disabledTextColor = option->palette.brush(QPalette::Disabled, QPalette::ButtonText).color();
- }
-
- QColor highlightedTextColor = QColor(gdkHText.red>>8, gdkHText.green>>8, gdkHText.blue>>8);
- if (resolve_mask & (1 << QPalette::HighlightedText)) {
- highlightedTextColor = option->palette.highlightedText().color();
- }
-
- if (selected)
- painter->setPen(highlightedTextColor);
- else
- painter->setPen(textColor);
-
- int x, y, w, h;
- menuitem->rect.getRect(&x, &y, &w, &h);
- int tab = menuitem->tabWidth;
- int xm = windowsItemFrame + checkcol + windowsItemHMargin;
- int xpos = menuitem->rect.x() + xm + 1;
- QRect textRect(xpos, y + windowsItemVMargin, w - xm - windowsRightBorder - tab + 1, h - 2 * windowsItemVMargin);
- QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
- QString s = menuitem->text;
-
- if (!s.isEmpty()) { // Draw text
- p->save();
- int t = s.indexOf(QLatin1Char('\t'));
- int text_flags = Qt::AlignVCenter | Qt::TextShowMnemonic | Qt::TextDontClip | Qt::TextSingleLine;
-
- if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
- text_flags |= Qt::TextHideMnemonic;
-
- // Draw shortcut right aligned
- text_flags |= Qt::AlignRight;
-
- if (t >= 0) {
- int rightMargin = 12; // Hardcode for now
- QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
- QRect(textRect.topRight(), QPoint(menuitem->rect.right() - rightMargin, textRect.bottom())));
-
- if (dis)
- p->setPen(disabledTextColor);
- p->drawText(vShortcutRect, text_flags , s.mid(t + 1));
- s = s.left(t);
- }
-
- text_flags &= ~Qt::AlignRight;
- text_flags |= Qt::AlignLeft;
- QFont font = menuitem->font;
- if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
- font.setBold(true);
- p->setFont(font);
-
- if (dis)
- p->setPen(disabledTextColor);
- p->drawText(vTextRect, text_flags, s.left(t));
- p->restore();
- }
-
- // Arrow
- if (menuItem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
-
- QFontMetrics fm(menuitem->font);
- int arrow_size = fm.ascent() + fm.descent() - 2 * gtkMenuItem->style->ythickness;
- gfloat arrow_scaling = 0.8;
- int extra = 0;
- if (!gtk_check_version(2, 16, 0)) {
- // "arrow-scaling" is actually hardcoded and fails on hardy (see gtk+-2.12/gtkmenuitem.c)
- // though the current documentation states otherwise
- gtk_widget_style_get(gtkMenuItem, "arrow-scaling", &arrow_scaling, NULL);
- // in versions < 2.16 ythickness was previously subtracted from the arrow_size
- extra = 2 * gtkMenuItem->style->ythickness;
- }
-
- int horizontal_padding;
- gtk_widget_style_get(gtkMenuItem, "horizontal-padding", &horizontal_padding, NULL);
-
- const int dim = static_cast<int>(arrow_size * arrow_scaling) + extra;
- int xpos = menuItem->rect.left() + menuItem->rect.width() - horizontal_padding - dim;
- QRect vSubMenuRect = visualRect(option->direction, menuItem->rect,
- QRect(xpos, menuItem->rect.top() +
- menuItem->rect.height() / 2 - dim / 2, dim, dim));
- GtkStateType state = enabled ? (act ? GTK_STATE_PRELIGHT: GTK_STATE_NORMAL) : GTK_STATE_INSENSITIVE;
- GtkShadowType shadowType = (state == GTK_STATE_PRELIGHT) ? GTK_SHADOW_OUT : GTK_SHADOW_IN;
- gtkPainter.paintArrow(gtkMenuItem, "menuitem", vSubMenuRect, QApplication::isRightToLeft() ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, state,
- shadowType, FALSE, style);
- }
- }
- painter->restore();
- break;
-
- case CE_PushButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
- proxy()->drawControl(CE_PushButtonBevel, btn, painter, widget);
- QStyleOptionButton subopt = *btn;
- subopt.rect = subElementRect(SE_PushButtonContents, btn, widget);
- gint interiorFocus = true;
- gtk_widget_style_get(gtkButton, "interior-focus", &interiorFocus, NULL);
- int xt = interiorFocus ? gtkButton->style->xthickness : 0;
- int yt = interiorFocus ? gtkButton->style->ythickness : 0;
-
- if (btn->features & QStyleOptionButton::Flat && btn->state & State_HasFocus)
- // The normal button focus rect does not work well for flat buttons in Clearlooks
- proxy()->drawPrimitive(PE_FrameFocusRect, option, painter, widget);
- else if (btn->state & State_HasFocus)
- gtkPainter.paintFocus(gtkButton, "button",
- option->rect.adjusted(xt, yt, -xt, -yt),
- btn->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
- gtkButton->style);
-
- proxy()->drawControl(CE_PushButtonLabel, &subopt, painter, widget);
- }
- break;
-
-#ifndef QT_NO_TABBAR
-
- case CE_TabBarTabShape:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- GtkWidget *gtkNotebook = d->gtkWidget(QLS("GtkNotebook"));
- style = gtkPainter.getStyle(gtkNotebook);
-
- QRect rect = option->rect;
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GtkStateType state = GTK_STATE_ACTIVE;
- if (tab->state & State_Selected)
- state = GTK_STATE_NORMAL;
-
- bool selected = (tab->state & State_Selected);
- bool first = false, last = false;
- if (widget) {
- // This is most accurate and avoids resizing tabs while moving
- first = tab->rect.left() == widget->rect().left();
- last = tab->rect.right() == widget->rect().right();
- } else if (option->direction == Qt::RightToLeft) {
- bool tmp = first;
- first = last;
- last = tmp;
- }
- int topIndent = 3;
- int bottomIndent = 1;
- int tabOverlap = 1;
- painter->save();
-
- switch (tab->shape) {
- case QTabBar::RoundedNorth:
- if (!selected)
- rect.adjust(first ? 0 : -tabOverlap, topIndent, last ? 0 : tabOverlap, -bottomIndent);
- gtkPainter.paintExtention( gtkNotebook, "tab", rect,
- state, shadow, GTK_POS_BOTTOM, style);
- break;
-
- case QTabBar::RoundedSouth:
- if (!selected)
- rect.adjust(first ? 0 : -tabOverlap, 0, last ? 0 : tabOverlap, -topIndent);
- gtkPainter.paintExtention( gtkNotebook, "tab", rect.adjusted(0, 1, 0, 0),
- state, shadow, GTK_POS_TOP, style);
- break;
-
- case QTabBar::RoundedWest:
- if (!selected)
- rect.adjust(topIndent, 0, -bottomIndent, 0);
- gtkPainter.paintExtention( gtkNotebook, "tab", rect, state, shadow, GTK_POS_RIGHT, style);
- break;
-
- case QTabBar::RoundedEast:
- if (!selected)
- rect.adjust(bottomIndent, 0, -topIndent, 0);
- gtkPainter.paintExtention( gtkNotebook, "tab", rect, state, shadow, GTK_POS_LEFT, style);
- break;
-
- default:
- QCleanlooksStyle::drawControl(element, option, painter, widget);
- break;
- }
-
- painter->restore();
- }
-
- break;
-
-#endif //QT_NO_TABBAR
-
- case CE_ProgressBarGroove:
- if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- Q_UNUSED(bar);
- GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
- GtkStateType state = gtkPainter.gtkState(option);
- gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, gtkProgressBar->style);
- }
-
- break;
-
- case CE_ProgressBarContents:
- if (const QStyleOptionProgressBar *bar = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
- GtkStateType state = option->state & State_Enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE;
- GtkWidget *gtkProgressBar = d->gtkWidget(QLS("GtkProgressBar"));
- style = gtkProgressBar->style;
- gtkPainter.paintBox( gtkProgressBar, "trough", option->rect, state, GTK_SHADOW_IN, style);
- int xt = style->xthickness;
- int yt = style->ythickness;
- QRect rect = bar->rect.adjusted(xt, yt, -xt, -yt);
- bool vertical = false;
- bool inverted = false;
- bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
- // Get extra style options if version 2
-
- if (const QStyleOptionProgressBarV2 *bar2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
- vertical = (bar2->orientation == Qt::Vertical);
- inverted = bar2->invertedAppearance;
- }
-
- // If the orientation is vertical, we use a transform to rotate
- // the progress bar 90 degrees clockwise. This way we can use the
- // same rendering code for both orientations.
- if (vertical) {
- rect.translate(xt, -yt * 2);
- rect = QRect(rect.left(), rect.top(), rect.height(), rect.width()); // Flip width and height
- QTransform m = QTransform::fromTranslate(rect.height(), 0);
- m.rotate(90.0);
- painter->setTransform(m);
- }
-
- int maxWidth = rect.width();
- int minWidth = 4;
-
- qint64 progress = (qint64)qMax(bar->progress, bar->minimum); // Workaround for bug in QProgressBar
- double vc6_workaround = ((progress - qint64(bar->minimum)) / double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth;
- int progressBarWidth = (int(vc6_workaround) > minWidth ) ? int(vc6_workaround) : minWidth;
- int width = indeterminate ? maxWidth : progressBarWidth;
- bool reverse = (!vertical && (bar->direction == Qt::RightToLeft)) || vertical;
-
- if (inverted)
- reverse = !reverse;
-
- int maximum = 2;
- int fakePos = 0;
- if (bar->minimum == bar->maximum)
- maximum = 0;
- if (bar->progress == bar->maximum)
- fakePos = maximum;
- else if (bar->progress > bar->minimum)
- fakePos = maximum - 1;
-
- gtk_progress_configure((GtkProgress*)gtkProgressBar, fakePos, 0, maximum);
-
- QRect progressBar;
-
- if (!indeterminate) {
- if (!reverse)
- progressBar.setRect(rect.left(), rect.top(), width, rect.height());
- else
- progressBar.setRect(rect.right() - width, rect.top(), width, rect.height());
-
- } else {
- Q_D(const QGtkStyle);
- int slideWidth = ((rect.width() - 4) * 2) / 3;
- int step = ((d->animateStep * slideWidth) / d->animationFps) % slideWidth;
- if ((((d->animateStep * slideWidth) / d->animationFps) % (2 * slideWidth)) >= slideWidth)
- step = slideWidth - step;
- progressBar.setRect(rect.left() + step, rect.top(), slideWidth / 2, rect.height());
- }
-
- QString key = QString(QLS("%0")).arg(fakePos);
- if (inverted) {
- key += QLatin1String("inv");
- gtkPainter.setFlipHorizontal(true);
- }
- gtkPainter.paintBox( gtkProgressBar, "bar", progressBar, GTK_STATE_SELECTED, GTK_SHADOW_OUT, style, key);
- }
-
- break;
-
- default:
- QCleanlooksStyle::drawControl(element, option, painter, widget);
- }
-}
-
-/*!
- \reimp
-*/
-QRect QGtkStyle::subControlRect(ComplexControl control, const QStyleOptionComplex *option,
- SubControl subControl, const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- QRect rect = QWindowsStyle::subControlRect(control, option, subControl, widget);
- if (!d->isThemeAvailable())
- return QCleanlooksStyle::subControlRect(control, option, subControl, widget);
-
- switch (control) {
- case CC_TitleBar:
- return QCleanlooksStyle::subControlRect(control, option, subControl, widget);
-
- case CC_Slider:
- if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
- // Reserve space for outside focus rect
- QStyleOptionSlider sliderCopy = *slider;
- sliderCopy.rect = option->rect.adjusted(2, 2, -2, -2);
- return QCleanlooksStyle::subControlRect(control, &sliderCopy, subControl, widget);
- }
-
- break;
-
-#ifndef QT_NO_GROUPBOX
-
- case CC_GroupBox:
- if (qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
- rect = option->rect.adjusted(0, groupBoxTopMargin, 0, -groupBoxBottomMargin);
- int topMargin = 0;
- int topHeight = 0;
- topHeight = 10;
- QRect frameRect = rect;
- frameRect.setTop(topMargin);
-
- if (subControl == SC_GroupBoxFrame)
- return rect;
- else if (subControl == SC_GroupBoxContents) {
- int margin = 0;
- int leftMarginExtension = 8;
- return frameRect.adjusted(leftMarginExtension + margin, margin + topHeight + groupBoxTitleMargin, -margin, -margin);
- }
-
- if (const QGroupBox *groupBoxWidget = qobject_cast<const QGroupBox *>(widget)) {
- //Prepare metrics for a bold font
- QFont font = widget->font();
- font.setBold(true);
- QFontMetrics fontMetrics(font);
- QSize textRect = fontMetrics.boundingRect(groupBoxWidget->title()).size() + QSize(4, 4);
- int indicatorWidth = proxy()->pixelMetric(PM_IndicatorWidth, option, widget);
- int indicatorHeight = proxy()->pixelMetric(PM_IndicatorHeight, option, widget);
-
- if (subControl == SC_GroupBoxCheckBox) {
- rect.setWidth(indicatorWidth);
- rect.setHeight(indicatorHeight);
- rect.moveTop((textRect.height() - indicatorHeight) / 2);
-
- } else if (subControl == SC_GroupBoxLabel) {
- if (groupBoxWidget->isCheckable())
- rect.adjust(indicatorWidth + 4, 0, 0, 0);
- rect.setSize(textRect);
- }
- rect = visualRect(option->direction, option->rect, rect);
- }
- }
-
- return rect;
-
-#endif
-#ifndef QT_NO_SPINBOX
-
- case CC_SpinBox:
- if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
- GtkWidget *gtkSpinButton = d->gtkWidget(QLS("GtkSpinButton"));
- int center = spinbox->rect.height() / 2;
- int xt = spinbox->frame ? gtkSpinButton->style->xthickness : 0;
- int yt = spinbox->frame ? gtkSpinButton->style->ythickness : 0;
- int y = yt;
-
- QSize bs;
- bs.setHeight(qMax(8, spinbox->rect.height()/2 - y));
- bs.setWidth(d->getSpinboxArrowSize());
- int x, lx, rx;
- x = spinbox->rect.width() - y - bs.width() + 2;
- lx = xt;
- rx = x - xt;
-
- switch (subControl) {
-
- case SC_SpinBoxUp:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- rect = QRect(x, xt, bs.width(), center - yt);
- break;
-
- case SC_SpinBoxDown:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- return QRect();
- rect = QRect(x, center, bs.width(), spinbox->rect.bottom() - center - yt + 1);
- break;
-
- case SC_SpinBoxEditField:
- if (spinbox->buttonSymbols == QAbstractSpinBox::NoButtons)
- rect = QRect(lx, yt, spinbox->rect.width() - 2*xt, spinbox->rect.height() - 2*yt);
- else
- rect = QRect(lx, yt, rx - qMax(xt - 1, 0), spinbox->rect.height() - 2*yt);
- break;
-
- case SC_SpinBoxFrame:
- rect = spinbox->rect;
-
- default:
- break;
- }
-
- rect = visualRect(spinbox->direction, spinbox->rect, rect);
- }
-
- break;
-
-#endif // Qt_NO_SPINBOX
-#ifndef QT_NO_COMBOBOX
-
- case CC_ComboBox:
- if (const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- // We employ the gtk widget to position arrows and separators for us
- GtkWidget *gtkCombo = box->editable ? d->gtkWidget(QLS("GtkComboBoxEntry"))
- : d->gtkWidget(QLS("GtkComboBox"));
- gtk_widget_set_direction(gtkCombo, (option->direction == Qt::RightToLeft) ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR);
- GtkAllocation geometry = {0, 0, qMax(0, option->rect.width()), qMax(0, option->rect.height())};
- gtk_widget_size_allocate(gtkCombo, &geometry);
- int appears_as_list = !proxy()->styleHint(QStyle::SH_ComboBox_Popup, option, widget);
- QString arrowPath = QLatin1String("GtkComboBoxEntry.GtkToggleButton");
- if (!box->editable) {
- if (appears_as_list)
- arrowPath = QLatin1String("GtkComboBox.GtkToggleButton");
- else
- arrowPath = QLatin1String("GtkComboBox.GtkToggleButton.GtkHBox.GtkArrow");
- }
-
- GtkWidget *arrowWidget = d->gtkWidget(arrowPath);
- if (!arrowWidget)
- return QCleanlooksStyle::subControlRect(control, option, subControl, widget);
-
- QRect buttonRect(option->rect.left() + arrowWidget->allocation.x,
- option->rect.top() + arrowWidget->allocation.y,
- arrowWidget->allocation.width, arrowWidget->allocation.height);
-
- switch (subControl) {
-
- case SC_ComboBoxArrow: // Note: this indicates the arrowbutton for editable combos
- rect = buttonRect;
- break;
-
- case SC_ComboBoxEditField: {
- rect = visualRect(option->direction, option->rect, rect);
- int xMargin = box->editable ? 1 : 4, yMargin = 2;
- rect.setRect(option->rect.left() + gtkCombo->style->xthickness + xMargin,
- option->rect.top() + gtkCombo->style->ythickness + yMargin,
- option->rect.width() - buttonRect.width() - 2*(gtkCombo->style->xthickness + xMargin),
- option->rect.height() - 2*(gtkCombo->style->ythickness + yMargin));
- rect = visualRect(option->direction, option->rect, rect);
- break;
- }
-
- default:
- break;
- }
- }
-
- break;
-
-#endif // QT_NO_COMBOBOX
-
- default:
- break;
- }
-
- return rect;
-}
-
-/*!
- \reimp
-*/
-QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- QSize newSize = QCleanlooksStyle::sizeFromContents(type, option, size, widget);
- if (!d->isThemeAvailable())
- return newSize;
-
- switch (type) {
-
- case CT_ToolButton:
- if (const QStyleOptionToolButton *toolbutton = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkToolButton.GtkButton"));
- newSize = size + QSize(2 * gtkButton->style->xthickness, 2 + 2 * gtkButton->style->ythickness);
- if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
- QSize minSize(0, 25);
- if (toolbutton->toolButtonStyle != Qt::ToolButtonTextOnly)
- minSize = toolbutton->iconSize + QSize(12, 12);
- newSize = newSize.expandedTo(minSize);
- }
-
- if (toolbutton->features & QStyleOptionToolButton::HasMenu)
- newSize += QSize(6, 0);
- }
- break;
- case CT_MenuItem:
- if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int textMargin = 8;
-
- if (menuItem->menuItemType == QStyleOptionMenuItem::Separator) {
- GtkWidget *gtkMenuSeparator = d->gtkWidget(QLS("GtkMenu.GtkSeparatorMenuItem"));
- GtkRequisition sizeReq = {0, 0};
- gtk_widget_size_request(gtkMenuSeparator, &sizeReq);
- newSize = QSize(size.width(), sizeReq.height);
- break;
- }
-
- GtkWidget *gtkMenuItem = d->gtkWidget(QLS("GtkMenu.GtkCheckMenuItem"));
- GtkStyle* style = gtkMenuItem->style;
-
- // Note we get the perfect height for the default font since we
- // set a fake text label on the gtkMenuItem
- // But if custom fonts are used on the widget we need a minimum size
- GtkRequisition sizeReq = {0, 0};
- gtk_widget_size_request(gtkMenuItem, &sizeReq);
- newSize.setHeight(qMax(newSize.height() - 4, sizeReq.height));
- newSize += QSize(textMargin + style->xthickness - 1, 0);
-
- // Cleanlooks assumes a check column of 20 pixels so we need to
- // expand it a bit
- gint checkSize;
- gtk_widget_style_get(gtkMenuItem, "indicator-size", &checkSize, NULL);
- newSize.setWidth(newSize.width() + qMax(0, checkSize - 20));
- }
-
- break;
-
- case CT_SpinBox:
- // QSpinBox does some nasty things that depends on CT_LineEdit
- newSize = size + QSize(0, -d->gtkWidget(QLS("GtkSpinButton"))->style->ythickness * 2);
- break;
-
- case CT_PushButton:
- if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
- gint focusPadding, focusWidth;
- gtk_widget_style_get(gtkButton, "focus-padding", &focusPadding, NULL);
- gtk_widget_style_get(gtkButton, "focus-line-width", &focusWidth, NULL);
- newSize = size;
- newSize += QSize(2*gtkButton->style->xthickness + 4, 2*gtkButton->style->ythickness);
- newSize += QSize(2*(focusWidth + focusPadding + 2), 2*(focusWidth + focusPadding));
-
- GtkWidget *gtkButtonBox = d->gtkWidget(QLS("GtkHButtonBox"));
- gint minWidth = 85, minHeight = 0;
- gtk_widget_style_get(gtkButtonBox, "child-min-width", &minWidth,
- "child-min-height", &minHeight, NULL);
- if (!btn->text.isEmpty() && newSize.width() < minWidth)
- newSize.setWidth(minWidth);
- if (newSize.height() < minHeight)
- newSize.setHeight(minHeight);
- }
-
- break;
-
- case CT_Slider: {
- GtkWidget *gtkSlider = d->gtkWidget(QLS("GtkHScale"));
- newSize = size + QSize(2*gtkSlider->style->xthickness, 2*gtkSlider->style->ythickness);
- }
- break;
-
- case CT_LineEdit: {
- GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry"));
- newSize = size + QSize(2*gtkEntry->style->xthickness, 2 + 2*gtkEntry->style->ythickness);
- }
- break;
-
- case CT_ItemViewItem:
- newSize += QSize(0, 2);
- break;
-
- case CT_ComboBox:
- if (const QStyleOptionComboBox *combo = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
- GtkWidget *gtkCombo = d->gtkWidget(QLS("GtkComboBox"));
- QRect arrowButtonRect = proxy()->subControlRect(CC_ComboBox, combo, SC_ComboBoxArrow, widget);
- newSize = size + QSize(12 + arrowButtonRect.width() + 2*gtkCombo->style->xthickness, 4 + 2*gtkCombo->style->ythickness);
-
- if (!(widget && qobject_cast<QToolBar *>(widget->parentWidget())))
- newSize += QSize(0, 2);
- }
- break;
-
- case CT_GroupBox:
- newSize += QSize(4, groupBoxBottomMargin + groupBoxTopMargin + groupBoxTitleMargin); // Add some space below the groupbox
- break;
-
- case CT_TabBarTab:
- if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
- if (!tab->icon.isNull())
- newSize += QSize(6, 0);
- }
- newSize += QSize(1, 1);
- break;
-
- default:
- break;
- }
-
- return newSize;
-}
-
-
-/*! \reimp */
-QPixmap QGtkStyle::standardPixmap(StandardPixmap sp, const QStyleOption *option,
- const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable())
- return QCleanlooksStyle::standardPixmap(sp, option, widget);
-
- QPixmap pixmap;
- switch (sp) {
-
- case SP_TitleBarNormalButton: {
- QImage restoreButton((const char **)dock_widget_restore_xpm);
- QColor alphaCorner = restoreButton.color(2);
- alphaCorner.setAlpha(80);
- restoreButton.setColor(2, alphaCorner.rgba());
- alphaCorner.setAlpha(180);
- restoreButton.setColor(4, alphaCorner.rgba());
- return QPixmap::fromImage(restoreButton);
- }
- break;
-
- case SP_TitleBarCloseButton: // Fall through
- case SP_DockWidgetCloseButton: {
-
- QImage closeButton((const char **)dock_widget_close_xpm);
- QColor alphaCorner = closeButton.color(2);
- alphaCorner.setAlpha(80);
- closeButton.setColor(2, alphaCorner.rgba());
- return QPixmap::fromImage(closeButton);
- }
- break;
-
- case SP_DialogDiscardButton:
- return QGtkPainter::getIcon(GTK_STOCK_DELETE);
- case SP_DialogOkButton:
- return QGtkPainter::getIcon(GTK_STOCK_OK);
- case SP_DialogCancelButton:
- return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
- case SP_DialogYesButton:
- return QGtkPainter::getIcon(GTK_STOCK_YES);
- case SP_DialogNoButton:
- return QGtkPainter::getIcon(GTK_STOCK_NO);
- case SP_DialogOpenButton:
- return QGtkPainter::getIcon(GTK_STOCK_OPEN);
- case SP_DialogCloseButton:
- return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
- case SP_DialogApplyButton:
- return QGtkPainter::getIcon(GTK_STOCK_APPLY);
- case SP_DialogSaveButton:
- return QGtkPainter::getIcon(GTK_STOCK_SAVE);
- case SP_MessageBoxWarning:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxQuestion:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxInformation:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxCritical:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
- default:
- return QCleanlooksStyle::standardPixmap(sp, option, widget);
- }
- return pixmap;
-}
-
-/*!
- \internal
-*/
-QIcon QGtkStyle::standardIcon(StandardPixmap standardIcon,
- const QStyleOption *option,
- const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- if (!d->isThemeAvailable())
- return QCleanlooksStyle::standardIcon(standardIcon, option, widget);
- switch (standardIcon) {
- case SP_DialogDiscardButton:
- return QGtkPainter::getIcon(GTK_STOCK_DELETE);
- case SP_DialogOkButton:
- return QGtkPainter::getIcon(GTK_STOCK_OK);
- case SP_DialogCancelButton:
- return QGtkPainter::getIcon(GTK_STOCK_CANCEL);
- case SP_DialogYesButton:
- return QGtkPainter::getIcon(GTK_STOCK_YES);
- case SP_DialogNoButton:
- return QGtkPainter::getIcon(GTK_STOCK_NO);
- case SP_DialogOpenButton:
- return QGtkPainter::getIcon(GTK_STOCK_OPEN);
- case SP_DialogCloseButton:
- return QGtkPainter::getIcon(GTK_STOCK_CLOSE);
- case SP_DialogApplyButton:
- return QGtkPainter::getIcon(GTK_STOCK_APPLY);
- case SP_DialogSaveButton:
- return QGtkPainter::getIcon(GTK_STOCK_SAVE);
- case SP_MessageBoxWarning:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxQuestion:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_QUESTION, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxInformation:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DIALOG);
- case SP_MessageBoxCritical:
- return QGtkPainter::getIcon(GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_DIALOG);
- default:
- return QCleanlooksStyle::standardIcon(standardIcon, option, widget);
- }
-}
-
-
-/*! \reimp */
-QRect QGtkStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
-{
- Q_D(const QGtkStyle);
-
- QRect r = QCleanlooksStyle::subElementRect(element, option, widget);
- if (!d->isThemeAvailable())
- return r;
-
- switch (element) {
- case SE_ProgressBarLabel:
- case SE_ProgressBarContents:
- case SE_ProgressBarGroove:
- return option->rect;
- case SE_PushButtonContents:
- if (!gtk_check_version(2, 10, 0)) {
- GtkWidget *gtkButton = d->gtkWidget(QLS("GtkButton"));
- GtkBorder *border = 0;
- gtk_widget_style_get(gtkButton, "inner-border", &border, NULL);
- if (border) {
- r = option->rect.adjusted(border->left, border->top, -border->right, -border->bottom);
- gtk_border_free(border);
- } else {
- r = option->rect.adjusted(1, 1, -1, -1);
- }
- r = visualRect(option->direction, option->rect, r);
- }
- break;
- default:
- break;
- }
-
- return r;
-}
-
-QT_END_NAMESPACE
-
-
-#include "moc_qgtkstyle.h"
-
-#endif //!defined(QT_NO_STYLE_QGTK)
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGTKSTYLE_H
-#define QGTKSTYLE_H
-
-#include <QtGui/QCleanlooksStyle>
-#include <QtGui/QPalette>
-#include <QtGui/QFont>
-#include <QtGui/QFileDialog>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
-#if !defined(QT_NO_STYLE_GTK)
-
-class QPainterPath;
-class QGtkStylePrivate;
-
-class Q_GUI_EXPORT QGtkStyle : public QCleanlooksStyle
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QGtkStyle)
-
-public:
- QGtkStyle();
- QGtkStyle(QGtkStylePrivate &dd);
-
- ~QGtkStyle();
-
- QPalette standardPalette() const;
-
- void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
- void drawControl(ControlElement control, const QStyleOption *option,
- QPainter *painter, const QWidget *widget) const;
- void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option,
- QPainter *painter, const QWidget *widget) const;
-
- int pixelMetric(PixelMetric metric, const QStyleOption *option = Q_NULLPTR,
- const QWidget *widget = Q_NULLPTR) const;
- int styleHint(StyleHint hint, const QStyleOption *option,
- const QWidget *widget, QStyleHintReturn *returnData) const;
-
- QRect subControlRect(ComplexControl control, const QStyleOptionComplex *option,
- SubControl subControl, const QWidget *widget) const;
- QRect subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *w) const;
-
- QSize sizeFromContents(ContentsType type, const QStyleOption *option,
- const QSize &size, const QWidget *widget) const;
- QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *option,
- const QWidget *widget) const;
-
- void polish(QWidget *widget);
- void polish(QApplication *app);
- void polish(QPalette &palette);
-
- void unpolish(QWidget *widget);
- void unpolish(QApplication *app);
-
- static bool getGConfBool(const QString &key, bool fallback = false);
- static QString getGConfString(const QString &key, const QString &fallback = QString());
-
- QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
- const QWidget *widget = Q_NULLPTR) const;
-};
-
-#endif //!defined(QT_NO_STYLE_QGTK)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif //QGTKSTYLE_H
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgtkstyle_p.h"
-
-// This file is responsible for resolving all GTK functions we use
-// dynamically. This is done to avoid link-time dependancy on GTK
-// as well as crashes occurring due to usage of the GTK_QT engines
-//
-// Additionally we create a map of common GTK widgets that we can pass
-// to the GTK theme engine as many engines resort to querying the
-// actual widget pointers for details that are not covered by the
-// state flags
-
-#include <QtCore/qglobal.h>
-#if !defined(QT_NO_STYLE_GTK)
-
-#include <QtCore/QEvent>
-#include <QtCore/QFile>
-#include <QtCore/QStringList>
-#include <QtCore/QTextStream>
-#include <QtCore/QHash>
-#include <QtCore/QUrl>
-#include <QtCore/QLibrary>
-#include <QtCore/QDebug>
-
-#include <qapplication_p.h>
-#include <qiconloader_p.h>
-
-#include <QtGui/QMenu>
-#include <QtGui/QStyle>
-#include <QtGui/QApplication>
-#include <QtGui/QPixmapCache>
-#include <QtGui/QStatusBar>
-#include <QtGui/QMenuBar>
-#include <QtGui/QToolBar>
-#include <QtGui/QToolButton>
-#include <QtGui/qx11info_x11.h>
-
-#include <qt_x11_p.h>
-
-#ifndef QT_NO_GCONF2
-#include <gconf/gconf.h>
-#include <gconf/gconf-client.h>
-#endif
-
-#include <gdk/gdkx.h>
-
-QT_BEGIN_NAMESPACE
-
-Q_GLOBAL_STATIC(QGtkStyleUpdateScheduler, styleScheduler)
-
-Ptr_gnome_icon_lookup_sync QGtkStylePrivate::gnome_icon_lookup_sync = 0;
-Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0;
-
-typedef int (*x11ErrorHandler)(Display*, XErrorEvent*);
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QGtkStylePrivate*)
-
-QT_BEGIN_NAMESPACE
-
-static void gtkStyleSetCallback(GtkWidget*)
-{
- qRegisterMetaType<QGtkStylePrivate *>();
-
- // We have to let this function return and complete the event
- // loop to ensure that all gtk widgets have been styled before
- // updating
- QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection);
-}
-
-static void update_toolbar_style(GtkWidget *gtkToolBar, GParamSpec *, gpointer)
-{
- GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
- g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL);
- QWidgetList widgets = QApplication::allWidgets();
- for (int i = 0; i < widgets.size(); ++i) {
- QWidget *widget = widgets.at(i);
- if (qobject_cast<QToolButton*>(widget)) {
- QEvent event(QEvent::StyleChange);
- QApplication::sendEvent(widget, &event);
- }
- }
-}
-
-static QString classPath(GtkWidget *widget)
-{
- char *class_path;
- gtk_widget_path (widget, NULL, &class_path, NULL);
-
- char *copy = class_path;
- if (strncmp(copy, "GtkWindow.", 10) == 0)
- copy += 10;
- if (strncmp(copy, "GtkFixed.", 9) == 0)
- copy += 9;
-
- copy = strdup(copy);
-
- g_free(class_path);
-
- return QString::fromLatin1(copy);
-}
-
-
-
-bool QGtkStyleFilter::eventFilter(QObject *obj, QEvent *e)
-{
- if (e->type() == QEvent::ApplicationPaletteChange) {
- // Only do this the first time since this will also
- // generate applicationPaletteChange events
- if (!qt_app_palettes_hash() || qt_app_palettes_hash()->isEmpty()) {
- stylePrivate->applyCustomPaletteHash();
- }
- }
- return QObject::eventFilter(obj, e);
-}
-
-QList<QGtkStylePrivate *> QGtkStylePrivate::instances;
-QGtkStylePrivate::WidgetMap *QGtkStylePrivate::widgetMap = 0;
-
-QGtkStylePrivate::QGtkStylePrivate()
- : QCleanlooksStylePrivate()
- , filter(this)
-{
- instances.append(this);
-}
-
-QGtkStylePrivate::~QGtkStylePrivate()
-{
- instances.removeOne(this);
-}
-
-void QGtkStylePrivate::init()
-{
-#warning make gnomeui linked
- gnome_icon_lookup_sync = (Ptr_gnome_icon_lookup_sync)QLibrary::resolve(QLS("gnomeui-2"), 0, "gnome_icon_lookup_sync");
- gnome_vfs_init= (Ptr_gnome_vfs_init)QLibrary::resolve(QLS("gnomevfs-2"), 0, "gnome_vfs_init");
-
- initGtkWidgets();
-}
-
-GtkWidget* QGtkStylePrivate::gtkWidget(const QString &path)
-{
- GtkWidget *widget = gtkWidgetMap()->value(path);
- if (!widget) {
- // Theme might have rearranged widget internals
- widget = gtkWidgetMap()->value(path);
- }
- return widget;
-}
-
-GtkStyle* QGtkStylePrivate::gtkStyle(const QString &path)
-{
- if (GtkWidget *w = gtkWidgetMap()->value(path))
- return w->style;
- return 0;
-}
-
-/* \internal
- * Initializes a number of gtk menu widgets.
- * The widgets are cached.
- */
-void QGtkStylePrivate::initGtkMenu() const
-{
- // Create menubar
- GtkWidget *gtkMenuBar = gtk_menu_bar_new();
- setupGtkWidget(gtkMenuBar);
-
- GtkWidget *gtkMenuBarItem = gtk_menu_item_new_with_label("X");
- gtk_menu_shell_append((GtkMenuShell*)(gtkMenuBar), gtkMenuBarItem);
- gtk_widget_realize(gtkMenuBarItem);
-
- // Create menu
- GtkWidget *gtkMenu = gtk_menu_new();
- gtk_menu_item_set_submenu((GtkMenuItem*)(gtkMenuBarItem), gtkMenu);
- gtk_widget_realize(gtkMenu);
-
- GtkWidget *gtkMenuItem = gtk_menu_item_new_with_label("X");
- gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuItem);
- gtk_widget_realize(gtkMenuItem);
-
- GtkWidget *gtkCheckMenuItem = gtk_check_menu_item_new_with_label("X");
- gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkCheckMenuItem);
- gtk_widget_realize(gtkCheckMenuItem);
-
- GtkWidget *gtkMenuSeparator = gtk_separator_menu_item_new();
- gtk_menu_shell_append((GtkMenuShell*)gtkMenu, gtkMenuSeparator);
-
- addAllSubWidgets(gtkMenuBar);
- addAllSubWidgets(gtkMenu);
-}
-
-
-void QGtkStylePrivate::initGtkTreeview() const
-{
- GtkWidget *gtkTreeView = gtk_tree_view_new();
- gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new());
- gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new());
- gtk_tree_view_append_column((GtkTreeView*)gtkTreeView, gtk_tree_view_column_new());
- addWidget(gtkTreeView);
-}
-
-
-/* \internal
- * Initializes a number of gtk widgets that we can later on use to determine some of our styles.
- * The widgets are cached.
- */
-void QGtkStylePrivate::initGtkWidgets() const
-{
- // From gtkmain.c
- uid_t ruid = getuid ();
- uid_t rgid = getgid ();
- uid_t euid = geteuid ();
- uid_t egid = getegid ();
- if (ruid != euid || rgid != egid) {
- qWarning("\nThis process is currently running setuid or setgid.\nGTK+ does not allow this "
- "therefore Qt cannot use the GTK+ integration.\nTry launching your app using \'gksudo\', "
- "\'kdesudo\' or a similar tool.\n\n"
- "See http://www.gtk.org/setuid.html for more information.\n");
- return;
- }
-
- static QString themeName;
- if (!gtkWidgetMap()->contains(QLS("GtkWindow")) && themeName.isEmpty()) {
- themeName = getThemeName();
-
- if (themeName == QLS("Qt") || themeName == QLS("Qt4")) {
- // Due to namespace conflicts with Qt3 and obvious recursion with Qt4,
- // we cannot support the GTK_Qt Gtk engine
- qWarning("QGtkStyle cannot be used together with the GTK_Qt engine.");
- return;
- }
- }
-
- // Gtk will set the Qt error handler so we have to reset it afterwards
- x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0);
- gtk_init (NULL, NULL);
- XSetErrorHandler(qt_x_errhandler);
-
- // make a window
- GtkWidget* gtkWindow = gtk_window_new(GTK_WINDOW_POPUP);
- gtk_widget_realize(gtkWindow);
- QString widgetPath = QString::fromLatin1("GtkWindow");
- removeWidgetFromMap(widgetPath);
- gtkWidgetMap()->insert(widgetPath, gtkWindow);
-
-
- // Make all other widgets. respect the text direction
- if (qApp->layoutDirection() == Qt::RightToLeft)
- gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
-
- if (!gtkWidgetMap()->contains(QLS("GtkButton"))) {
- GtkWidget *gtkButton = gtk_button_new();
- addWidget(gtkButton);
- g_signal_connect(gtkButton, "style-set", G_CALLBACK(gtkStyleSetCallback), 0);
-#warning FIXME, add addWidget() overload
- // addWidget(gtk_tool_button_new(NULL, "Qt"));
- addWidget(gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE));
- addWidget(gtk_hbutton_box_new());
- addWidget(gtk_check_button_new());
- addWidget(gtk_radio_button_new(NULL));
- addWidget(gtk_combo_box_new());
- addWidget(gtk_combo_box_entry_new());
- addWidget(gtk_entry_new());
- addWidget(gtk_frame_new(NULL));
- addWidget(gtk_expander_new(""));
- addWidget(gtk_statusbar_new());
- addWidget(gtk_hscale_new((GtkAdjustment*)(gtk_adjustment_new(1, 0, 1, 0, 0, 0))));
- addWidget(gtk_hscrollbar_new(NULL));
- addWidget(gtk_scrolled_window_new(NULL, NULL));
-
- initGtkMenu();
- addWidget(gtk_notebook_new());
- addWidget(gtk_progress_bar_new());
- addWidget(gtk_spin_button_new((GtkAdjustment*)
- (gtk_adjustment_new(1, 0, 1, 0, 0, 0)), 0.1, 3));
- GtkWidget *toolbar = gtk_toolbar_new();
- g_signal_connect (toolbar, "notify::toolbar-style", G_CALLBACK (update_toolbar_style), toolbar);
- gtk_toolbar_insert((GtkToolbar*)toolbar, gtk_separator_tool_item_new(), -1);
- addWidget(toolbar);
- initGtkTreeview();
- addWidget(gtk_vscale_new((GtkAdjustment*)(gtk_adjustment_new(1, 0, 1, 0, 0, 0))));
- addWidget(gtk_vscrollbar_new(NULL));
- }
- else // Rebuild map
- {
- // When styles change subwidgets can get rearranged
- // as with the combo box. We need to update the widget map
- // to reflect this;
- QHash<QString, GtkWidget*> oldMap = *gtkWidgetMap();
- gtkWidgetMap()->clear();
- QHashIterator<QString, GtkWidget*> it(oldMap);
- while (it.hasNext()) {
- it.next();
- if (it.key() != QLatin1String(".")) {
- addAllSubWidgets(it.value());
- }
- }
- }
-}
-
-/*! \internal
- * destroys all previously buffered widgets.
- */
-void QGtkStylePrivate::cleanupGtkWidgets()
-{
- if (!widgetMap)
- return;
- if (widgetMap->contains(QLS("GtkWindow"))) // Gtk will destroy all children
- gtk_widget_destroy(widgetMap->value(QLS("GtkWindow")));
- widgetMap->clear();
-}
-
-QString QGtkStylePrivate::getGConfString(const QString &value, const QString &fallback)
-{
- QString retVal = fallback;
-#ifndef QT_NO_GCONF2
-#if !GLIB_CHECK_VERSION(2,35,0)
- g_type_init ();
-#endif
- GConfClient* client = gconf_client_get_default();
- GError *err = 0;
- char *str = gconf_client_get_string(client, qPrintable(value), &err);
- if (!err) {
- retVal = QString::fromUtf8(str);
- g_free(str);
- }
- g_object_unref(client);
- if (err)
- g_error_free (err);
-#endif
- return retVal;
-}
-
-bool QGtkStylePrivate::getGConfBool(const QString &key, bool fallback)
-{
- bool retVal = fallback;
-#ifndef QT_NO_GCONF2
-#if !GLIB_CHECK_VERSION(2,35,0)
- g_type_init ();
-#endif
- GConfClient* client = gconf_client_get_default();
- GError *err = 0;
- bool result = gconf_client_get_bool(client, qPrintable(key), &err);
- g_object_unref(client);
- if (!err)
- retVal = result;
- else
- g_error_free (err);
-#endif
- return retVal;
-}
-
-QString QGtkStylePrivate::getThemeName()
-{
- QString themeName;
- // We try to parse the gtkrc file first
- // primarily to avoid resolving Gtk functions if
- // the KDE 3 "Qt" style is currently in use
- QString rcPaths = QString::fromLocal8Bit(qgetenv("GTK2_RC_FILES"));
- if (!rcPaths.isEmpty()) {
- QStringList paths = rcPaths.split(QLS(":"));
- foreach (const QString &rcPath, paths) {
- if (!rcPath.isEmpty()) {
- QFile rcFile(rcPath);
- if (rcFile.exists() && rcFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
- QTextStream in(&rcFile);
- while(!in.atEnd()) {
- QString line = in.readLine();
- if (line.contains(QLS("gtk-theme-name"))) {
- line = line.right(line.length() - line.indexOf(QLatin1Char('=')) - 1);
- line.remove(QLatin1Char('\"'));
- line = line.trimmed();
- themeName = line;
- break;
- }
- }
- }
- }
- if (!themeName.isEmpty())
- break;
- }
- }
-
-#ifndef QT_NO_GCONF2
- // Fall back to gconf
- if (themeName.isEmpty())
- themeName = getGConfString(QLS("/desktop/gnome/interface/gtk_theme"));
-#endif
-
- return themeName;
-}
-
-QString QGtkStylePrivate::getIconThemeName() {
- x11ErrorHandler qt_x_errhandler = XSetErrorHandler(0);
- gtk_init(NULL, NULL);
- XSetErrorHandler(qt_x_errhandler);
- GtkSettings *settings = gtk_settings_get_default();
- gchararray value;
- g_object_get(settings, "gtk-icon-theme-name", &value, NULL);
- QString result = QString::fromUtf8(value);
- g_free(value);
- return result;
-}
-
-// Get size of the arrow controls in a GtkSpinButton
-int QGtkStylePrivate::getSpinboxArrowSize() const
-{
- const int MIN_ARROW_WIDTH = 6;
- GtkWidget *spinButton = gtkWidget(QLS("GtkSpinButton"));
- GtkStyle *style = spinButton->style;
- gint size = pango_font_description_get_size (style->font_desc);
- gint arrow_size;
- arrow_size = qMax(PANGO_PIXELS (size), MIN_ARROW_WIDTH) + style->xthickness;
- arrow_size += arrow_size%2 + 1;
- return arrow_size;
-}
-
-
-bool QGtkStylePrivate::isKDE4Session()
-{
- static int version = -1;
- if (version == -1)
- version = qgetenv("KDE_SESSION_VERSION").toInt();
- return (version == 4);
-}
-
-void QGtkStylePrivate::applyCustomPaletteHash()
-{
- QPalette menuPal = gtkWidgetPalette(QLS("GtkMenu"));
- GdkColor gdkBg = gtkWidget(QLS("GtkMenu"))->style->bg[GTK_STATE_NORMAL];
- QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
- menuPal.setBrush(QPalette::Base, bgColor);
- menuPal.setBrush(QPalette::Window, bgColor);
- qApp->setPalette(menuPal, "QMenu");
-
- QPalette toolbarPal = gtkWidgetPalette(QLS("GtkToolbar"));
- qApp->setPalette(toolbarPal, "QToolBar");
-
- QPalette menuBarPal = gtkWidgetPalette(QLS("GtkMenuBar"));
- qApp->setPalette(menuBarPal, "QMenuBar");
-}
-
-/*! \internal
- * Returns the gtk Widget that should be used to determine text foreground and background colors.
-*/
-GtkWidget* QGtkStylePrivate::getTextColorWidget() const
-{
- return gtkWidget(QLS("GtkEntry"));
-}
-
-void QGtkStylePrivate::setupGtkWidget(GtkWidget* widget)
-{
- if (Q_GTK_IS_WIDGET(widget)) {
- static GtkWidget* protoLayout = 0;
- if (!protoLayout) {
- protoLayout = gtk_fixed_new();
- gtk_container_add((GtkContainer*)(gtkWidgetMap()->value(QLS("GtkWindow"))), protoLayout);
- }
- Q_ASSERT(protoLayout);
-
- if (!widget->parent && !GTK_WIDGET_TOPLEVEL(widget))
- gtk_container_add((GtkContainer*)(protoLayout), widget);
- gtk_widget_realize(widget);
- }
-}
-
-void QGtkStylePrivate::removeWidgetFromMap(const QString &path)
-{
- WidgetMap *map = gtkWidgetMap();
- WidgetMap::iterator it = map->find(path);
- if (it != map->end()) {
- map->erase(it);
- }
-}
-
-void QGtkStylePrivate::addWidgetToMap(GtkWidget *widget)
-{
- if (Q_GTK_IS_WIDGET(widget)) {
- gtk_widget_realize(widget);
- QString widgetPath = classPath(widget);
-
- removeWidgetFromMap(widgetPath);
- gtkWidgetMap()->insert(widgetPath, widget);
-#ifdef DUMP_GTK_WIDGET_TREE
- qWarning("Inserted Gtk Widget: %s", widgetPath.data());
-#endif
- }
- }
-
-void QGtkStylePrivate::addAllSubWidgets(GtkWidget *widget, gpointer v)
-{
- Q_UNUSED(v);
- addWidgetToMap(widget);
- if (GTK_CHECK_TYPE ((widget), gtk_container_get_type()))
- gtk_container_forall((GtkContainer*)widget, addAllSubWidgets, NULL);
-}
-
-// Updates window/windowtext palette based on the indicated gtk widget
-QPalette QGtkStylePrivate::gtkWidgetPalette(const QString >kWidgetName) const
-{
- GtkWidget *gtkWidget = QGtkStylePrivate::gtkWidget(gtkWidgetName);
- Q_ASSERT(gtkWidget);
- QPalette pal = QApplication::palette();
- GdkColor gdkBg = gtkWidget->style->bg[GTK_STATE_NORMAL];
- GdkColor gdkText = gtkWidget->style->fg[GTK_STATE_NORMAL];
- GdkColor gdkDisabledText = gtkWidget->style->fg[GTK_STATE_INSENSITIVE];
- QColor bgColor(gdkBg.red>>8, gdkBg.green>>8, gdkBg.blue>>8);
- QColor textColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
- QColor disabledTextColor(gdkDisabledText.red>>8, gdkDisabledText.green>>8, gdkDisabledText.blue>>8);
- pal.setBrush(QPalette::Window, bgColor);
- pal.setBrush(QPalette::Button, bgColor);
- pal.setBrush(QPalette::All, QPalette::WindowText, textColor);
- pal.setBrush(QPalette::Disabled, QPalette::WindowText, disabledTextColor);
- pal.setBrush(QPalette::All, QPalette::ButtonText, textColor);
- pal.setBrush(QPalette::Disabled, QPalette::ButtonText, disabledTextColor);
- return pal;
-}
-
-
-void QGtkStyleUpdateScheduler::updateTheme()
-{
- static QString oldTheme(QLS("qt_not_set"));
- QPixmapCache::clear();
-
- QFont font = QGtkStylePrivate::getThemeFont();
- if (QApplication::font() != font)
- qApp->setFont(font);
-
- if (oldTheme != QGtkStylePrivate::getThemeName()) {
- oldTheme = QGtkStylePrivate::getThemeName();
- QPalette newPalette = qApp->style()->standardPalette();
- QApplicationPrivate::setSystemPalette(newPalette);
- QApplication::setPalette(newPalette);
- if (!QGtkStylePrivate::instances.isEmpty()) {
- QGtkStylePrivate::instances.last()->initGtkWidgets();
- QGtkStylePrivate::instances.last()->applyCustomPaletteHash();
- }
- QList<QWidget*> widgets = QApplication::allWidgets();
- // Notify all widgets that size metrics might have changed
- foreach (QWidget *widget, widgets) {
- QEvent e(QEvent::StyleChange);
- QApplication::sendEvent(widget, &e);
- }
- }
- QIconLoader::instance()->updateSystemTheme();
-}
-
-void QGtkStylePrivate::addWidget(GtkWidget *widget)
-{
- if (widget) {
- setupGtkWidget(widget);
- addAllSubWidgets(widget);
- }
-}
-
-
-// Fetch the application font from the pango font description
-// contained in the theme.
-QFont QGtkStylePrivate::getThemeFont()
-{
- QFont font;
- GtkStyle *style = gtkStyle();
- if (style && qApp->desktopSettingsAware())
- {
- PangoFontDescription *gtk_font = style->font_desc;
- font.setPointSizeF((float)(pango_font_description_get_size(gtk_font))/PANGO_SCALE);
-
- QString family = QString::fromLatin1(pango_font_description_get_family(gtk_font));
- if (!family.isEmpty())
- font.setFamily(family);
-
- int weight = pango_font_description_get_weight(gtk_font);
- if (weight >= PANGO_WEIGHT_HEAVY)
- font.setWeight(QFont::Black);
- else if (weight >= PANGO_WEIGHT_BOLD)
- font.setWeight(QFont::Bold);
- else if (weight >= PANGO_WEIGHT_SEMIBOLD)
- font.setWeight(QFont::DemiBold);
- else if (weight >= PANGO_WEIGHT_NORMAL)
- font.setWeight(QFont::Normal);
- else
- font.setWeight(QFont::Light);
-
- PangoStyle fontstyle = pango_font_description_get_style(gtk_font);
- if (fontstyle == PANGO_STYLE_ITALIC)
- font.setStyle(QFont::StyleItalic);
- else if (fontstyle == PANGO_STYLE_OBLIQUE)
- font.setStyle(QFont::StyleOblique);
- else
- font.setStyle(QFont::StyleNormal);
- }
- return font;
-}
-
-
-// ----------- Native file dialogs -----------
-
-// Extract filter list from expressions of type: foo (*.a *.b *.c)"
-QStringList QGtkStylePrivate::extract_filter(const QString &rawFilter)
-{
- QString result = rawFilter;
- QRegExp r(QString::fromLatin1("^([^()]*)\\(([a-zA-Z0-9_.*? +;#\\-\\[\\]@\\{\\}/!<>\\$%&=^~:\\|]*)\\)$"));
- int index = r.indexIn(result);
- if (index >= 0)
- result = r.cap(2);
- return result.split(QLatin1Char(' '));
-}
-
-extern QStringList qt_make_filter_list(const QString &filter);
-
-void QGtkStylePrivate::setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
- const QString &dir, const QString &filter, QString *selectedFilter,
- QFileDialog::Options options, bool isSaveDialog,
- QMap<GtkFileFilter *, QString> *filterMap)
-{
- g_object_set(gtkFileChooser, "do-overwrite-confirmation", gboolean(!(options & QFileDialog::DontConfirmOverwrite)), NULL);
- g_object_set(gtkFileChooser, "local_only", gboolean(true), NULL);
- if (!filter.isEmpty()) {
- QStringList filters = qt_make_filter_list(filter);
- foreach (const QString &rawfilter, filters) {
- GtkFileFilter *gtkFilter = gtk_file_filter_new ();
- QString name = rawfilter.left(rawfilter.indexOf(QLatin1Char('(')));
- QStringList extensions = extract_filter(rawfilter);
- gtk_file_filter_set_name(gtkFilter, qPrintable(name.isEmpty() ? extensions.join(QLS(", ")) : name));
-
- foreach (const QString &fileExtension, extensions) {
- // Note Gtk file dialogs are by default case sensitive
- // and only supports basic glob syntax so we
- // rewrite .xyz to .[xX][yY][zZ]
- QString caseInsensitive;
- for (int i = 0 ; i < fileExtension.length() ; ++i) {
- QChar ch = fileExtension.at(i);
- if (ch.isLetter()) {
- caseInsensitive.append(
- QLatin1Char('[') +
- ch.toLower() +
- ch.toUpper() +
- QLatin1Char(']'));
- } else {
- caseInsensitive.append(ch);
- }
- }
- gtk_file_filter_add_pattern (gtkFilter, qPrintable(caseInsensitive));
-
- }
- if (filterMap)
- filterMap->insert(gtkFilter, rawfilter);
- gtk_file_chooser_add_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
- if (selectedFilter && (rawfilter == *selectedFilter))
- gtk_file_chooser_set_filter((GtkFileChooser*)gtkFileChooser, gtkFilter);
- }
- }
-
- // Using the currently active window is not entirely correct, however
- // it gives more sensible behavior for applications that do not provide a
- // parent
- QWidget *modalFor = parent ? parent->window() : qApp->activeWindow();
- if (modalFor) {
- gtk_widget_realize(gtkFileChooser); // Creates X window
- XSetTransientForHint(gdk_x11_drawable_get_xdisplay(gtkFileChooser->window),
- gdk_x11_drawable_get_xid(gtkFileChooser->window),
- modalFor->winId());
- gdk_x11_window_set_user_time (gtkFileChooser->window, QX11Info::appUserTime());
-
- }
-
- QFileInfo fileinfo(dir);
- if (dir.isEmpty())
- fileinfo.setFile(QDir::currentPath());
- fileinfo.makeAbsolute();
- if (fileinfo.isDir()) {
- gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(dir));
- } else if (isSaveDialog) {
- gtk_file_chooser_set_current_folder((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.absolutePath()));
- gtk_file_chooser_set_current_name((GtkFileChooser*)gtkFileChooser, qPrintable(fileinfo.fileName()));
- } else {
- gtk_file_chooser_set_filename((GtkFileChooser*)gtkFileChooser, qPrintable(dir));
- }
-}
-
-QString QGtkStylePrivate::openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options)
-{
- QMap<GtkFileFilter *, QString> filterMap;
- GtkWidget *gtkFileChooser = gtk_file_chooser_dialog_new (qPrintable(caption),
- NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
-
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
-
- QWidget modal_widget;
- modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
- modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
-
- QString filename;
- if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
- char *gtk_filename = gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
- filename = QString::fromUtf8(gtk_filename);
- g_free (gtk_filename);
- if (selectedFilter) {
- GtkFileFilter *gtkFilter = gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
- *selectedFilter = filterMap.value(gtkFilter);
- }
- }
-
- QApplicationPrivate::leaveModal(&modal_widget);
- gtk_widget_destroy (gtkFileChooser);
- return filename;
-}
-
-
-QString QGtkStylePrivate::openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options)
-{
- QMap<GtkFileFilter *, QString> filterMap;
- GtkWidget *gtkFileChooser = gtk_file_chooser_dialog_new (qPrintable(caption),
- NULL,
- GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
-
- setupGtkFileChooser(gtkFileChooser, parent, dir, QString(), 0, options);
- QWidget modal_widget;
- modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
- modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
-
- QString filename;
- if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
- char *gtk_filename = gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
- filename = QString::fromUtf8(gtk_filename);
- g_free (gtk_filename);
- }
-
- QApplicationPrivate::leaveModal(&modal_widget);
- gtk_widget_destroy (gtkFileChooser);
- return filename;
-}
-
-QStringList QGtkStylePrivate::openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options)
-{
- QStringList filenames;
- QMap<GtkFileFilter *, QString> filterMap;
- GtkWidget *gtkFileChooser = gtk_file_chooser_dialog_new (qPrintable(caption),
- NULL,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL);
-
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, false, &filterMap);
- g_object_set(gtkFileChooser, "select-multiple", gboolean(true), NULL);
-
- QWidget modal_widget;
- modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
- modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
-
- if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
- GSList *gtk_file_names = gtk_file_chooser_get_filenames((GtkFileChooser*)gtkFileChooser);
- for (GSList *iterator = gtk_file_names ; iterator; iterator = iterator->next)
- filenames << QString::fromUtf8((const char*)iterator->data);
- g_slist_free(gtk_file_names);
- if (selectedFilter) {
- GtkFileFilter *gtkFilter = gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
- *selectedFilter = filterMap.value(gtkFilter);
- }
- }
-
- QApplicationPrivate::leaveModal(&modal_widget);
- gtk_widget_destroy (gtkFileChooser);
- return filenames;
-}
-
-QString QGtkStylePrivate::saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options)
-{
- QMap<GtkFileFilter *, QString> filterMap;
- GtkWidget *gtkFileChooser = gtk_file_chooser_dialog_new (qPrintable(caption),
- NULL,
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
- NULL);
- setupGtkFileChooser(gtkFileChooser, parent, dir, filter, selectedFilter, options, true, &filterMap);
-
- QWidget modal_widget;
- modal_widget.setAttribute(Qt::WA_NoChildEventsForParent, true);
- modal_widget.setParent(parent, Qt::Window);
- QApplicationPrivate::enterModal(&modal_widget);
-
- QString filename;
- if (gtk_dialog_run ((GtkDialog*)gtkFileChooser) == GTK_RESPONSE_ACCEPT) {
- char *gtk_filename = gtk_file_chooser_get_filename ((GtkFileChooser*)gtkFileChooser);
- filename = QString::fromUtf8(gtk_filename);
- g_free (gtk_filename);
- if (selectedFilter) {
- GtkFileFilter *gtkFilter = gtk_file_chooser_get_filter ((GtkFileChooser*)gtkFileChooser);
- *selectedFilter = filterMap.value(gtkFilter);
- }
- }
-
- QApplicationPrivate::leaveModal(&modal_widget);
- gtk_widget_destroy (gtkFileChooser);
- return filename;
-}
-
-QIcon QGtkStylePrivate::getFilesystemIcon(const QFileInfo &info)
-{
- QIcon icon;
- if (gnome_vfs_init && gnome_icon_lookup_sync) {
- gnome_vfs_init();
- GtkIconTheme *theme = gtk_icon_theme_get_default();
- QByteArray fileurl = QUrl::fromLocalFile(info.absoluteFilePath()).toEncoded();
- char * icon_name = gnome_icon_lookup_sync(theme,
- NULL,
- fileurl.data(),
- NULL,
- GNOME_ICON_LOOKUP_FLAGS_NONE,
- NULL);
- QString iconName = QString::fromUtf8(icon_name);
- g_free(icon_name);
- if (iconName.startsWith(QLatin1Char('/')))
- return QIcon(iconName);
- return QIcon::fromTheme(iconName);
- }
- return icon;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qgtkstyle_p.h"
-
-#endif // !defined(QT_NO_STYLE_GTK)
-
+++ /dev/null
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGTKSTYLE_P_H
-#define QGTKSTYLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-#if !defined(QT_NO_STYLE_GTK)
-
-#include <QtCore/qstring.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <QtGui/QFileDialog>
-
-#include <QtGui/QGtkStyle>
-#include <qcleanlooksstyle_p.h>
-
-#undef signals // Collides with GTK stymbols
-#include <gtk/gtk.h>
-
-typedef unsigned long XID;
-
-#undef GTK_OBJECT_FLAGS
-#define GTK_OBJECT_FLAGS(obj)(((GtkObject*)(obj))->flags)
-#define Q_GTK_IS_WIDGET(widget) widget && GTK_CHECK_TYPE ((widget), gtk_widget_get_type())
-
-#define QLS(x) QLatin1String(x)
-
-QT_BEGIN_NAMESPACE
-
-typedef QStringList (*_qt_filedialog_open_filenames_hook)(QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-typedef QString (*_qt_filedialog_open_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-typedef QString (*_qt_filedialog_save_filename_hook) (QWidget * parent, const QString &caption, const QString &dir,
- const QString &filter, QString *selectedFilter, QFileDialog::Options options);
-typedef QString (*_qt_filedialog_existing_directory_hook)(QWidget *parent, const QString &caption, const QString &dir,
- QFileDialog::Options options);
-
-extern Q_GUI_EXPORT _qt_filedialog_open_filename_hook qt_filedialog_open_filename_hook;
-extern Q_GUI_EXPORT _qt_filedialog_open_filenames_hook qt_filedialog_open_filenames_hook;
-extern Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook;
-extern Q_GUI_EXPORT _qt_filedialog_existing_directory_hook qt_filedialog_existing_directory_hook;
-
-class QGtkStylePrivate;
-
-class QGtkStyleFilter : public QObject
-{
-public:
- QGtkStyleFilter(QGtkStylePrivate* sp)
- : stylePrivate(sp)
- {}
-private:
- QGtkStylePrivate* stylePrivate;
- bool eventFilter(QObject *obj, QEvent *e);
-};
-
-typedef enum {
- GNOME_ICON_LOOKUP_FLAGS_NONE = 0,
- GNOME_ICON_LOOKUP_FLAGS_EMBEDDING_TEXT = 1<<0,
- GNOME_ICON_LOOKUP_FLAGS_SHOW_SMALL_IMAGES_AS_THEMSELVES = 1<<1,
- GNOME_ICON_LOOKUP_FLAGS_ALLOW_SVG_AS_THEMSELVES = 1<<2
-} GnomeIconLookupFlags;
-
-typedef enum {
- GNOME_ICON_LOOKUP_RESULT_FLAGS_NONE = 0,
- GNOME_ICON_LOOKUP_RESULT_FLAGS_THUMBNAIL = 1<<0
-} GnomeIconLookupResultFlags;
-
-struct GnomeThumbnailFactory;
-typedef gboolean (*Ptr_gnome_vfs_init) (void);
-typedef char* (*Ptr_gnome_icon_lookup_sync) (
- GtkIconTheme *icon_theme,
- GnomeThumbnailFactory *,
- const char *file_uri,
- const char *custom_icon,
- GnomeIconLookupFlags flags,
- GnomeIconLookupResultFlags *result);
-
-class QGtkStylePrivate : public QCleanlooksStylePrivate
-{
- Q_DECLARE_PUBLIC(QGtkStyle)
-public:
- QGtkStylePrivate();
- ~QGtkStylePrivate();
-
- QGtkStyleFilter filter;
-
- static GtkWidget* gtkWidget(const QString &path);
- static GtkStyle* gtkStyle(const QString &path = QLatin1String("GtkWindow"));
-
- virtual void initGtkMenu() const;
- virtual void initGtkTreeview() const;
- virtual void initGtkWidgets() const;
-
- static void cleanupGtkWidgets();
-
- static bool isKDE4Session();
- void applyCustomPaletteHash();
- static QFont getThemeFont();
- static bool isThemeAvailable() { return gtkStyle() != 0; }
-
- static bool getGConfBool(const QString &key, bool fallback = 0);
- static QString getGConfString(const QString &key, const QString &fallback = QString());
-
- static QString getThemeName();
- static QString getIconThemeName();
- virtual int getSpinboxArrowSize() const;
-
- static void setupGtkFileChooser(GtkWidget* gtkFileChooser, QWidget *parent,
- const QString &dir, const QString &filter, QString *selectedFilter,
- QFileDialog::Options options, bool isSaveDialog = false,
- QMap<GtkFileFilter *, QString> *filterMap = 0);
-
- static QString openFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options);
- static QString saveFilename(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options);
- static QString openDirectory(QWidget *parent, const QString &caption, const QString &dir, QFileDialog::Options options);
- static QStringList openFilenames(QWidget *parent, const QString &caption, const QString &dir, const QString &filter,
- QString *selectedFilter, QFileDialog::Options options);
- static QIcon getFilesystemIcon(const QFileInfo &);
-
- static Ptr_gnome_icon_lookup_sync gnome_icon_lookup_sync;
- static Ptr_gnome_vfs_init gnome_vfs_init;
-
- virtual QPalette gtkWidgetPalette(const QString >kWidgetName) const;
-
-protected:
- typedef QHash<QString, GtkWidget*> WidgetMap;
-
- static inline void destroyWidgetMap()
- {
- cleanupGtkWidgets();
- delete widgetMap;
- widgetMap = 0;
- }
-
- static inline WidgetMap *gtkWidgetMap()
- {
- if (!widgetMap) {
- widgetMap = new WidgetMap();
- qAddPostRoutine(destroyWidgetMap);
- }
- return widgetMap;
- }
-
- static QStringList extract_filter(const QString &rawFilter);
-
- virtual GtkWidget* getTextColorWidget() const;
- static void setupGtkWidget(GtkWidget* widget);
- static void addWidgetToMap(GtkWidget* widget);
- static void addAllSubWidgets(GtkWidget *widget, gpointer v = 0);
- static void addWidget(GtkWidget *widget);
- static void removeWidgetFromMap(const QString &path);
-
- virtual void init();
-
-private:
- static QList<QGtkStylePrivate *> instances;
- static WidgetMap *widgetMap;
- friend class QGtkStyleUpdateScheduler;
-};
-
-// Helper to ensure that we have polished all our gtk widgets
-// before updating our own palettes
-class QGtkStyleUpdateScheduler : public QObject
-{
- Q_OBJECT
-public slots:
- void updateTheme();
-};
-
-QT_END_NAMESPACE
-
-#endif // !QT_NO_STYLE_GTK
-#endif // QGTKSTYLE_P_H
GUI style on Unix platforms.
\img qmotifstyle.png
- \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QPlastiqueStyle, QCDEStyle
+ \sa QWindowsStyle, QPlastiqueStyle, QCDEStyle
*/
/*!
KDE 3.2.
\img qplastiquestyle.png
- \sa QWindowsXPStyle, QMacStyle, QWindowsStyle, QCDEStyle, QMotifStyle
+ \sa QWindowsStyle, QCDEStyle, QMotifStyle
*/
/*!
Qt contains a set of QStyle subclasses that emulate the styles of
the different platforms supported by Qt (QWindowsStyle,
- QMacStyle, QMotifStyle, etc.). By default, these styles are built
- into the QtGui library. Styles can also be made available as
- plugins.
+ QMotifStyle, etc.). By default, these styles are built into the
+ QtGui library. Styles can also be made available as plugins.
Qt's built-in widgets use QStyle to perform nearly all of their
drawing, ensuring that they look exactly like the equivalent
#ifndef QT_NO_STYLE_CLEANLOOKS
#include "qcleanlooksstyle.h"
#endif
-#ifndef QT_NO_STYLE_GTK
-#include "qgtkstyle.h"
-#endif
QT_BEGIN_NAMESPACE
ret = new QCleanlooksStyle;
else
#endif
-#ifndef QT_NO_STYLE_GTK
- if (style == QLatin1String("gtk") || style == QLatin1String("gtk+"))
- ret = new QGtkStyle;
- else
-#endif
{ } // Keep these here - they make the #ifdefery above work
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
if(!ret) {
#include "qstyleoption.h"
#include "qapplication.h"
-#ifdef Q_WS_MAC
-# include "qt_mac_p.h"
-# include "qmacstyle_mac.h"
-#endif
-#include <qdebug.h>
-#include <QtCore/qmath.h>
+#include "qdebug.h"
+#include "qmath.h"
QT_BEGIN_NAMESPACE
state |= QStyle::State_Active;
if (widget->isWindow())
state |= QStyle::State_Window;
-#ifdef Q_WS_MAC
- extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
- if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
- state &= ~QStyle::State_Enabled;
-
- switch (QMacStyle::widgetSizePolicy(widget)) {
- case QMacStyle::SizeSmall:
- state |= QStyle::State_Small;
- break;
- case QMacStyle::SizeMini:
- state |= QStyle::State_Mini;
- break;
- default:
- ;
- }
-#endif
#ifdef QT_KEYPAD_NAVIGATION
if (widget->hasEditFocus())
state |= QStyle::State_HasEditFocus;
sz = csz + QSize(vertical ? 0 : spaceForIcon, vertical ? spaceForIcon : 0);
return subRule.boxSize(subRule.adjustSize(sz));
}
-#ifdef Q_WS_MAC
- if (baseStyle()->inherits("QMacStyle")) {
- //adjust the size after the call to the style because the mac style ignore the size arguments anyway.
- //this might cause the (max-){width,height} property to include the native style border while they should not.
- return subRule.adjustSize(baseStyle()->sizeFromContents(ct, opt, csz, w));
- }
-#endif
+
sz = subRule.adjustSize(csz);
break;
}
bSelector.pseudos << pseudo
// This is attributes. The third parameter is AttributeSelector::*
-// Ex. QComboBox[style="QWindowsXPStyle"]
+// Ex. QComboBox[style="QWindowsStyle"]
// ^ ^
#define ADD_ATTRIBUTE_SELECTOR(x, y, z) \
Pseudo pseudo;
AttributeSelector attr;
- // pixmap based style doesn't support any features
- bool styleIsPixmapBased = baseStyle()->inherits("QMacStyle")
- || baseStyle()->inherits("QWindowsXPStyle")
- || baseStyle()->inherits("QGtkStyle")
- || baseStyle()->inherits("QS60Style");
-
-
/*QLineEdit {
-qt-background-role: base;
border: native;
ADD_VALUE(Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
- if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
- ADD_DECLARATION;
- }
-
+ SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
+ ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ ADD_DECLARATION;
ADD_STYLE_RULE;
}
ADD_VALUE(Value::KnownIdentifier, Value_Native);
ADD_DECLARATION;
- if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-gradient"));
- ADD_DECLARATION;
- }
+ SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
+ ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ ADD_VALUE(Value::Identifier, QString::fromLatin1("background-gradient"));
+ ADD_DECLARATION;
SET_PROPERTY(QLatin1String("-qt-background-role"), QtBackgroundRole);
ADD_VALUE(Value::KnownIdentifier, Value_Base);
/*QMenu::item {
-qt-style-features: background-color;
}*/
- if (!styleIsPixmapBased) {
- SET_ELEMENT_NAME(QLatin1String("QMenu"));
- ADD_PSEUDO(QLatin1String("item"), PseudoClass_Unknown);
- ADD_BASIC_SELECTOR;
- ADD_SELECTOR;
+ SET_ELEMENT_NAME(QLatin1String("QMenu"));
+ ADD_PSEUDO(QLatin1String("item"), PseudoClass_Unknown);
+ ADD_BASIC_SELECTOR;
+ ADD_SELECTOR;
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
- ADD_DECLARATION;
+ SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
+ ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ ADD_DECLARATION;
- ADD_STYLE_RULE;
- }
+ ADD_STYLE_RULE;
/*QHeaderView {
-qt-background-role: window;
ADD_VALUE(Value::KnownIdentifier, Value_Button);
ADD_DECLARATION;
- if (!styleIsPixmapBased) {
- SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
- ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
- ADD_DECLARATION;
- }
+ SET_PROPERTY(QLatin1String("-qt-style-features"), QtStyleFeatures);
+ ADD_VALUE(Value::Identifier, QString::fromLatin1("background-color"));
+ ADD_DECLARATION;
SET_PROPERTY(QLatin1String("border"), Border);
ADD_VALUE(Value::KnownIdentifier, Value_Native);
This style is Qt's default GUI style on Windows.
\img qwindowsstyle.png
- \sa QWindowsXPStyle, QMacStyle, QPlastiqueStyle, QCDEStyle, QMotifStyle
+ \sa QPlastiqueStyle, QCDEStyle, QMotifStyle
*/
/*!
${CMAKE_CURRENT_SOURCE_DIR}/styles/qplastiquestyle.h
${CMAKE_CURRENT_SOURCE_DIR}/styles/qmotifstyle.h
${CMAKE_CURRENT_SOURCE_DIR}/styles/qwindowsstyle.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle_p.h
)
set(GUI_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/styles/qplastiquestyle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/styles/qmotifstyle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/styles/qwindowsstyle.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle.cpp
${CMAKE_CURRENT_SOURCE_DIR}/styles/qstyle.qrc
)
-if(WITH_GTK2 AND GTK2_FOUND)
- set(GUI_HEADERS
- ${GUI_HEADERS}
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkstyle.h
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkpainter_p.h
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkstyle_p.h
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle.h
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle_p.h
- )
- set(GUI_SOURCES
- ${GUI_SOURCES}
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkstyle.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkpainter.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qgtkstyle_p.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/styles/qcleanlooksstyle.cpp
- )
- set(EXTRA_GUI_LIBS
- ${EXTRA_GUI_LIBS}
- ${GTK2_LIBRARIES}
- )
- add_definitions(-DQT_STYLE_CLEANLOOKS ${GTK2_DEFINITIONS})
- include_directories(${GTK2_INCLUDE_DIRS})
-
- if(WITH_GCONF2 AND GCONF2_FOUND)
- set(EXTRA_GUI_LIBS
- ${EXTRA_GUI_LIBS}
- ${GCONF2_LIBRARIES}
- )
- include_directories(${GCONF2_INCLUDES})
- endif()
-else()
- add_definitions(-DQT_NO_STYLE_GTK -DQT_NO_STYLE_CLEANLOOKS)
-endif()
-
-add_definitions(-DQT_STYLE_MOTIF -DQT_STYLE_WINDOWS)
+add_definitions(-DQT_STYLE_MOTIF -DQT_STYLE_WINDOWS -DQT_STYLE_CLEANLOOKS)
# TODO: get rid of these conditionals
# add_definitions(-DQT_NO_STYLE_CDE -DQT_NO_STYLE_PLASTIQUE -DQT_NO_STYLE_MOTIF)
\ No newline at end of file
#include "qdockwidget_p.h"
#include "qmainwindowlayout_p.h"
-#ifdef Q_WS_MAC
-#include <qapplication_p.h>
-#include <qt_mac_p.h>
-#include <qmacstyle_mac.h>
-#endif
QT_BEGIN_NAMESPACE
int buttonHeight = qMax(perp(verticalTitleBar, closeSize),
perp(verticalTitleBar, floatSize));
- QFontMetrics titleFontMetrics = q->fontMetrics();
-#ifdef Q_WS_MAC
- if (qobject_cast<QMacStyle *>(q->style())) {
- //### this breaks on proxy styles. (But is this code still called?)
- QFont font = qt_app_fonts_hash()->value("QToolButton", q->font());
- titleFontMetrics = QFontMetrics(font);
- }
-#endif
-
- int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
+ const QFontMetrics titleFontMetrics = q->fontMetrics();
+ const int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q);
return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw);
}
QRect geo = q->geometry();
QRect titleRect = q->frameGeometry();
-#ifdef Q_WS_MAC
- if ((features & QDockWidget::DockWidgetVerticalTitleBar)) {
- titleRect.setTop(geo.top());
- titleRect.setBottom(geo.bottom());
- titleRect.setRight(geo.left() - 1);
- } else
-#endif
- {
- titleRect.setLeft(geo.left());
- titleRect.setRight(geo.right());
- titleRect.setBottom(geo.top() - 1);
- titleRect.adjust(0, fw, 0, 0);
- }
+ titleRect.setLeft(geo.left());
+ titleRect.setRight(geo.right());
+ titleRect.setBottom(geo.top() - 1);
+ titleRect.adjust(0, fw, 0, 0);
switch (event->type()) {
case QEvent::NonClientAreaMouseButtonPress:
#include <QApplication>
#include <QStyle>
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
-#include <QtGui/qmacstyle_mac.h>
-#endif
#include <QEvent>
#include <QScrollBar>
#include <qalgorithms.h>
QStyleOptionTitleBar options;
options.initFrom(widgets.at(0));
- int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // ### Remove this after the mac style has been fixed
- if (qobject_cast<QMacStyle *>(widgets.at(0)->style()))
- titleBarHeight -= 4;
-#endif
+ const int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0));
const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QWorkspaceTitleBar"));
const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1);
#include <QScrollBar>
#include <QDebug>
#include <QScopedValueRollback>
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
-#include <QtGui/qmacstyle_mac.h>
-#endif
#include <QMdiArea>
QT_BEGIN_NAMESPACE
Q_ASSERT(helpEvent->type() == QEvent::ToolTip);
Q_ASSERT(widget);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // Native Mac windows don't show tool tip.
- if (qobject_cast<QMacStyle *>(widget->style()))
- return;
-#endif
-
// Convert CC_MdiControls to CC_TitleBar. Sub controls of different complex
// controls cannot be in the same switch as they might have the same value.
if (complexControl == QStyle::CC_MdiControls) {
{
#ifndef QT_NO_CURSOR
Q_Q(QMdiSubWindow);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(q->style()))
- return;
-#endif
if (currentOperation == None) {
q->unsetCursor();
q->showNormal();
break;
case QStyle::SC_TitleBarMinButton:
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(q->style())) {
- if (q->isMinimized())
- q->showNormal();
- else
- q->showMinimized();
- break;
- }
-#endif
q->showMinimized();
break;
case QStyle::SC_TitleBarNormalButton:
q->showNormal();
break;
case QStyle::SC_TitleBarMaxButton:
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(q->style())) {
- if (q->isMaximized())
- q->showNormal();
- else
- q->showMaximized();
- break;
- }
-#endif
q->showMaximized();
break;
case QStyle::SC_TitleBarCloseButton:
}
QRegion region;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(q->style()))
- return region;
-#endif
-
switch (operation) {
case TopResize:
region = QRegion(titleBarHeight, 0, width - titleBarConst, frameWidth);
}
int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q);
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- // ### Fix mac style, the +4 pixels hack is not necessary anymore
- if (qobject_cast<QMacStyle *>(q->style()))
- height -= 4;
-#endif
if (hasBorder(options))
height += q->isMinimized() ? 8 : 4;
return height;
if (layout && layout->indexOf(newSizeGrip) != -1)
return;
newSizeGrip->setFixedSize(newSizeGrip->sizeHint());
- bool putSizeGripInLayout = layout ? true : false;
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(q->style()))
- putSizeGripInLayout = false;
-#endif
- if (putSizeGripInLayout) {
+ if (layout) {
layout->addWidget(newSizeGrip);
layout->setAlignment(newSizeGrip, Qt::AlignBottom | Qt::AlignRight);
} else {
d->isMaximizeMode = false;
d->isWidgetHiddenByUs = false;
if (!parent()) {
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(style()))
- delete d->sizeGrip;
-#endif
setOption(RubberBandResize, false);
setOption(RubberBandMove, false);
} else {
return;
}
-#if !defined(QT_NO_SIZEGRIP) && defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(style()) && !d->sizeGrip
- && !(windowFlags() & Qt::FramelessWindowHint)) {
- d->setSizeGrip(new QSizeGrip(0));
- Q_ASSERT(d->sizeGrip);
- if (isMinimized())
- d->setSizeGripVisible(false);
- else
- d->setSizeGripVisible(true);
- resize(size().expandedTo(d->internalMinimumSize));
- }
-#endif
-
d->updateDirtyRegions();
// Show buttons in the menu bar if they're already not there.
// We want to do this when QMdiSubWindow becomes visible after being hidden.
hoverRegion += style()->subControlRect(QStyle::CC_TitleBar, &options,
d->hoveredSubControl, this);
}
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- if (qobject_cast<QMacStyle *>(style()) && !hoverRegion.isEmpty())
- hoverRegion += QRegion(0, 0, width(), d->titleBarHeight(options));
-#endif
if (!hoverRegion.isEmpty())
update(hoverRegion);
}
int sizeGripHeight = 0;
if (d->sizeGrip && d->sizeGrip->isVisibleTo(const_cast<QMdiSubWindow *>(this)))
sizeGripHeight = d->sizeGrip->height();
-#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC)
- else if (parent() && qobject_cast<QMacStyle *>(style()) && !d->sizeGrip)
- sizeGripHeight = style()->pixelMetric(QStyle::PM_SizeGripSize, 0, this);
-#endif
minHeight = qMax(minHeight, decorationHeight + sizeGripHeight);
#endif
\property QProgressBar::textVisible
\brief whether the current completed percentage should be displayed
- This property may be ignored by the style (e.g., QMacStyle never draws the text).
+ This property may be ignored by the style.
\sa textDirection
*/
#include "qdebug.h"
#include "qlayoutitem.h"
#include "qdialogbuttonbox.h"
-#ifdef Q_WS_MAC
-#include "qmacstyle_mac.h"
-#include "qmacstyle_mac_p.h"
-#endif // Q_WS_MAC
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
stack = new QStackedWidget(q);
stack->setObjectName(QLatin1String("qt_tabwidget_stackedwidget"));
stack->setLineWidth(0);
- // hack so that QMacStyle::layoutSpacing() can detect tab widget pages
+#warning hack so that QMacStyle::layoutSpacing() can detect tab widget pages
stack->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred, QSizePolicy::TabWidget));
QObject::connect(stack, SIGNAL(widgetRemoved(int)), q, SLOT(_q_removeTab(int)));
\brief whether auto-raising is enabled or not.
The default is disabled (i.e. false).
-
- This property is currently ignored on Mac OS X when using QMacStyle.
*/
void QToolButton::setAutoRaise(bool enable)
{
#define QT_CLASS_MAP_H
static const ClassInfoEntry qclass_lib_map[] = {
- { "QDomImplementation", "QtXml/qdom.h"},
- { "QDomNode", "QtXml/qdom.h"},
- { "QDomNodeList", "QtXml/qdom.h"},
- { "QDomDocumentType", "QtXml/qdom.h"},
- { "QDomDocument", "QtXml/qdom.h"},
- { "QDomNamedNodeMap", "QtXml/qdom.h"},
- { "QDomDocumentFragment", "QtXml/qdom.h"},
- { "QDomCharacterData", "QtXml/qdom.h"},
- { "QDomAttr", "QtXml/qdom.h"},
- { "QDomElement", "QtXml/qdom.h"},
- { "QDomText", "QtXml/qdom.h"},
- { "QDomComment", "QtXml/qdom.h"},
- { "QDomCDATASection", "QtXml/qdom.h"},
- { "QDomNotation", "QtXml/qdom.h"},
- { "QDomEntity", "QtXml/qdom.h"},
- { "QDomEntityReference", "QtXml/qdom.h"},
- { "QDomProcessingInstruction", "QtXml/qdom.h"},
- { "QXmlNamespaceSupport", "QtXml/qxml.h"},
- { "QXmlAttributes", "QtXml/qxml.h"},
- { "QXmlInputSource", "QtXml/qxml.h"},
- { "QXmlParseException", "QtXml/qxml.h"},
- { "QXmlReader", "QtXml/qxml.h"},
- { "QXmlSimpleReader", "QtXml/qxml.h"},
- { "QXmlLocator", "QtXml/qxml.h"},
- { "QXmlContentHandler", "QtXml/qxml.h"},
- { "QXmlErrorHandler", "QtXml/qxml.h"},
- { "QXmlDTDHandler", "QtXml/qxml.h"},
- { "QXmlEntityResolver", "QtXml/qxml.h"},
- { "QXmlLexicalHandler", "QtXml/qxml.h"},
- { "QXmlDeclHandler", "QtXml/qxml.h"},
- { "QXmlDefaultHandler", "QtXml/qxml.h"},
- { "QAbstractSocket", "QtNetwork/qabstractsocket.h"},
- { "QLocalServer", "QtNetwork/qlocalserver.h"},
- { "QLocalSocket", "QtNetwork/qlocalsocket.h"},
- { "QTcpServer", "QtNetwork/qtcpserver.h"},
- { "QTcpSocket", "QtNetwork/qtcpsocket.h"},
- { "QUdpSocket", "QtNetwork/qudpsocket.h"},
- { "QNetworkConfigurationManager", "QtNetwork/qnetworkconfigmanager.h"},
- { "QNetworkConfiguration", "QtNetwork/qnetworkconfiguration.h"},
- { "QNetworkSession", "QtNetwork/qnetworksession.h"},
- { "QAuthenticator", "QtNetwork/qauthenticator.h"},
- { "QIPv6Address", "QtNetwork/qhostaddress.h"},
- { "QHostAddress", "QtNetwork/qhostaddress.h"},
- { "QHostInfo", "QtNetwork/qhostinfo.h"},
- { "QNetworkAddressEntry", "QtNetwork/qnetworkinterface.h"},
- { "QNetworkInterface", "QtNetwork/qnetworkinterface.h"},
- { "QNetworkProxyQuery", "QtNetwork/qnetworkproxy.h"},
- { "QNetworkProxy", "QtNetwork/qnetworkproxy.h"},
- { "QNetworkProxyFactory", "QtNetwork/qnetworkproxy.h"},
- { "QUrlInfo", "QtNetwork/qurlinfo.h"},
- { "QNetworkCacheMetaData", "QtNetwork/qabstractnetworkcache.h"},
- { "QAbstractNetworkCache", "QtNetwork/qabstractnetworkcache.h"},
- { "QFtp", "QtNetwork/qftp.h"},
- { "QHttpHeader", "QtNetwork/qhttp.h"},
- { "QHttpResponseHeader", "QtNetwork/qhttp.h"},
- { "QHttpRequestHeader", "QtNetwork/qhttp.h"},
- { "QHttp", "QtNetwork/qhttp.h"},
- { "QHttpPart", "QtNetwork/qhttpmultipart.h"},
- { "QHttpMultiPart", "QtNetwork/qhttpmultipart.h"},
- { "QNetworkAccessManager", "QtNetwork/qnetworkaccessmanager.h"},
- { "QNetworkCookie", "QtNetwork/qnetworkcookie.h"},
- { "QNetworkCookieJar", "QtNetwork/qnetworkcookiejar.h"},
- { "QNetworkDiskCache", "QtNetwork/qnetworkdiskcache.h"},
- { "QNetworkReply", "QtNetwork/qnetworkreply.h"},
- { "QNetworkRequest", "QtNetwork/qnetworkrequest.h"},
- { "QSslCertificate", "QtNetwork/qsslcertificate.h"},
- { "QSslCipher", "QtNetwork/qsslcipher.h"},
- { "QSslConfiguration", "QtNetwork/qsslconfiguration.h"},
- { "QSslError", "QtNetwork/qsslerror.h"},
- { "QSslKey", "QtNetwork/qsslkey.h"},
- { "QSslSocket", "QtNetwork/qsslsocket.h"},
- { "QScriptable", "QtScript/qscriptable.h"},
- { "QScriptClass", "QtScript/qscriptclass.h"},
- { "QScriptClassPropertyIterator", "QtScript/qscriptclasspropertyiterator.h"},
- { "QScriptContext", "QtScript/qscriptcontext.h"},
- { "QScriptContextInfo", "QtScript/qscriptcontextinfo.h"},
- { "QScriptSyntaxCheckResult", "QtScript/qscriptengine.h"},
- { "QScriptEngine", "QtScript/qscriptengine.h"},
- { "QScriptEngineAgent", "QtScript/qscriptengineagent.h"},
- { "QScriptExtensionInterface", "QtScript/qscriptextensioninterface.h"},
- { "QScriptExtensionPlugin", "QtScript/qscriptextensionplugin.h"},
- { "QScriptProgram", "QtScript/qscriptprogram.h"},
- { "QScriptString", "QtScript/qscriptstring.h"},
- { "QScriptValue", "QtScript/qscriptvalue.h"},
- { "QScriptValueIterator", "QtScript/qscriptvalueiterator.h"},
- { "QAbstractFormBuilder", "QtUiTools/abstractformbuilder.h"},
- { "QFormBuilder", "QtUiTools/formbuilder.h"},
- { "QUiLoader", "QtUiTools/quiloader.h"},
- { "QGraphicsSvgItem", "QtSvg/qgraphicssvgitem.h"},
- { "QSvgGenerator", "QtSvg/qsvggenerator.h"},
- { "QSvgRenderer", "QtSvg/qsvgrenderer.h"},
- { "QSvgWidget", "QtSvg/qsvgwidget.h"},
+ { "QTextCodec", "QtCore/qtextcodec.h"},
+ { "ConverterState", "QtCore/qtextcodec.h"},
+ { "QTextEncoder", "QtCore/qtextcodec.h"},
+ { "QTextDecoder", "QtCore/qtextcodec.h"},
+ { "QTextCodecFactoryInterface", "QtCore/qtextcodecplugin.h"},
+ { "QTextCodecPlugin", "QtCore/qtextcodecplugin.h"},
+ { "QXmlStreamAttribute", "QtCore/qxmlstream.h"},
+ { "QXmlStreamAttributes", "QtCore/qxmlstream.h"},
+ { "QXmlStreamNamespaceDeclaration", "QtCore/qxmlstream.h"},
+ { "QXmlStreamNotationDeclaration", "QtCore/qxmlstream.h"},
+ { "QXmlStreamEntityDeclaration", "QtCore/qxmlstream.h"},
+ { "QXmlStreamEntityResolver", "QtCore/qxmlstream.h"},
+ { "QXmlStreamReader", "QtCore/qxmlstream.h"},
+ { "QXmlStreamWriter", "QtCore/qxmlstream.h"},
+ { "QFutureInterfaceBase", "QtCore/qfutureinterface.h"},
+ { "QFutureWatcherBase", "QtCore/qfuturewatcher.h"},
+ { "Exception", "QtCore/qtconcurrentexception.h"},
+ { "UnhandledException", "QtCore/qtconcurrentexception.h"},
+ { "ExceptionStore", "QtCore/qtconcurrentexception.h"},
+ { "BlockSizeManager", "QtCore/qtconcurrentiteratekernel.h"},
+ { "ResultIteratorBase", "QtCore/qtconcurrentresultstore.h"},
+ { "ResultStoreBase", "QtCore/qtconcurrentresultstore.h"},
+ { "ThreadEngineBase", "QtCore/qtconcurrentthreadengine.h"},
+ { "QThreadPool", "QtCore/qthreadpool.h"},
+ { "QBitArray", "QtCore/qbitarray.h"},
+ { "QBitRef", "QtCore/qbitarray.h"},
+ { "QByteArray", "QtCore/qbytearray.h"},
+ { "QByteRef", "QtCore/qbytearray.h"},
+ { "QByteArrayMatcher", "QtCore/qbytearraymatcher.h"},
+ { "QChar", "QtCore/qchar.h"},
+ { "QCommandLineOption", "QtCore/qcommandlineoption.h"},
+ { "QCommandLineParser", "QtCore/qcommandlineparser.h"},
+ { "QContiguousCacheData", "QtCore/qcontiguouscache.h"},
+ { "QCryptographicHash", "QtCore/qcryptographichash.h"},
+ { "QDate", "QtCore/qdatetime.h"},
+ { "QTime", "QtCore/qdatetime.h"},
+ { "QDateTime", "QtCore/qdatetime.h"},
+ { "QEasingCurve", "QtCore/qeasingcurve.h"},
+ { "QElapsedTimer", "QtCore/qelapsedtimer.h"},
+ { "QHashData", "QtCore/qhash.h"},
+ { "QLine", "QtCore/qline.h"},
+ { "QLineF", "QtCore/qline.h"},
+ { "QLinkedListData", "QtCore/qlinkedlist.h"},
+ { "QListData", "QtCore/qlist.h"},
+ { "QSystemLocale", "QtCore/qlocale.h"},
+ { "QLocale", "QtCore/qlocale.h"},
+ { "QMapData", "QtCore/qmap.h"},
+ { "QPoint", "QtCore/qpoint.h"},
+ { "QPointF", "QtCore/qpoint.h"},
+ { "QRect", "QtCore/qrect.h"},
+ { "QRectF", "QtCore/qrect.h"},
+ { "QRegExp", "QtCore/qregexp.h"},
+ { "QSharedData", "QtCore/qshareddata.h"},
+ { "QSize", "QtCore/qsize.h"},
+ { "QSizeF", "QtCore/qsize.h"},
+ { "QString", "QtCore/qstring.h"},
+ { "QLatin1String", "QtCore/qstring.h"},
+ { "QCharRef", "QtCore/qstring.h"},
+ { "QStringRef", "QtCore/qstring.h"},
+ { "QAbstractConcatenable", "QtCore/qstringbuilder.h"},
+ { "QStringList", "QtCore/qstringlist.h"},
+ { "QStringMatcher", "QtCore/qstringmatcher.h"},
+ { "QTextBoundaryFinder", "QtCore/qtextboundaryfinder.h"},
+ { "QTimeLine", "QtCore/qtimeline.h"},
+ { "QVectorData", "QtCore/qvector.h"},
+ { "QAtomicInt", "QtCore/qatomic.h"},
+ { "QAtomicPointer", "QtCore/qatomic.h"},
+ { "QMutex", "QtCore/qmutex.h"},
+ { "QMutexLocker", "QtCore/qmutex.h"},
+ { "QReadWriteLock", "QtCore/qreadwritelock.h"},
+ { "QReadLocker", "QtCore/qreadwritelock.h"},
+ { "QWriteLocker", "QtCore/qreadwritelock.h"},
+ { "QSemaphore", "QtCore/qsemaphore.h"},
+ { "QThread", "QtCore/qthread.h"},
+ { "QThreadStorageData", "QtCore/qthreadstorage.h"},
+ { "QWaitCondition", "QtCore/qwaitcondition.h"},
+ { "QFactoryInterface", "QtCore/qfactoryinterface.h"},
+ { "QLibrary", "QtCore/qlibrary.h"},
+ { "QPluginLoader", "QtCore/qpluginloader.h"},
+ { "QUuid", "QtCore/quuid.h"},
+ { "QAbstractAnimation", "QtCore/qabstractanimation.h"},
+ { "QAnimationDriver", "QtCore/qabstractanimation.h"},
+ { "QAnimationGroup", "QtCore/qanimationgroup.h"},
+ { "QParallelAnimationGroup", "QtCore/qparallelanimationgroup.h"},
+ { "QPauseAnimation", "QtCore/qpauseanimation.h"},
+ { "QPropertyAnimation", "QtCore/qpropertyanimation.h"},
+ { "QSequentialAnimationGroup", "QtCore/qsequentialanimationgroup.h"},
+ { "QVariantAnimation", "QtCore/qvariantanimation.h"},
+ { "QLibraryInfo", "QtCore/qlibraryinfo.h"},
+ { "QInternal", "QtCore/qnamespace.h"},
+ { "QJsonArray", "QtCore/qjsonarray.h"},
+ { "QJsonParseError", "QtCore/qjsondocument.h"},
+ { "QJsonDocument", "QtCore/qjsondocument.h"},
+ { "QJsonObject", "QtCore/qjsonobject.h"},
+ { "QJsonValue", "QtCore/qjsonvalue.h"},
+ { "QJsonValueRef", "QtCore/qjsonvalue.h"},
+ { "QJsonValueRefPtr", "QtCore/qjsonvalue.h"},
+ { "QJsonValuePtr", "QtCore/qjsonvalue.h"},
+ { "QAbstractFileEngine", "QtCore/qabstractfileengine.h"},
+ { "QAbstractFileEngineHandler", "QtCore/qabstractfileengine.h"},
+ { "QAbstractFileEngineIterator", "QtCore/qabstractfileengine.h"},
+ { "QBuffer", "QtCore/qbuffer.h"},
+ { "QDataStream", "QtCore/qdatastream.h"},
+ { "QDebug", "QtCore/qdebug.h"},
+ { "QDir", "QtCore/qdir.h"},
+ { "QDirIterator", "QtCore/qdiriterator.h"},
+ { "QFile", "QtCore/qfile.h"},
+ { "QFileInfo", "QtCore/qfileinfo.h"},
+ { "QFileSystemWatcher", "QtCore/qfilesystemwatcher.h"},
+ { "QFSFileEngine", "QtCore/qfsfileengine.h"},
+ { "QIODevice", "QtCore/qiodevice.h"},
+ { "QProcessEnvironment", "QtCore/qprocess.h"},
+ { "QProcess", "QtCore/qprocess.h"},
+ { "QResource", "QtCore/qresource.h"},
+ { "QSettings", "QtCore/qsettings.h"},
+ { "QStandardPaths", "QtCore/qstandardpaths.h"},
+ { "QTemporaryFile", "QtCore/qtemporaryfile.h"},
+ { "QTextStream", "QtCore/qtextstream.h"},
+ { "QTextStreamManipulator", "QtCore/qtextstream.h"},
+ { "QUrl", "QtCore/qurl.h"},
+ { "QAbstractEventDispatcher", "QtCore/qabstracteventdispatcher.h"},
+ { "QModelIndex", "QtCore/qabstractitemmodel.h"},
+ { "QPersistentModelIndex", "QtCore/qabstractitemmodel.h"},
+ { "QAbstractItemModel", "QtCore/qabstractitemmodel.h"},
+ { "QAbstractTableModel", "QtCore/qabstractitemmodel.h"},
+ { "QAbstractListModel", "QtCore/qabstractitemmodel.h"},
+ { "QBasicTimer", "QtCore/qbasictimer.h"},
+ { "QCoreApplication", "QtCore/qcoreapplication.h"},
+ { "QEvent", "QtCore/qcoreevent.h"},
+ { "QTimerEvent", "QtCore/qcoreevent.h"},
+ { "QChildEvent", "QtCore/qcoreevent.h"},
+ { "QDynamicPropertyChangeEvent", "QtCore/qcoreevent.h"},
+ { "QEventLoop", "QtCore/qeventloop.h"},
+ { "QMetaMethod", "QtCore/qmetaobject.h"},
+ { "QMetaEnum", "QtCore/qmetaobject.h"},
+ { "QMetaProperty", "QtCore/qmetaobject.h"},
+ { "QMetaClassInfo", "QtCore/qmetaobject.h"},
+ { "QMetaType", "QtCore/qmetatype.h"},
+ { "QMimeData", "QtCore/qmimedata.h"},
+ { "QObject", "QtCore/qobject.h"},
+ { "QObjectCleanupHandler", "QtCore/qobjectcleanuphandler.h"},
+ { "QGenericArgument", "QtCore/qobjectdefs.h"},
+ { "QGenericReturnArgument", "QtCore/qobjectdefs.h"},
+ { "QMetaObject", "QtCore/qobjectdefs.h"},
+ { "QSharedMemory", "QtCore/qsharedmemory.h"},
+ { "QSignalMapper", "QtCore/qsignalmapper.h"},
+ { "QSocketNotifier", "QtCore/qsocketnotifier.h"},
+ { "QSystemSemaphore", "QtCore/qsystemsemaphore.h"},
+ { "QTimer", "QtCore/qtimer.h"},
+ { "QTranslator", "QtCore/qtranslator.h"},
+ { "QVariant", "QtCore/qvariant.h"},
{ "QAbstractTextDocumentLayout", "QtGui/qabstracttextdocumentlayout.h"},
{ "QTextObjectInterface", "QtGui/qabstracttextdocumentlayout.h"},
{ "QFont", "QtGui/qfont.h"},
{ "QCDEStyle", "QtGui/qcdestyle.h"},
{ "QCleanlooksStyle", "QtGui/qcleanlooksstyle.h"},
{ "QCommonStyle", "QtGui/qcommonstyle.h"},
- { "QGtkStyle", "QtGui/qgtkstyle.h"},
{ "QMotifStyle", "QtGui/qmotifstyle.h"},
{ "QPlastiqueStyle", "QtGui/qplastiquestyle.h"},
{ "QProxyStyle", "QtGui/qproxystyle.h"},
{ "QProgressDialog", "QtGui/qprogressdialog.h"},
{ "QWizard", "QtGui/qwizard.h"},
{ "QWizardPage", "QtGui/qwizard.h"},
- { "QBenchmarkIterationController", "QtTest/qbenchmark.h"},
- { "QTestData", "QtTest/qtestdata.h"},
- { "QTestEventLoop", "QtTest/qtesteventloop.h"},
- { "QTextCodec", "QtCore/qtextcodec.h"},
- { "ConverterState", "QtCore/qtextcodec.h"},
- { "QTextEncoder", "QtCore/qtextcodec.h"},
- { "QTextDecoder", "QtCore/qtextcodec.h"},
- { "QTextCodecFactoryInterface", "QtCore/qtextcodecplugin.h"},
- { "QTextCodecPlugin", "QtCore/qtextcodecplugin.h"},
- { "QXmlStreamAttribute", "QtCore/qxmlstream.h"},
- { "QXmlStreamAttributes", "QtCore/qxmlstream.h"},
- { "QXmlStreamNamespaceDeclaration", "QtCore/qxmlstream.h"},
- { "QXmlStreamNotationDeclaration", "QtCore/qxmlstream.h"},
- { "QXmlStreamEntityDeclaration", "QtCore/qxmlstream.h"},
- { "QXmlStreamEntityResolver", "QtCore/qxmlstream.h"},
- { "QXmlStreamReader", "QtCore/qxmlstream.h"},
- { "QXmlStreamWriter", "QtCore/qxmlstream.h"},
- { "QFutureInterfaceBase", "QtCore/qfutureinterface.h"},
- { "QFutureWatcherBase", "QtCore/qfuturewatcher.h"},
- { "Exception", "QtCore/qtconcurrentexception.h"},
- { "UnhandledException", "QtCore/qtconcurrentexception.h"},
- { "ExceptionStore", "QtCore/qtconcurrentexception.h"},
- { "BlockSizeManager", "QtCore/qtconcurrentiteratekernel.h"},
- { "ResultIteratorBase", "QtCore/qtconcurrentresultstore.h"},
- { "ResultStoreBase", "QtCore/qtconcurrentresultstore.h"},
- { "ThreadEngineBase", "QtCore/qtconcurrentthreadengine.h"},
- { "QThreadPool", "QtCore/qthreadpool.h"},
- { "QBitArray", "QtCore/qbitarray.h"},
- { "QBitRef", "QtCore/qbitarray.h"},
- { "QByteArray", "QtCore/qbytearray.h"},
- { "QByteRef", "QtCore/qbytearray.h"},
- { "QByteArrayMatcher", "QtCore/qbytearraymatcher.h"},
- { "QChar", "QtCore/qchar.h"},
- { "QCommandLineOption", "QtCore/qcommandlineoption.h"},
- { "QCommandLineParser", "QtCore/qcommandlineparser.h"},
- { "QContiguousCacheData", "QtCore/qcontiguouscache.h"},
- { "QCryptographicHash", "QtCore/qcryptographichash.h"},
- { "QDate", "QtCore/qdatetime.h"},
- { "QTime", "QtCore/qdatetime.h"},
- { "QDateTime", "QtCore/qdatetime.h"},
- { "QEasingCurve", "QtCore/qeasingcurve.h"},
- { "QElapsedTimer", "QtCore/qelapsedtimer.h"},
- { "QHashData", "QtCore/qhash.h"},
- { "QLine", "QtCore/qline.h"},
- { "QLineF", "QtCore/qline.h"},
- { "QLinkedListData", "QtCore/qlinkedlist.h"},
- { "QListData", "QtCore/qlist.h"},
- { "QSystemLocale", "QtCore/qlocale.h"},
- { "QLocale", "QtCore/qlocale.h"},
- { "QMapData", "QtCore/qmap.h"},
- { "QPoint", "QtCore/qpoint.h"},
- { "QPointF", "QtCore/qpoint.h"},
- { "QRect", "QtCore/qrect.h"},
- { "QRectF", "QtCore/qrect.h"},
- { "QRegExp", "QtCore/qregexp.h"},
- { "QSharedData", "QtCore/qshareddata.h"},
- { "QSize", "QtCore/qsize.h"},
- { "QSizeF", "QtCore/qsize.h"},
- { "QString", "QtCore/qstring.h"},
- { "QLatin1String", "QtCore/qstring.h"},
- { "QCharRef", "QtCore/qstring.h"},
- { "QStringRef", "QtCore/qstring.h"},
- { "QAbstractConcatenable", "QtCore/qstringbuilder.h"},
- { "QStringList", "QtCore/qstringlist.h"},
- { "QStringMatcher", "QtCore/qstringmatcher.h"},
- { "QTextBoundaryFinder", "QtCore/qtextboundaryfinder.h"},
- { "QTimeLine", "QtCore/qtimeline.h"},
- { "QVectorData", "QtCore/qvector.h"},
- { "QAtomicInt", "QtCore/qatomic.h"},
- { "QAtomicPointer", "QtCore/qatomic.h"},
- { "QMutex", "QtCore/qmutex.h"},
- { "QMutexLocker", "QtCore/qmutex.h"},
- { "QReadWriteLock", "QtCore/qreadwritelock.h"},
- { "QReadLocker", "QtCore/qreadwritelock.h"},
- { "QWriteLocker", "QtCore/qreadwritelock.h"},
- { "QSemaphore", "QtCore/qsemaphore.h"},
- { "QThread", "QtCore/qthread.h"},
- { "QThreadStorageData", "QtCore/qthreadstorage.h"},
- { "QWaitCondition", "QtCore/qwaitcondition.h"},
- { "QFactoryInterface", "QtCore/qfactoryinterface.h"},
- { "QLibrary", "QtCore/qlibrary.h"},
- { "QPluginLoader", "QtCore/qpluginloader.h"},
- { "QUuid", "QtCore/quuid.h"},
- { "QAbstractAnimation", "QtCore/qabstractanimation.h"},
- { "QAnimationDriver", "QtCore/qabstractanimation.h"},
- { "QAnimationGroup", "QtCore/qanimationgroup.h"},
- { "QParallelAnimationGroup", "QtCore/qparallelanimationgroup.h"},
- { "QPauseAnimation", "QtCore/qpauseanimation.h"},
- { "QPropertyAnimation", "QtCore/qpropertyanimation.h"},
- { "QSequentialAnimationGroup", "QtCore/qsequentialanimationgroup.h"},
- { "QVariantAnimation", "QtCore/qvariantanimation.h"},
- { "QLibraryInfo", "QtCore/qlibraryinfo.h"},
- { "QInternal", "QtCore/qnamespace.h"},
- { "QJsonArray", "QtCore/qjsonarray.h"},
- { "QJsonParseError", "QtCore/qjsondocument.h"},
- { "QJsonDocument", "QtCore/qjsondocument.h"},
- { "QJsonObject", "QtCore/qjsonobject.h"},
- { "QJsonValue", "QtCore/qjsonvalue.h"},
- { "QJsonValueRef", "QtCore/qjsonvalue.h"},
- { "QJsonValueRefPtr", "QtCore/qjsonvalue.h"},
- { "QJsonValuePtr", "QtCore/qjsonvalue.h"},
- { "QAbstractFileEngine", "QtCore/qabstractfileengine.h"},
- { "QAbstractFileEngineHandler", "QtCore/qabstractfileengine.h"},
- { "QAbstractFileEngineIterator", "QtCore/qabstractfileengine.h"},
- { "QBuffer", "QtCore/qbuffer.h"},
- { "QDataStream", "QtCore/qdatastream.h"},
- { "QDebug", "QtCore/qdebug.h"},
- { "QDir", "QtCore/qdir.h"},
- { "QDirIterator", "QtCore/qdiriterator.h"},
- { "QFile", "QtCore/qfile.h"},
- { "QFileInfo", "QtCore/qfileinfo.h"},
- { "QFileSystemWatcher", "QtCore/qfilesystemwatcher.h"},
- { "QFSFileEngine", "QtCore/qfsfileengine.h"},
- { "QIODevice", "QtCore/qiodevice.h"},
- { "QProcessEnvironment", "QtCore/qprocess.h"},
- { "QProcess", "QtCore/qprocess.h"},
- { "QResource", "QtCore/qresource.h"},
- { "QSettings", "QtCore/qsettings.h"},
- { "QStandardPaths", "QtCore/qstandardpaths.h"},
- { "QTemporaryFile", "QtCore/qtemporaryfile.h"},
- { "QTextStream", "QtCore/qtextstream.h"},
- { "QTextStreamManipulator", "QtCore/qtextstream.h"},
- { "QUrl", "QtCore/qurl.h"},
- { "QAbstractEventDispatcher", "QtCore/qabstracteventdispatcher.h"},
- { "QModelIndex", "QtCore/qabstractitemmodel.h"},
- { "QPersistentModelIndex", "QtCore/qabstractitemmodel.h"},
- { "QAbstractItemModel", "QtCore/qabstractitemmodel.h"},
- { "QAbstractTableModel", "QtCore/qabstractitemmodel.h"},
- { "QAbstractListModel", "QtCore/qabstractitemmodel.h"},
- { "QBasicTimer", "QtCore/qbasictimer.h"},
- { "QCoreApplication", "QtCore/qcoreapplication.h"},
- { "QEvent", "QtCore/qcoreevent.h"},
- { "QTimerEvent", "QtCore/qcoreevent.h"},
- { "QChildEvent", "QtCore/qcoreevent.h"},
- { "QDynamicPropertyChangeEvent", "QtCore/qcoreevent.h"},
- { "QEventLoop", "QtCore/qeventloop.h"},
- { "QMetaMethod", "QtCore/qmetaobject.h"},
- { "QMetaEnum", "QtCore/qmetaobject.h"},
- { "QMetaProperty", "QtCore/qmetaobject.h"},
- { "QMetaClassInfo", "QtCore/qmetaobject.h"},
- { "QMetaType", "QtCore/qmetatype.h"},
- { "QMimeData", "QtCore/qmimedata.h"},
- { "QObject", "QtCore/qobject.h"},
- { "QObjectCleanupHandler", "QtCore/qobjectcleanuphandler.h"},
- { "QGenericArgument", "QtCore/qobjectdefs.h"},
- { "QGenericReturnArgument", "QtCore/qobjectdefs.h"},
- { "QMetaObject", "QtCore/qobjectdefs.h"},
- { "QSharedMemory", "QtCore/qsharedmemory.h"},
- { "QSignalMapper", "QtCore/qsignalmapper.h"},
- { "QSocketNotifier", "QtCore/qsocketnotifier.h"},
- { "QSystemSemaphore", "QtCore/qsystemsemaphore.h"},
- { "QTimer", "QtCore/qtimer.h"},
- { "QTranslator", "QtCore/qtranslator.h"},
- { "QVariant", "QtCore/qvariant.h"},
- { "QDesignerComponents", "QtDesigner/qdesigner_components.h"},
- { "ActionProviderBase", "QtDesigner/default_actionprovider.h"},
- { "QToolBarActionProvider", "QtDesigner/default_actionprovider.h"},
- { "QMenuBarActionProvider", "QtDesigner/default_actionprovider.h"},
- { "QMenuActionProvider", "QtDesigner/default_actionprovider.h"},
- { "FormEditor", "QtDesigner/formeditor.h"},
- { "FormWindow", "QtDesigner/formwindow.h"},
- { "FormWindowWidgetStack", "QtDesigner/formwindow_widgetstack.h"},
- { "FormWindowCursor", "QtDesigner/formwindowcursor.h"},
- { "FormWindowManager", "QtDesigner/formwindowmanager.h"},
- { "IconCache", "QtDesigner/iconcache.h"},
- { "QDesignerResource", "QtDesigner/qdesigner_resource.h"},
- { "QtBrushManager", "QtDesigner/qtbrushmanager.h"},
- { "WidgetHandle", "QtDesigner/widgetselection.h"},
- { "WidgetSelection", "QtDesigner/widgetselection.h"},
- { "NewDynamicPropertyDialog", "QtDesigner/newdynamicpropertydialog.h"},
- { "PaletteEditorButton", "QtDesigner/paletteeditorbutton.h"},
- { "PropertyEditor", "QtDesigner/propertyeditor.h"},
- { "StringListEditorButton", "QtDesigner/stringlisteditorbutton.h"},
- { "SignalSlotEditor", "QtDesigner/signalsloteditor.h"},
- { "SignalSlotEditorPlugin", "QtDesigner/signalsloteditor_plugin.h"},
- { "SignalSlotEditorTool", "QtDesigner/signalsloteditor_tool.h"},
- { "ObjectInspector", "QtDesigner/objectinspector.h"},
- { "WidgetBox", "QtDesigner/widgetbox.h"},
- { "WidgetBoxDnDItem", "QtDesigner/widgetbox_dnditem.h"},
- { "BuddyEditor", "QtDesigner/buddyeditor.h"},
- { "BuddyEditorPlugin", "QtDesigner/buddyeditor_plugin.h"},
- { "BuddyEditorTool", "QtDesigner/buddyeditor_tool.h"},
- { "TabOrderEditor", "QtDesigner/tabordereditor.h"},
- { "TabOrderEditorPlugin", "QtDesigner/tabordereditor_plugin.h"},
- { "TabOrderEditorTool", "QtDesigner/tabordereditor_tool.h"},
- { "TaskMenuComponent", "QtDesigner/taskmenu_component.h"},
- { "QExtensionFactory", "QtDesigner/default_extensionfactory.h"},
- { "QExtensionManager", "QtDesigner/qextensionmanager.h"},
- { "QScriptEngineDebugger", "QtScriptTools/qscriptenginedebugger.h"},
{ "QDBusAbstractAdaptor", "QtDBus/qdbusabstractadaptor.h"},
{ "QDBusAbstractInterfaceBase", "QtDBus/qdbusabstractinterface.h"},
{ "QDBusAbstractInterface", "QtDBus/qdbusabstractinterface.h"},
{ "QDeclarativeItem", "QtDeclarative/qdeclarativeitem.h"},
{ "QDeclarativePropertyMap", "QtDeclarative/qdeclarativepropertymap.h"},
{ "QDeclarativeView", "QtDeclarative/qdeclarativeview.h"},
+ { "QDesignerComponents", "QtDesigner/qdesigner_components.h"},
+ { "ActionProviderBase", "QtDesigner/default_actionprovider.h"},
+ { "QToolBarActionProvider", "QtDesigner/default_actionprovider.h"},
+ { "QMenuBarActionProvider", "QtDesigner/default_actionprovider.h"},
+ { "QMenuActionProvider", "QtDesigner/default_actionprovider.h"},
+ { "FormEditor", "QtDesigner/formeditor.h"},
+ { "FormWindow", "QtDesigner/formwindow.h"},
+ { "FormWindowWidgetStack", "QtDesigner/formwindow_widgetstack.h"},
+ { "FormWindowCursor", "QtDesigner/formwindowcursor.h"},
+ { "FormWindowManager", "QtDesigner/formwindowmanager.h"},
+ { "IconCache", "QtDesigner/iconcache.h"},
+ { "QDesignerResource", "QtDesigner/qdesigner_resource.h"},
+ { "QtBrushManager", "QtDesigner/qtbrushmanager.h"},
+ { "WidgetHandle", "QtDesigner/widgetselection.h"},
+ { "WidgetSelection", "QtDesigner/widgetselection.h"},
+ { "NewDynamicPropertyDialog", "QtDesigner/newdynamicpropertydialog.h"},
+ { "PaletteEditorButton", "QtDesigner/paletteeditorbutton.h"},
+ { "PropertyEditor", "QtDesigner/propertyeditor.h"},
+ { "StringListEditorButton", "QtDesigner/stringlisteditorbutton.h"},
+ { "SignalSlotEditor", "QtDesigner/signalsloteditor.h"},
+ { "SignalSlotEditorPlugin", "QtDesigner/signalsloteditor_plugin.h"},
+ { "SignalSlotEditorTool", "QtDesigner/signalsloteditor_tool.h"},
+ { "ObjectInspector", "QtDesigner/objectinspector.h"},
+ { "WidgetBox", "QtDesigner/widgetbox.h"},
+ { "WidgetBoxDnDItem", "QtDesigner/widgetbox_dnditem.h"},
+ { "BuddyEditor", "QtDesigner/buddyeditor.h"},
+ { "BuddyEditorPlugin", "QtDesigner/buddyeditor_plugin.h"},
+ { "BuddyEditorTool", "QtDesigner/buddyeditor_tool.h"},
+ { "TabOrderEditor", "QtDesigner/tabordereditor.h"},
+ { "TabOrderEditorPlugin", "QtDesigner/tabordereditor_plugin.h"},
+ { "TabOrderEditorTool", "QtDesigner/tabordereditor_tool.h"},
+ { "TaskMenuComponent", "QtDesigner/taskmenu_component.h"},
+ { "QExtensionFactory", "QtDesigner/default_extensionfactory.h"},
+ { "QExtensionManager", "QtDesigner/qextensionmanager.h"},
+ { "QAbstractSocket", "QtNetwork/qabstractsocket.h"},
+ { "QLocalServer", "QtNetwork/qlocalserver.h"},
+ { "QLocalSocket", "QtNetwork/qlocalsocket.h"},
+ { "QTcpServer", "QtNetwork/qtcpserver.h"},
+ { "QTcpSocket", "QtNetwork/qtcpsocket.h"},
+ { "QUdpSocket", "QtNetwork/qudpsocket.h"},
+ { "QNetworkConfigurationManager", "QtNetwork/qnetworkconfigmanager.h"},
+ { "QNetworkConfiguration", "QtNetwork/qnetworkconfiguration.h"},
+ { "QNetworkSession", "QtNetwork/qnetworksession.h"},
+ { "QAuthenticator", "QtNetwork/qauthenticator.h"},
+ { "QIPv6Address", "QtNetwork/qhostaddress.h"},
+ { "QHostAddress", "QtNetwork/qhostaddress.h"},
+ { "QHostInfo", "QtNetwork/qhostinfo.h"},
+ { "QNetworkAddressEntry", "QtNetwork/qnetworkinterface.h"},
+ { "QNetworkInterface", "QtNetwork/qnetworkinterface.h"},
+ { "QNetworkProxyQuery", "QtNetwork/qnetworkproxy.h"},
+ { "QNetworkProxy", "QtNetwork/qnetworkproxy.h"},
+ { "QNetworkProxyFactory", "QtNetwork/qnetworkproxy.h"},
+ { "QUrlInfo", "QtNetwork/qurlinfo.h"},
+ { "QNetworkCacheMetaData", "QtNetwork/qabstractnetworkcache.h"},
+ { "QAbstractNetworkCache", "QtNetwork/qabstractnetworkcache.h"},
+ { "QFtp", "QtNetwork/qftp.h"},
+ { "QHttpHeader", "QtNetwork/qhttp.h"},
+ { "QHttpResponseHeader", "QtNetwork/qhttp.h"},
+ { "QHttpRequestHeader", "QtNetwork/qhttp.h"},
+ { "QHttp", "QtNetwork/qhttp.h"},
+ { "QHttpPart", "QtNetwork/qhttpmultipart.h"},
+ { "QHttpMultiPart", "QtNetwork/qhttpmultipart.h"},
+ { "QNetworkAccessManager", "QtNetwork/qnetworkaccessmanager.h"},
+ { "QNetworkCookie", "QtNetwork/qnetworkcookie.h"},
+ { "QNetworkCookieJar", "QtNetwork/qnetworkcookiejar.h"},
+ { "QNetworkDiskCache", "QtNetwork/qnetworkdiskcache.h"},
+ { "QNetworkReply", "QtNetwork/qnetworkreply.h"},
+ { "QNetworkRequest", "QtNetwork/qnetworkrequest.h"},
+ { "QSslCertificate", "QtNetwork/qsslcertificate.h"},
+ { "QSslCipher", "QtNetwork/qsslcipher.h"},
+ { "QSslConfiguration", "QtNetwork/qsslconfiguration.h"},
+ { "QSslError", "QtNetwork/qsslerror.h"},
+ { "QSslKey", "QtNetwork/qsslkey.h"},
+ { "QSslSocket", "QtNetwork/qsslsocket.h"},
{ "QSqlQueryModel", "QtSql/qsqlquerymodel.h"},
{ "QSqlRelation", "QtSql/qsqlrelationaltablemodel.h"},
{ "QSqlRelationalTableModel", "QtSql/qsqlrelationaltablemodel.h"},
{ "QSqlQuery", "QtSql/qsqlquery.h"},
{ "QSqlRecord", "QtSql/qsqlrecord.h"},
{ "QSqlResult", "QtSql/qsqlresult.h"},
+ { "QGraphicsSvgItem", "QtSvg/qgraphicssvgitem.h"},
+ { "QSvgGenerator", "QtSvg/qsvggenerator.h"},
+ { "QSvgRenderer", "QtSvg/qsvgrenderer.h"},
+ { "QSvgWidget", "QtSvg/qsvgwidget.h"},
+ { "QDomImplementation", "QtXml/qdom.h"},
+ { "QDomNode", "QtXml/qdom.h"},
+ { "QDomNodeList", "QtXml/qdom.h"},
+ { "QDomDocumentType", "QtXml/qdom.h"},
+ { "QDomDocument", "QtXml/qdom.h"},
+ { "QDomNamedNodeMap", "QtXml/qdom.h"},
+ { "QDomDocumentFragment", "QtXml/qdom.h"},
+ { "QDomCharacterData", "QtXml/qdom.h"},
+ { "QDomAttr", "QtXml/qdom.h"},
+ { "QDomElement", "QtXml/qdom.h"},
+ { "QDomText", "QtXml/qdom.h"},
+ { "QDomComment", "QtXml/qdom.h"},
+ { "QDomCDATASection", "QtXml/qdom.h"},
+ { "QDomNotation", "QtXml/qdom.h"},
+ { "QDomEntity", "QtXml/qdom.h"},
+ { "QDomEntityReference", "QtXml/qdom.h"},
+ { "QDomProcessingInstruction", "QtXml/qdom.h"},
+ { "QXmlNamespaceSupport", "QtXml/qxml.h"},
+ { "QXmlAttributes", "QtXml/qxml.h"},
+ { "QXmlInputSource", "QtXml/qxml.h"},
+ { "QXmlParseException", "QtXml/qxml.h"},
+ { "QXmlReader", "QtXml/qxml.h"},
+ { "QXmlSimpleReader", "QtXml/qxml.h"},
+ { "QXmlLocator", "QtXml/qxml.h"},
+ { "QXmlContentHandler", "QtXml/qxml.h"},
+ { "QXmlErrorHandler", "QtXml/qxml.h"},
+ { "QXmlDTDHandler", "QtXml/qxml.h"},
+ { "QXmlEntityResolver", "QtXml/qxml.h"},
+ { "QXmlLexicalHandler", "QtXml/qxml.h"},
+ { "QXmlDeclHandler", "QtXml/qxml.h"},
+ { "QXmlDefaultHandler", "QtXml/qxml.h"},
+ { "QScriptable", "QtScript/qscriptable.h"},
+ { "QScriptClass", "QtScript/qscriptclass.h"},
+ { "QScriptClassPropertyIterator", "QtScript/qscriptclasspropertyiterator.h"},
+ { "QScriptContext", "QtScript/qscriptcontext.h"},
+ { "QScriptContextInfo", "QtScript/qscriptcontextinfo.h"},
+ { "QScriptSyntaxCheckResult", "QtScript/qscriptengine.h"},
+ { "QScriptEngine", "QtScript/qscriptengine.h"},
+ { "QScriptEngineAgent", "QtScript/qscriptengineagent.h"},
+ { "QScriptExtensionInterface", "QtScript/qscriptextensioninterface.h"},
+ { "QScriptExtensionPlugin", "QtScript/qscriptextensionplugin.h"},
+ { "QScriptProgram", "QtScript/qscriptprogram.h"},
+ { "QScriptString", "QtScript/qscriptstring.h"},
+ { "QScriptValue", "QtScript/qscriptvalue.h"},
+ { "QScriptValueIterator", "QtScript/qscriptvalueiterator.h"},
+ { "QScriptEngineDebugger", "QtScriptTools/qscriptenginedebugger.h"},
+ { "QBenchmarkIterationController", "QtTest/qbenchmark.h"},
+ { "QTestData", "QtTest/qtestdata.h"},
+ { "QTestEventLoop", "QtTest/qtesteventloop.h"},
+ { "QAbstractFormBuilder", "QtUiTools/abstractformbuilder.h"},
+ { "QFormBuilder", "QtUiTools/formbuilder.h"},
+ { "QUiLoader", "QtUiTools/quiloader.h"},
};
-static const int qclass_lib_count = 697;
+static const int qclass_lib_count = 696;
#endif