Qt 4.8
Typedefs | Functions | Variables
qgtkstyle_p.cpp File Reference
#include "qgtkstyle_p.h"
#include <QtCore/qglobal.h>
#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 <private/qapplication_p.h>
#include <private/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>
#include <private/qt_x11_p.h>

Go to the source code of this file.

Typedefs

typedef int(* x11ErrorHandler) (Display *, XErrorEvent *)
 

Functions

static QHashableLatin1Literal classPath (GtkWidget *widget)
 
static void gtkStyleSetCallback (GtkWidget *)
 
bool operator== (const QHashableLatin1Literal &l1, const QHashableLatin1Literal &l2)
 
 Q_DECLARE_METATYPE (QGtkStylePrivate *)
 
uint qHash (const QHashableLatin1Literal &key)
 
QStringList qt_make_filter_list (const QString &filter)
 
static bool resolveGConf ()
 
static void update_toolbar_style (GtkWidget *gtkToolBar, GParamSpec *, gpointer)
 

Variables

static bool displayDepth = -1
 

Typedef Documentation

◆ x11ErrorHandler

typedef int(* x11ErrorHandler) (Display *, XErrorEvent *)

Definition at line 207 of file qgtkstyle_p.cpp.

Function Documentation

◆ classPath()

static QHashableLatin1Literal classPath ( GtkWidget *  widget)
static

Definition at line 239 of file qgtkstyle_p.cpp.

Referenced by QGtkStylePrivate::addWidgetToMap().

240 {
241  char *class_path;
242  QGtkStylePrivate::gtk_widget_path (widget, NULL, &class_path, NULL);
243 
244  char *copy = class_path;
245  if (strncmp(copy, "GtkWindow.", 10) == 0)
246  copy += 10;
247  if (strncmp(copy, "GtkFixed.", 9) == 0)
248  copy += 9;
249 
250  copy = strdup(copy);
251 
252  g_free(class_path);
253 
255 }
static Ptr_gtk_widget_path gtk_widget_path
Definition: qgtkstyle_p.h:433
QPointer< QWidget > widget
static QHashableLatin1Literal fromData(const char *str)
Definition: qgtkstyle_p.h:112

◆ gtkStyleSetCallback()

static void gtkStyleSetCallback ( GtkWidget *  )
static

Definition at line 215 of file qgtkstyle_p.cpp.

Referenced by QGtkStylePrivate::initGtkWidgets().

216 {
217  qRegisterMetaType<QGtkStylePrivate *>();
218 
219  // We have to let this function return and complete the event
220  // loop to ensure that all gtk widgets have been styled before
221  // updating
222  QMetaObject::invokeMethod(styleScheduler(), "updateTheme", Qt::QueuedConnection);
223 }
static bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType, QGenericReturnArgument ret, QGenericArgument val0=QGenericArgument(0), QGenericArgument val1=QGenericArgument(), QGenericArgument val2=QGenericArgument(), QGenericArgument val3=QGenericArgument(), QGenericArgument val4=QGenericArgument(), QGenericArgument val5=QGenericArgument(), QGenericArgument val6=QGenericArgument(), QGenericArgument val7=QGenericArgument(), QGenericArgument val8=QGenericArgument(), QGenericArgument val9=QGenericArgument())
Invokes the member (a signal or a slot name) on the object obj.

◆ operator==()

bool operator== ( const QHashableLatin1Literal l1,
const QHashableLatin1Literal l2 
)

Definition at line 1142 of file qgtkstyle_p.cpp.

Referenced by operator!=().

1143 {
1144  return l1.size() == l2.size() || qstrcmp(l1.data(), l2.data()) == 0;
1145 }
const char * data() const
Definition: qgtkstyle_p.h:86
int qstrcmp(const char *str1, const char *str2)
A safe strcmp() function.
Definition: qbytearray.cpp:231

◆ Q_DECLARE_METATYPE()

Q_DECLARE_METATYPE ( QGtkStylePrivate )

◆ qHash()

uint qHash ( const QHashableLatin1Literal key)

Definition at line 1148 of file qgtkstyle_p.cpp.

Referenced by operator!=().

1149 {
1150  int n = key.size();
1151  const uchar *p = reinterpret_cast<const uchar *>(key.data());
1152  uint h = 0;
1153  uint g;
1154 
1155  while (n--) {
1156  h = (h << 4) + *p++;
1157  if ((g = (h & 0xf0000000)) != 0)
1158  h ^= g >> 23;
1159  h &= ~g;
1160  }
1161  return h;
1162 }
const char * data() const
Definition: qgtkstyle_p.h:86
unsigned char uchar
Definition: qglobal.h:994
unsigned int uint
Definition: qglobal.h:996

◆ qt_make_filter_list()

QStringList qt_make_filter_list ( const QString filter)

Definition at line 1075 of file qfiledialog.cpp.

Referenced by QGtkStylePrivate::extract_filter(), QFileDialog::selectNameFilter(), QFileDialog::setNameFilter(), and QGtkStylePrivate::setupGtkFileChooser().

1076 {
1077  QString f(filter);
1078 
1079  if (f.isEmpty())
1080  return QStringList();
1081 
1082  QString sep(QLatin1String(";;"));
1083  int i = f.indexOf(sep, 0);
1084  if (i == -1) {
1085  if (f.indexOf(QLatin1Char('\n'), 0) != -1) {
1086  sep = QLatin1Char('\n');
1087  i = f.indexOf(sep, 0);
1088  }
1089  }
1090 
1091  return f.split(sep);
1092 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ resolveGConf()

static bool resolveGConf ( )
static

Definition at line 605 of file qgtkstyle_p.cpp.

Referenced by QGtkStylePrivate::getGConfBool(), QGtkStylePrivate::getGConfString(), and QGtkStylePrivate::getThemeName().

606 {
611  }
613 }
static Ptr_gconf_client_get_string gconf_client_get_string
Definition: qgtkstyle_p.h:476
static Ptr_gconf_client_get_default gconf_client_get_default
Definition: qgtkstyle_p.h:475
char *(* Ptr_gconf_client_get_string)(GConfClient *, const char *, GError **)
Definition: qgtkstyle_p.h:136
static Ptr_gconf_client_get_bool gconf_client_get_bool
Definition: qgtkstyle_p.h:477
void * resolve(const char *symbol)
Returns the address of the exported symbol symbol.
Definition: qlibrary.cpp:1155
#define QLS(x)
Definition: qgtkstyle_p.h:77
bool(* Ptr_gconf_client_get_bool)(GConfClient *, const char *, GError **)
Definition: qgtkstyle_p.h:137
GConfClient *(* Ptr_gconf_client_get_default)()
Definition: qgtkstyle_p.h:135

◆ update_toolbar_style()

static void update_toolbar_style ( GtkWidget *  gtkToolBar,
GParamSpec *  ,
gpointer   
)
static

Definition at line 225 of file qgtkstyle_p.cpp.

Referenced by QGtkStylePrivate::initGtkWidgets().

226 {
227  GtkToolbarStyle toolbar_style = GTK_TOOLBAR_ICONS;
228  g_object_get(gtkToolBar, "toolbar-style", &toolbar_style, NULL);
230  for (int i = 0; i < widgets.size(); ++i) {
231  QWidget *widget = widgets.at(i);
232  if (qobject_cast<QToolButton*>(widget)) {
234  QApplication::sendEvent(widget, &event);
235  }
236  }
237 }
static QWidgetList allWidgets()
Returns a list of all the widgets in the application.
EventRef event
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QEvent class is the base class of all event classes.
Definition: qcoreevent.h:56
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

Variable Documentation

◆ displayDepth

bool displayDepth = -1
static

Definition at line 82 of file qgtkstyle_p.cpp.

Referenced by QGtkStylePrivate::initGtkWidgets().