summaryrefslogtreecommitdiffstats
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/qapplication_x11.cpp6
-rw-r--r--src/kernel/qeventloop_unix.cpp6
-rw-r--r--src/kernel/qprocess_unix.cpp8
-rw-r--r--src/kernel/qstyle.cpp192
-rw-r--r--src/kernel/qstyle.h72
5 files changed, 249 insertions, 35 deletions
diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp
index ef6571a..6a68604 100644
--- a/src/kernel/qapplication_x11.cpp
+++ b/src/kernel/qapplication_x11.cpp
@@ -4445,7 +4445,9 @@ bool QETWidget::translateXinputEvent( const XEvent *ev )
QPair<int, int> tId;
XEvent xinputMotionEvent;
XEvent mouseMotionEvent;
+#if defined (Q_OS_IRIX)
XDevice *dev;
+#endif
const XDeviceMotionEvent *motion = 0;
XDeviceButtonEvent *button = 0;
QEvent::Type t;
@@ -4501,18 +4503,14 @@ bool QETWidget::translateXinputEvent( const XEvent *ev )
#else
if ( ev->type == xinput_motion ) {
if ( motion->deviceid == devStylus->device_id ) {
- dev = devStylus;
deviceType = QTabletEvent::Stylus;
} else if ( motion->deviceid == devEraser->device_id ) {
- dev = devEraser;
deviceType = QTabletEvent::Eraser;
}
} else {
if ( button->deviceid == devStylus->device_id ) {
- dev = devStylus;
deviceType = QTabletEvent::Stylus;
} else if ( button->deviceid == devEraser->device_id ) {
- dev = devEraser;
deviceType = QTabletEvent::Eraser;
}
}
diff --git a/src/kernel/qeventloop_unix.cpp b/src/kernel/qeventloop_unix.cpp
index 743eb1d..b0ad8b9 100644
--- a/src/kernel/qeventloop_unix.cpp
+++ b/src/kernel/qeventloop_unix.cpp
@@ -505,7 +505,11 @@ void QEventLoop::wakeUp()
size_t nbytes = 0;
char c = 0;
if ( ::ioctl( d->thread_pipe[0], FIONREAD, (char*)&nbytes ) >= 0 && nbytes == 0 ) {
- ::write( d->thread_pipe[1], &c, 1 );
+ if (::write( d->thread_pipe[1], &c, 1 ) < 0) {
+#if defined(QT_CHECK_RANGE)
+ qWarning( "QEventLoop: Internal error (failed thread pipe write)" );
+#endif
+ }
}
}
diff --git a/src/kernel/qprocess_unix.cpp b/src/kernel/qprocess_unix.cpp
index 40476d3..2a4a2fd 100644
--- a/src/kernel/qprocess_unix.cpp
+++ b/src/kernel/qprocess_unix.cpp
@@ -813,7 +813,9 @@ bool QProcess::start( QStringList *env )
::dup2( STDOUT_FILENO, STDERR_FILENO );
}
#ifndef QT_NO_DIR
- ::chdir( workingDir.absPath().latin1() );
+ if (::chdir( workingDir.absPath().latin1() ) < 0) {
+ qWarning( "Could not chdir" );
+ }
#endif
if ( fd[0] )
::close( fd[0] );
@@ -890,7 +892,9 @@ bool QProcess::start( QStringList *env )
}
if ( fd[1] ) {
char buf = 0;
- ::write( fd[1], &buf, 1 );
+ if (::write( fd[1], &buf, 1 ) < 0) {
+ qWarning( "Could not write to file descriptor" );
+ }
::close( fd[1] );
}
::_exit( -1 );
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index fc4daa2..1d085f3 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -46,6 +46,8 @@
#include "qpixmapcache.h"
#include "qframe.h"
#include "qlayout.h"
+#include "qlistview.h"
+#include "qpopupmenu.h"
#include "qobjectlist.h"
#include "qwidgetlist.h"
@@ -592,7 +594,18 @@ void QStyle::polish( QPalette&)
(\l{QPopupMenu::setMouseTracking()}) and whether the menu is
checkable by default (\l{QPopupMenu::setCheckable()}).
*/
-void QStyle::polishPopupMenu( QPopupMenu *)
+void QStyle::polishPopupMenu( QPopupMenu *pm ) {
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(pm, QStyleOption());
+ unPolish(ceData, getControlElementFlagsForObject(pm, ceData.widgetObjectTypes, QStyleOption()), pm);
+}
+
+/*!
+ Polishes the popup menu according to the GUI style. This usually
+ means setting the mouse tracking
+ (\l{QPopupMenu::setMouseTracking()}) and whether the menu is
+ checkable by default (\l{QPopupMenu::setCheckable()}).
+*/
+void QStyle::polishPopupMenu( QStyleControlElementData, ControlElementFlags, void * )
{
}
@@ -2204,6 +2217,18 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen
else if (request == WAR_DisableMouseTracking) {
widget->setMouseTracking(FALSE);
}
+ else if (request == WAR_SetCheckable) {
+ QPopupMenu *pm = dynamic_cast<QPopupMenu*>(widget);
+ if (pm) {
+ pm->setCheckable(TRUE);
+ }
+ }
+ else if (request == WAR_UnSetCheckable) {
+ QPopupMenu *pm = dynamic_cast<QPopupMenu*>(widget);
+ if (pm) {
+ pm->setCheckable(FALSE);
+ }
+ }
else if (request == WAR_FrameSetStyle) {
QFrame* frame = dynamic_cast<QFrame*>(widget);
if (frame) {
@@ -2265,6 +2290,10 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen
}
void QStyle::acceleratorKeypressEventMonitor( QObject *o, QEvent *e ) {
+ // RAJA FIXME
+ // Also, SH_HideUnderlineAcceleratorWhenAltUp should probably be set to 1 in the QWindowsStyle::styleHint overridden method
+ // Additionally, the common styleHint code in TDE (that controls popupmenu settings and such via configuration files) needs to be modified to add a config option for this new style hint
+
if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, QStyleControlElementData(), CEF_None, QStyleOption::Default, NULL, NULL) != 0) {
QWidget *widget = dynamic_cast<QWidget*>(o);
if (widget) {
@@ -2324,6 +2353,167 @@ QStyleWidgetActionRequestData::~QStyleWidgetActionRequestData() {
//
}
+// ============================================================================================
+// Interface methods
+// ============================================================================================
+
+void QStyle::drawPrimitive( PrimitiveElement pe,
+ QPainter *p,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ const QStyleOption& opt ) const
+{
+ const QWidget* widget = 0;
+
+ // Determine if the request needs widget information and set widget appropriately
+ // FIXME
+ if ((pe == PE_CheckListController) || (pe == PE_CheckListExclusiveIndicator) || (pe == PE_CheckListIndicator)) {
+ QCheckListItem *item = opt.checkListItem();
+ if (item) {
+ QListView *lv = item->listView();
+ widget = dynamic_cast<QWidget*>(lv);
+ }
+ }
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, cg, flags, opt);
+}
+
+void QStyle::drawControl( ControlElement element,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ const QStyleOption& opt ) const
+{
+#if defined(QT_CHECK_STATE)
+ if (!widget) {
+ qWarning("QStyle::drawControl: widget parameter cannot be zero!");
+ return;
+ }
+#endif
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControl(element, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, cg, flags, opt, widget);
+}
+
+void QStyle::drawControlMask( ControlElement control,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QStyleOption& opt ) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
+ drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, opt, widget);
+}
+
+QRect QStyle::subRect(SubRect r, const QWidget *widget) const
+{
+#if defined(QT_CHECK_STATE)
+ if (! widget) {
+ qWarning("QStyle::subRect: widget parameter cannot be zero!");
+ return QRect();
+ }
+#endif
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ return subRect(r, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+}
+
+void QStyle::drawComplexControl( ComplexControl control,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QColorGroup &cg,
+ SFlags flags,
+ SCFlags controls,
+ SCFlags active,
+ const QStyleOption& opt ) const
+{
+#if defined(QT_CHECK_STATE)
+ if (! widget) {
+ qWarning("QStyle::drawComplexControl: widget parameter cannot be zero!");
+ return;
+ }
+#endif
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, cg, flags, controls, active, opt, widget);
+}
+
+void QStyle::drawComplexControlMask( ComplexControl control,
+ QPainter *p,
+ const QWidget *widget,
+ const QRect &r,
+ const QStyleOption& opt ) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), r, opt, widget);
+}
+
+QRect QStyle::querySubControlMetrics( ComplexControl control,
+ const QWidget *widget,
+ SubControl sc,
+ const QStyleOption &opt ) const
+{
+#if defined(QT_CHECK_STATE)
+ if (! widget) {
+ qWarning("QStyle::querySubControlMetrics: widget parameter cannot be zero!");
+ return QRect();
+ }
+#endif
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption(), false);
+ return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), sc, opt, widget);
+}
+
+QStyle::SubControl QStyle::querySubControl(ComplexControl control,
+ const QWidget *widget,
+ const QPoint &pos,
+ const QStyleOption& opt ) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt);
+ return querySubControl(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), pos, opt, widget);
+}
+
+int QStyle::pixelMetric(PixelMetric m, const QWidget *widget) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), widget);
+}
+
+QSize QStyle::sizeFromContents(ContentsType contents,
+ const QWidget *widget,
+ const QSize &contentsSize,
+ const QStyleOption& opt ) const
+{
+ QSize sz(contentsSize);
+
+#if defined(QT_CHECK_STATE)
+ if (! widget) {
+ qWarning("QStyle::sizeFromContents: widget parameter cannot be zero!");
+ return sz;
+ }
+#endif
+
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(widget, QStyleOption());
+ return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, QStyleOption()), contentsSize, opt, widget);
+}
+
+int QStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption &so, QStyleHintReturn *shr) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(w, QStyleOption(), false);
+ return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption(), false), so, shr, w);
+}
+
+QPixmap QStyle::stylePixmap(StylePixmap sp, const QWidget *w, const QStyleOption &so) const
+{
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(w, QStyleOption());
+ return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption()), so, w);
+}
+
/*!
\fn int QStyle::defaultFrameWidth() const
\obsolete
diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h
index bb2efbc..c99fb78 100644
--- a/src/kernel/qstyle.h
+++ b/src/kernel/qstyle.h
@@ -63,26 +63,26 @@ class QStyleOption {
public:
enum StyleOptionDefault { Default };
- QStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL) {}
+ QStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL), cli(NULL) {}
// Note: we don't use default arguments since that is unnecessary
// initialization.
QStyleOption(int in1) :
- def(FALSE), tb(NULL), i1(in1) {}
+ def(FALSE), tb(NULL), i1(in1), cli(NULL) {}
QStyleOption(int in1, int in2) :
- def(FALSE), tb(NULL), i1(in1), i2(in2) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2), cli(NULL) {}
QStyleOption(int in1, int in2, int in3, int in4) :
- def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4) {}
- QStyleOption(QMenuItem* m) : def(FALSE), mi(m), tb(NULL) {}
- QStyleOption(QMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1) {}
- QStyleOption(QMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2) {}
- QStyleOption(const QColor& c) : def(FALSE), tb(NULL), cl(&c) {}
- QStyleOption(QTab* t) : def(FALSE), tb(t) {}
- QStyleOption(QListViewItem* i) : def(FALSE), tb(NULL), li(i) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4), cli(NULL) {}
+ QStyleOption(QMenuItem* m) : def(FALSE), mi(m), tb(NULL), cli(NULL) {}
+ QStyleOption(QMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1), cli(NULL) {}
+ QStyleOption(QMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2), cli(NULL) {}
+ QStyleOption(const QColor& c) : def(FALSE), tb(NULL), cl(&c), cli(NULL) {}
+ QStyleOption(QTab* t) : def(FALSE), tb(t), cli(NULL) {}
+ QStyleOption(QListViewItem* i) : def(FALSE), tb(NULL), li(i), cli(NULL) {}
QStyleOption(QCheckListItem* i) : def(FALSE), tb(NULL), cli(i) {}
- QStyleOption(Qt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a) {}
- QStyleOption(const QRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){}
- QStyleOption(QWidget *w) : def(FALSE), tb(NULL), p1((void*)w) {}
+ QStyleOption(Qt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a), cli(NULL) {}
+ QStyleOption(const QRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()), i4(r.height()), cli(NULL) {}
+ QStyleOption(QWidget *w) : def(FALSE), tb(NULL), cli(NULL), p1((void*)w) {}
bool isDefault() const { return def; }
@@ -134,6 +134,14 @@ class QStyleControlElementPopupMenuData {
//
};
+class QStyleControlElementCheckListItemData {
+ public:
+ bool dataValid;
+ bool enabled;
+ bool hasParent;
+ int height;
+};
+
class QStyleControlElementTabBarData {
public:
int tabCount;
@@ -176,6 +184,7 @@ class QStyleControlElementGenericWidgetData {
QStringList widgetObjectTypes;
bool allDataPopulated;
Qt::WFlags wflags;
+ Qt::WindowState windowState;
QPixmap bgPixmap;
QBrush bgBrush;
QColor bgColor;
@@ -196,6 +205,7 @@ class QStyleControlElementData {
QStringList widgetObjectTypes;
bool allDataPopulated;
Qt::WFlags wflags;
+ Qt::WindowState windowState;
QPixmap bgPixmap;
QBrush bgBrush;
QColor bgColor;
@@ -237,12 +247,13 @@ class QStyleControlElementData {
QStyleControlElementGenericWidgetData viewportData;
QStyleControlElementListViewData listViewData;
QStyleControlElementTabBarData tabBarData;
+ QStyleControlElementCheckListItemData checkListItemData;
Q_UINT32 comboBoxLineEditFlags;
Q_UINT32 frameStyle;
QRect sliderRect;
};
-class QStyleWidgetActionRequestData {
+class Q_EXPORT QStyleWidgetActionRequestData {
public:
QStyleWidgetActionRequestData();
QStyleWidgetActionRequestData(int metric1, int metric2=0);
@@ -326,7 +337,12 @@ public:
virtual void polish( QPalette & );
- virtual void polishPopupMenu( QPopupMenu* ) = 0;
+ // Old API
+ // DEPRECATED
+ virtual void polishPopupMenu( QPopupMenu* );
+
+ // New API
+ virtual void polishPopupMenu( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * ) = 0;
virtual QRect itemRect( QPainter *p, const QRect &r,
int flags, bool enabled,
@@ -445,7 +461,7 @@ public:
const QRect &r,
const QColorGroup &cg,
SFlags flags = Style_Default,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual void drawPrimitive( PrimitiveElement pe,
@@ -500,7 +516,7 @@ public:
const QRect &r,
const QColorGroup &cg,
SFlags how = Style_Default,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual void drawControl( ControlElement element,
@@ -519,7 +535,7 @@ public:
QPainter *p,
const QWidget *widget,
const QRect &r,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual void drawControlMask( ControlElement element,
@@ -572,7 +588,7 @@ public:
// Old API
// DEPRECATED
- virtual QRect subRect( SubRect r, const QWidget *widget ) const = 0;
+ virtual QRect subRect( SubRect r, const QWidget *widget ) const;
// New API
virtual QRect subRect( SubRect r, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const = 0;
@@ -653,7 +669,7 @@ public:
SCFlags sub = (uint)SC_All,
#endif
SCFlags subActive = SC_None,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
virtual void drawComplexControl( ComplexControl control,
QPainter *p,
@@ -677,7 +693,7 @@ public:
QPainter *p,
const QWidget *widget,
const QRect &r,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual void drawComplexControlMask( ComplexControl control,
@@ -693,7 +709,7 @@ public:
virtual QRect querySubControlMetrics( ComplexControl control,
const QWidget *widget,
SubControl sc,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual QRect querySubControlMetrics( ComplexControl control,
@@ -708,7 +724,7 @@ public:
virtual SubControl querySubControl( ComplexControl control,
const QWidget *widget,
const QPoint &pos,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
// New API
virtual SubControl querySubControl( ComplexControl control,
@@ -790,7 +806,7 @@ public:
// Old API
// DEPRECATED
virtual int pixelMetric( PixelMetric metric,
- const QWidget *widget = 0 ) const = 0;
+ const QWidget *widget = 0 ) const;
// New API
virtual int pixelMetric( PixelMetric metric,
@@ -828,7 +844,7 @@ public:
virtual QSize sizeFromContents( ContentsType contents,
const QWidget *widget,
const QSize &contentsSize,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
virtual QSize sizeFromContents( ContentsType contents,
QStyleControlElementData ceData,
@@ -992,7 +1008,7 @@ public:
const QWidget *widget = 0,
const QStyleOption& = QStyleOption::Default,
QStyleHintReturn* returnData = 0
- ) const = 0;
+ ) const;
// New API
virtual int styleHint( StyleHint stylehint,
@@ -1025,7 +1041,7 @@ public:
// DEPRECATED
virtual QPixmap stylePixmap( StylePixmap stylepixmap,
const QWidget *widget = 0,
- const QStyleOption& = QStyleOption::Default ) const = 0;
+ const QStyleOption& = QStyleOption::Default ) const;
virtual QPixmap stylePixmap( StylePixmap stylepixmap,
QStyleControlElementData ceData,
@@ -1061,6 +1077,8 @@ public:
WAR_RepaintRect,
WAR_EnableMouseTracking,
WAR_DisableMouseTracking,
+ WAR_SetCheckable,
+ WAR_UnSetCheckable,
WAR_FrameSetStyle,
WAR_FrameSetLineWidth,
WAR_SetLayoutMargin,