|
|
@ -27,7 +27,12 @@
|
|
|
|
#include <tqpopupmenu.h>
|
|
|
|
#include <tqpopupmenu.h>
|
|
|
|
#include <tqmenudata.h>
|
|
|
|
#include <tqmenudata.h>
|
|
|
|
#include <tqcombobox.h>
|
|
|
|
#include <tqcombobox.h>
|
|
|
|
|
|
|
|
#include <tqslider.h>
|
|
|
|
|
|
|
|
#include <tqscrollbar.h>
|
|
|
|
|
|
|
|
#include <tqspinbox.h>
|
|
|
|
#include <tqiconset.h>
|
|
|
|
#include <tqiconset.h>
|
|
|
|
|
|
|
|
#include <tqmenubar.h>
|
|
|
|
|
|
|
|
#include <qtitlebar_p.h>
|
|
|
|
#undef Qt
|
|
|
|
#undef Qt
|
|
|
|
|
|
|
|
|
|
|
|
#include <QtGui/QtGui>
|
|
|
|
#include <QtGui/QtGui>
|
|
|
@ -50,6 +55,50 @@
|
|
|
|
#define DEBUG_WARNINGS 1
|
|
|
|
#define DEBUG_WARNINGS 1
|
|
|
|
// #define DEBUG_SPEW 1
|
|
|
|
// #define DEBUG_SPEW 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline TQt::Orientation convertQt4ToTQt3Orientation(Qt::Orientation qt4orient)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQt::Orientation tqt3orient;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ( qt4orient ) {
|
|
|
|
|
|
|
|
case Qt::Horizontal:
|
|
|
|
|
|
|
|
tqt3orient = TQt::Horizontal;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Qt::Vertical:
|
|
|
|
|
|
|
|
tqt3orient = TQt::Vertical;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tqt3orient;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline TQSlider::TickSetting convertQt4ToTQt3TickSetting(QSlider::TickPosition qt4ts)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
TQSlider::TickSetting tqt3ts;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch ( qt4ts ) {
|
|
|
|
|
|
|
|
case QSlider::NoTicks:
|
|
|
|
|
|
|
|
tqt3ts = TQSlider::NoMarks;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QSlider::TicksBothSides:
|
|
|
|
|
|
|
|
tqt3ts = TQSlider::Both;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QSlider::TicksAbove:
|
|
|
|
|
|
|
|
tqt3ts = TQSlider::Above;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QSlider::TicksBelow:
|
|
|
|
|
|
|
|
tqt3ts = TQSlider::Below;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
// case QSlider::TicksLeft:
|
|
|
|
|
|
|
|
// tqt3ts = TQSlider::Left;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// case QSlider::TicksRight:
|
|
|
|
|
|
|
|
// tqt3ts = TQSlider::Right;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return tqt3ts;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline QColor convertTQt3ToQt4Color(TQColor tqt3color)
|
|
|
|
inline QColor convertTQt3ToQt4Color(TQColor tqt3color)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return QColor(tqt3color.red(), tqt3color.green(), tqt3color.blue());
|
|
|
|
return QColor(tqt3color.red(), tqt3color.green(), tqt3color.blue());
|
|
|
@ -422,7 +471,7 @@ inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3W
|
|
|
|
TQStyle::SFlags sflags = 0;
|
|
|
|
TQStyle::SFlags sflags = 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (qt4stateflags & QStyle::State_Active) {
|
|
|
|
if (qt4stateflags & QStyle::State_Active) {
|
|
|
|
if (wt != TQT3WT_TQPopupMenu) {
|
|
|
|
if ((wt != TQT3WT_TQPopupMenu) && (wt != TQT3WT_TQMenuBar)) {
|
|
|
|
sflags = sflags | TQStyle::Style_Active;
|
|
|
|
sflags = sflags | TQStyle::Style_Active;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -472,7 +521,7 @@ inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3W
|
|
|
|
// sflags = sflags | TQStyle::;
|
|
|
|
// sflags = sflags | TQStyle::;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (qt4stateflags & QStyle::State_Selected) {
|
|
|
|
if (qt4stateflags & QStyle::State_Selected) {
|
|
|
|
if (wt == TQT3WT_TQPopupMenu) {
|
|
|
|
if ((wt == TQT3WT_TQPopupMenu) || (wt == TQT3WT_TQMenuBar)) {
|
|
|
|
sflags = sflags | TQStyle::Style_Active;
|
|
|
|
sflags = sflags | TQStyle::Style_Active;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sflags = sflags | TQStyle::Style_Selected;
|
|
|
|
sflags = sflags | TQStyle::Style_Selected;
|
|
|
@ -487,6 +536,9 @@ inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3W
|
|
|
|
// sflags = sflags | TQStyle::;
|
|
|
|
// sflags = sflags | TQStyle::;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (qt4stateflags & QStyle::State_Sunken) {
|
|
|
|
if (qt4stateflags & QStyle::State_Sunken) {
|
|
|
|
|
|
|
|
if ((wt == TQT3WT_TQPopupMenu) || (wt == TQT3WT_TQMenuBar)) {
|
|
|
|
|
|
|
|
sflags = sflags | TQStyle::Style_Down;
|
|
|
|
|
|
|
|
}
|
|
|
|
sflags = sflags | TQStyle::Style_Sunken;
|
|
|
|
sflags = sflags | TQStyle::Style_Sunken;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (qt4stateflags & QStyle::State_UpArrow) {
|
|
|
|
if (qt4stateflags & QStyle::State_UpArrow) {
|
|
|
@ -502,6 +554,9 @@ inline TQStyle::SFlags convertQt4ToTQt3SFlags(QStyle::State qt4stateflags, TQt3W
|
|
|
|
return sflags;
|
|
|
|
return sflags;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define NO_QT3_EQUIVALENT can_override = false;
|
|
|
|
|
|
|
|
#define DO_NOT_DRAW can_override = false; do_not_draw = true;
|
|
|
|
|
|
|
|
|
|
|
|
SimpleStyle::SimpleStyle()
|
|
|
|
SimpleStyle::SimpleStyle()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#ifdef INTEGRATE_WITH_TDE
|
|
|
|
#ifdef INTEGRATE_WITH_TDE
|
|
|
@ -541,11 +596,18 @@ SimpleStyle::SimpleStyle()
|
|
|
|
// Create interface widgets
|
|
|
|
// Create interface widgets
|
|
|
|
m_tqt3parent_widget = new TQWidget();
|
|
|
|
m_tqt3parent_widget = new TQWidget();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_tqt3generic_widget = new TQWidget(m_tqt3parent_widget);
|
|
|
|
m_tqt3progressbar_widget = new TQProgressBar(m_tqt3parent_widget);
|
|
|
|
m_tqt3progressbar_widget = new TQProgressBar(m_tqt3parent_widget);
|
|
|
|
m_tqt3tabbar_widget = new TQTabBar(m_tqt3parent_widget);
|
|
|
|
m_tqt3tabbar_widget = new TQTabBar(m_tqt3parent_widget);
|
|
|
|
m_tqt3radiobutton_widget = new TQRadioButton(m_tqt3parent_widget);
|
|
|
|
m_tqt3radiobutton_widget = new TQRadioButton(m_tqt3parent_widget);
|
|
|
|
m_tqt3popupmenu_widget = new TQPopupMenu(m_tqt3parent_widget);
|
|
|
|
m_tqt3popupmenu_widget = new TQPopupMenu(m_tqt3parent_widget);
|
|
|
|
m_tqt3combobox_widget = new TQComboBox(m_tqt3parent_widget);
|
|
|
|
m_tqt3combobox_widget = new TQComboBox(m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3slider_widget = new TQSlider(m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget = new TQScrollBar(m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget = new TQSpinBox(m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3window_widget = new TQWidget(m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3titlebar_widget = new TQTitleBar(m_tqt3window_widget, m_tqt3parent_widget);
|
|
|
|
|
|
|
|
m_tqt3menubar_widget = new TQMenuBar(m_tqt3parent_widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SimpleStyle::~SimpleStyle()
|
|
|
|
SimpleStyle::~SimpleStyle()
|
|
|
@ -554,11 +616,18 @@ SimpleStyle::~SimpleStyle()
|
|
|
|
|
|
|
|
|
|
|
|
// Delete interface widgets
|
|
|
|
// Delete interface widgets
|
|
|
|
// Widgets are deleted when their parent is deleted...these lines will cause a crash on exit
|
|
|
|
// Widgets are deleted when their parent is deleted...these lines will cause a crash on exit
|
|
|
|
|
|
|
|
// delete m_tqt3generic_widget;
|
|
|
|
// delete m_tqt3progressbar_widget;
|
|
|
|
// delete m_tqt3progressbar_widget;
|
|
|
|
// delete m_tqt3tabbar_widget;
|
|
|
|
// delete m_tqt3tabbar_widget;
|
|
|
|
// delete m_tqt3radiobutton_widget;
|
|
|
|
// delete m_tqt3radiobutton_widget;
|
|
|
|
// delete m_tqt3popupmenu_widget;
|
|
|
|
// delete m_tqt3popupmenu_widget;
|
|
|
|
// delete m_tqt3combobox_widget;
|
|
|
|
// delete m_tqt3combobox_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3slider_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3scrollbar_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3spinbox_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3window_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3titlebar_widget;
|
|
|
|
|
|
|
|
// delete m_tqt3menubar_widget;
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
// FIXME
|
|
|
|
// Verify I'm not leaking memory like a sieve when this is commented out!!!
|
|
|
|
// Verify I'm not leaking memory like a sieve when this is commented out!!!
|
|
|
@ -599,7 +668,7 @@ bool SimpleStyle::eventFilter(QObject *obj, QEvent *ev)
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget* widget = static_cast<QWidget*>(obj);
|
|
|
|
QWidget* widget = dynamic_cast<QWidget*>(obj);
|
|
|
|
|
|
|
|
|
|
|
|
if ((ev->type() == QEvent::FocusIn) || (ev->type() == QEvent::FocusOut)
|
|
|
|
if ((ev->type() == QEvent::FocusIn) || (ev->type() == QEvent::FocusOut)
|
|
|
|
|| (ev->type() == QEvent::Enter) || (ev->type() == QEvent::Leave) || (ev->type() == QEvent::Wheel)) {
|
|
|
|
|| (ev->type() == QEvent::Enter) || (ev->type() == QEvent::Leave) || (ev->type() == QEvent::Wheel)) {
|
|
|
@ -681,14 +750,10 @@ int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_ComboBoxFrameWidth;
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_ComboBoxFrameWidth;
|
|
|
|
// retswitch = 1;
|
|
|
|
// retswitch = 1;
|
|
|
|
// break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_MDIFrameWidth:
|
|
|
|
case QStyle::PM_MdiSubWindowFrameWidth:
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MDIFrameWidth;
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MDIFrameWidth;
|
|
|
|
retswitch = 1;
|
|
|
|
retswitch = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
// case QStyle::PM_MdiSubWindowFrameWidth:
|
|
|
|
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_MdiSubWindowFrameWidth;
|
|
|
|
|
|
|
|
// retswitch = 1;
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
case QStyle::PM_MDIMinimizedWidth:
|
|
|
|
case QStyle::PM_MDIMinimizedWidth:
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MDIMinimizedWidth;
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MDIMinimizedWidth;
|
|
|
|
retswitch = 1;
|
|
|
|
retswitch = 1;
|
|
|
@ -697,30 +762,30 @@ int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_MdiSubWindowMinimizedWidth;
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_MdiSubWindowMinimizedWidth;
|
|
|
|
// retswitch = 1;
|
|
|
|
// retswitch = 1;
|
|
|
|
// break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutLeftMargin:
|
|
|
|
// case QStyle::PM_LayoutLeftMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutTopMargin:
|
|
|
|
// case QStyle::PM_LayoutTopMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutRightMargin:
|
|
|
|
// case QStyle::PM_LayoutRightMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutBottomMargin:
|
|
|
|
// case QStyle::PM_LayoutBottomMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutHorizontalSpacing:
|
|
|
|
// case QStyle::PM_LayoutHorizontalSpacing:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_LayoutVerticalSpacing:
|
|
|
|
// case QStyle::PM_LayoutVerticalSpacing:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_MaximumDragDistance:
|
|
|
|
case QStyle::PM_MaximumDragDistance:
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MaximumDragDistance;
|
|
|
|
tqt3pixelmetric = TQStyle::PM_MaximumDragDistance;
|
|
|
|
retswitch = 1;
|
|
|
|
retswitch = 1;
|
|
|
@ -859,6 +924,10 @@ int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PM_TitleBarHeight:
|
|
|
|
case QStyle::PM_TitleBarHeight:
|
|
|
|
tqt3pixelmetric = TQStyle::PM_TitleBarHeight;
|
|
|
|
tqt3pixelmetric = TQStyle::PM_TitleBarHeight;
|
|
|
|
|
|
|
|
if (opt) {
|
|
|
|
|
|
|
|
m_tqt3generic_widget->setGeometry(0, 0, opt->rect.width(), opt->rect.height());
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3generic_widget;
|
|
|
|
|
|
|
|
}
|
|
|
|
retswitch = 1;
|
|
|
|
retswitch = 1;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PM_IndicatorWidth:
|
|
|
|
case QStyle::PM_IndicatorWidth:
|
|
|
@ -881,14 +950,14 @@ int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const
|
|
|
|
// retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
// retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
// break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_MenuHMargin:
|
|
|
|
// case QStyle::PM_MenuHMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
case QStyle::PM_MenuVMargin:
|
|
|
|
// case QStyle::PM_MenuVMargin:
|
|
|
|
retval = 0;
|
|
|
|
// retval = 0;
|
|
|
|
retswitch = 2;
|
|
|
|
// retswitch = 2;
|
|
|
|
break;
|
|
|
|
// break;
|
|
|
|
// case QStyle::PM_MenuScrollerHeight:
|
|
|
|
// case QStyle::PM_MenuScrollerHeight:
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_MenuScrollerHeight;
|
|
|
|
// tqt3pixelmetric = TQStyle::PM_MenuScrollerHeight;
|
|
|
|
// retswitch = 1;
|
|
|
|
// retswitch = 1;
|
|
|
@ -1006,21 +1075,28 @@ int SimpleStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const
|
|
|
|
|
|
|
|
|
|
|
|
if (retswitch == 1) {
|
|
|
|
if (retswitch == 1) {
|
|
|
|
retval = tqApp->style().pixelMetric(tqt3pixelmetric, interfaceWidget);
|
|
|
|
retval = tqApp->style().pixelMetric(tqt3pixelmetric, interfaceWidget);
|
|
|
|
|
|
|
|
// HACK
|
|
|
|
|
|
|
|
// For some reason Qt4 tacks on a pixel to this by default
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
// Figure out why!
|
|
|
|
|
|
|
|
if (tqt3pixelmetric == TQStyle::PM_TabBarTabVSpace) {
|
|
|
|
|
|
|
|
retval = retval - 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// if (retswitch == 2) {
|
|
|
|
if (retswitch == 2) {
|
|
|
|
// // retval was already set
|
|
|
|
// retval was already set
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
// else {
|
|
|
|
else {
|
|
|
|
// Tell Qt4 to get the information
|
|
|
|
// Tell Qt4 to get the information
|
|
|
|
retval = QCommonStyle::pixelMetric(metric, opt, w);
|
|
|
|
retval = QCommonStyle::pixelMetric(metric, opt, w);
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidget* w) const
|
|
|
|
TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidget* w, const QStyleOption* qt4styleoptions) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
TQWidget* interfaceWidget = 0;
|
|
|
|
TQWidget* interfaceWidget = 0;
|
|
|
@ -1031,14 +1107,23 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
|
|
|
|
const QMenu* qt4menu_widget = 0;
|
|
|
|
const QMenu* qt4menu_widget = 0;
|
|
|
|
const QProgressBar* qt4progressbar_widget = 0;
|
|
|
|
const QProgressBar* qt4progressbar_widget = 0;
|
|
|
|
const QComboBox* qt4combobox_widget = 0;
|
|
|
|
const QComboBox* qt4combobox_widget = 0;
|
|
|
|
|
|
|
|
const QSlider* qt4slider_widget = 0;
|
|
|
|
|
|
|
|
const QScrollBar* qt4scrollbar_widget = 0;
|
|
|
|
|
|
|
|
const QSpinBox* qt4spinbox_widget = 0;
|
|
|
|
|
|
|
|
const QMenuBar* qt4menubar_widget = 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QStyleOptionTitleBar* qt4titlebar_options = 0;
|
|
|
|
|
|
|
|
|
|
|
|
TQTabBar::Shape tqt3tbshape = TQTabBar::RoundedAbove;
|
|
|
|
TQTabBar::Shape tqt3tbshape = TQTabBar::RoundedAbove;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QList<QAction*> qt4menuactions;
|
|
|
|
|
|
|
|
QAction* currentAction;
|
|
|
|
|
|
|
|
|
|
|
|
switch (wt) {
|
|
|
|
switch (wt) {
|
|
|
|
case TQT3WT_TQProgressBar:
|
|
|
|
case TQT3WT_TQProgressBar:
|
|
|
|
interfaceWidget = m_tqt3progressbar_widget;
|
|
|
|
interfaceWidget = m_tqt3progressbar_widget;
|
|
|
|
// Copy over all widget attributes
|
|
|
|
// Copy over all widget attributes
|
|
|
|
qt4progressbar_widget = static_cast<const QProgressBar*>(w);
|
|
|
|
qt4progressbar_widget = dynamic_cast<const QProgressBar*>(w);
|
|
|
|
m_tqt3progressbar_widget->setGeometry(0, 0, qt4progressbar_widget->width(), qt4progressbar_widget->height());
|
|
|
|
m_tqt3progressbar_widget->setGeometry(0, 0, qt4progressbar_widget->width(), qt4progressbar_widget->height());
|
|
|
|
m_tqt3progressbar_widget->setProgress(qt4progressbar_widget->value()-qt4progressbar_widget->minimum(),qt4progressbar_widget->maximum()-qt4progressbar_widget->minimum());
|
|
|
|
m_tqt3progressbar_widget->setProgress(qt4progressbar_widget->value()-qt4progressbar_widget->minimum(),qt4progressbar_widget->maximum()-qt4progressbar_widget->minimum());
|
|
|
|
if (qt4progressbar_widget->orientation() != Qt::Horizontal) {
|
|
|
|
if (qt4progressbar_widget->orientation() != Qt::Horizontal) {
|
|
|
@ -1052,52 +1137,60 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
|
|
|
|
case TQT3WT_TQTabBar:
|
|
|
|
case TQT3WT_TQTabBar:
|
|
|
|
interfaceWidget = m_tqt3tabbar_widget;
|
|
|
|
interfaceWidget = m_tqt3tabbar_widget;
|
|
|
|
// Copy over all widget attributes
|
|
|
|
// Copy over all widget attributes
|
|
|
|
qt4tabbar_widget = static_cast<const QTabBar*>(w);
|
|
|
|
qt4tabbar_widget = dynamic_cast<const QTabBar*>(w);
|
|
|
|
m_tqt3tabbar_widget->setGeometry(0, 0, qt4tabbar_widget->width(), qt4tabbar_widget->height());
|
|
|
|
if (qt4tabbar_widget) {
|
|
|
|
// Clear out tabbar
|
|
|
|
m_tqt3tabbar_widget->setGeometry(0, 0, qt4tabbar_widget->width(), qt4tabbar_widget->height());
|
|
|
|
for (i=0;i<m_tqt3tabbar_widget->count();i++) {
|
|
|
|
// Clear out tabbar
|
|
|
|
m_tqt3tabbar_widget->removeTab(m_tqt3tabbar_widget->tabAt(i));
|
|
|
|
for (i=0;i<m_tqt3tabbar_widget->count();i++) {
|
|
|
|
}
|
|
|
|
m_tqt3tabbar_widget->removeTab(m_tqt3tabbar_widget->tabAt(i));
|
|
|
|
// Copy over all tabs
|
|
|
|
|
|
|
|
for (i=0;i<qt4tabbar_widget->count();i++) {
|
|
|
|
|
|
|
|
if (qt4tabbar_widget->tabIcon(i).isNull()) {
|
|
|
|
|
|
|
|
TQTab* newTab = new TQTab(convertQt4ToTQt3String(qt4tabbar_widget->tabText(i)));
|
|
|
|
|
|
|
|
m_tqt3tabbar_widget->insertTab(newTab, i);
|
|
|
|
|
|
|
|
newTab->setIdentifier(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
// Copy over all tabs
|
|
|
|
TQTab* newTab = new TQTab(convertQt4ToTQt3IconSet(qt4tabbar_widget->tabIcon(i)), convertQt4ToTQt3String(qt4tabbar_widget->tabText(i)));
|
|
|
|
for (i=0;i<qt4tabbar_widget->count();i++) {
|
|
|
|
m_tqt3tabbar_widget->insertTab(newTab, i);
|
|
|
|
if (qt4tabbar_widget->tabIcon(i).isNull()) {
|
|
|
|
newTab->setIdentifier(i);
|
|
|
|
TQTab* newTab = new TQTab(convertQt4ToTQt3String(qt4tabbar_widget->tabText(i)));
|
|
|
|
|
|
|
|
m_tqt3tabbar_widget->insertTab(newTab, i);
|
|
|
|
|
|
|
|
newTab->setIdentifier(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
TQTab* newTab = new TQTab(convertQt4ToTQt3IconSet(qt4tabbar_widget->tabIcon(i)), convertQt4ToTQt3String(qt4tabbar_widget->tabText(i)));
|
|
|
|
|
|
|
|
m_tqt3tabbar_widget->insertTab(newTab, i);
|
|
|
|
|
|
|
|
newTab->setIdentifier(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_tqt3tabbar_widget->setCurrentTab(qt4tabbar_widget->currentIndex());
|
|
|
|
|
|
|
|
switch (qt4tabbar_widget->shape()) {
|
|
|
|
|
|
|
|
case QTabBar::RoundedNorth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::RoundedAbove;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::RoundedSouth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::RoundedBelow;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::TriangularNorth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::TriangularAbove;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::TriangularSouth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::TriangularBelow;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Qt3 cannot draw other tab shapes
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
|
|
|
|
printf("No rules to draw Qt4 tab shape %d\n\r", qt4tabbar_widget->shape()); fflush(stdout);
|
|
|
|
|
|
|
|
interfaceWidget = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_tqt3tabbar_widget->setShape(tqt3tbshape);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_tqt3tabbar_widget->setCurrentTab(qt4tabbar_widget->currentIndex());
|
|
|
|
else {
|
|
|
|
switch (qt4tabbar_widget->shape()) {
|
|
|
|
|
|
|
|
case QTabBar::RoundedNorth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::RoundedAbove;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::RoundedSouth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::RoundedBelow;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::TriangularNorth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::TriangularAbove;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QTabBar::TriangularSouth:
|
|
|
|
|
|
|
|
tqt3tbshape = TQTabBar::TriangularBelow;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
// Qt3 cannot draw other tab shapes
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
printf("No rules to draw Qt4 tab shape %d\n\r", qt4tabbar_widget->shape()); fflush(stdout);
|
|
|
|
printf("Unable to draw Qt4 tabbar with no Qt4 object available\n\r"); fflush(stdout);
|
|
|
|
interfaceWidget = 0;
|
|
|
|
interfaceWidget = 0;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
m_tqt3tabbar_widget->setShape(tqt3tbshape);
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case TQT3WT_TQRadioButton:
|
|
|
|
case TQT3WT_TQRadioButton:
|
|
|
|
interfaceWidget = m_tqt3radiobutton_widget;
|
|
|
|
interfaceWidget = m_tqt3radiobutton_widget;
|
|
|
|
// Copy over all widget attributes
|
|
|
|
// Copy over all widget attributes
|
|
|
|
qt4radiobutton_widget = static_cast<const QRadioButton*>(w);
|
|
|
|
qt4radiobutton_widget = dynamic_cast<const QRadioButton*>(w);
|
|
|
|
m_tqt3radiobutton_widget->setGeometry(0, 0, qt4radiobutton_widget->width(), qt4radiobutton_widget->height());
|
|
|
|
m_tqt3radiobutton_widget->setGeometry(0, 0, qt4radiobutton_widget->width(), qt4radiobutton_widget->height());
|
|
|
|
m_tqt3radiobutton_widget->setText(convertQt4ToTQt3String(qt4radiobutton_widget->text()));
|
|
|
|
m_tqt3radiobutton_widget->setText(convertQt4ToTQt3String(qt4radiobutton_widget->text()));
|
|
|
|
m_tqt3radiobutton_widget->setDown(qt4radiobutton_widget->isDown());
|
|
|
|
m_tqt3radiobutton_widget->setDown(qt4radiobutton_widget->isDown());
|
|
|
@ -1105,7 +1198,7 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
|
|
|
|
case TQT3WT_TQComboBox:
|
|
|
|
case TQT3WT_TQComboBox:
|
|
|
|
interfaceWidget = m_tqt3combobox_widget;
|
|
|
|
interfaceWidget = m_tqt3combobox_widget;
|
|
|
|
// Copy over all widget attributes
|
|
|
|
// Copy over all widget attributes
|
|
|
|
qt4combobox_widget = static_cast<const QComboBox*>(w);
|
|
|
|
qt4combobox_widget = dynamic_cast<const QComboBox*>(w);
|
|
|
|
m_tqt3combobox_widget->setGeometry(0, 0, qt4combobox_widget->width(), qt4combobox_widget->height());
|
|
|
|
m_tqt3combobox_widget->setGeometry(0, 0, qt4combobox_widget->width(), qt4combobox_widget->height());
|
|
|
|
// Clear out all combobox items
|
|
|
|
// Clear out all combobox items
|
|
|
|
m_tqt3combobox_widget->clear();
|
|
|
|
m_tqt3combobox_widget->clear();
|
|
|
@ -1123,14 +1216,14 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
|
|
|
|
case TQT3WT_TQPopupMenu:
|
|
|
|
case TQT3WT_TQPopupMenu:
|
|
|
|
interfaceWidget = m_tqt3popupmenu_widget;
|
|
|
|
interfaceWidget = m_tqt3popupmenu_widget;
|
|
|
|
// Copy over all widget attributes
|
|
|
|
// Copy over all widget attributes
|
|
|
|
qt4menu_widget = static_cast<const QMenu*>(w);
|
|
|
|
qt4menu_widget = dynamic_cast<const QMenu*>(w);
|
|
|
|
m_tqt3popupmenu_widget->setGeometry(0, 0, qt4menu_widget->width(), qt4menu_widget->height());
|
|
|
|
m_tqt3popupmenu_widget->setGeometry(0, 0, qt4menu_widget->width(), qt4menu_widget->height());
|
|
|
|
// Clear out menu
|
|
|
|
// Clear out menu
|
|
|
|
m_tqt3popupmenu_widget->clear();
|
|
|
|
m_tqt3popupmenu_widget->clear();
|
|
|
|
m_tqt3popupmenu_widget->setCheckable(false);
|
|
|
|
m_tqt3popupmenu_widget->setCheckable(false);
|
|
|
|
// Copy over all menu items
|
|
|
|
// Copy over all menu items
|
|
|
|
QList<QAction*> qt4menuactions = qt4menu_widget->actions();
|
|
|
|
qt4menuactions = qt4menu_widget->actions();
|
|
|
|
QAction* currentAction = 0;
|
|
|
|
currentAction = 0;
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
currentAction = qt4menuactions.at(i);
|
|
|
|
currentAction = qt4menuactions.at(i);
|
|
|
|
if (currentAction) {
|
|
|
|
if (currentAction) {
|
|
|
@ -1156,6 +1249,109 @@ TQWidget* SimpleStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TQT3WT_TQMenuBar:
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3menubar_widget;
|
|
|
|
|
|
|
|
// Copy over all widget attributes
|
|
|
|
|
|
|
|
qt4menubar_widget = dynamic_cast<const QMenuBar*>(w);
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->setGeometry(0, 0, qt4menubar_widget->width(), qt4menubar_widget->height());
|
|
|
|
|
|
|
|
// Clear out menu
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->clear();
|
|
|
|
|
|
|
|
// Copy over all menu items
|
|
|
|
|
|
|
|
qt4menuactions = qt4menubar_widget->actions();
|
|
|
|
|
|
|
|
currentAction = 0;
|
|
|
|
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
|
|
|
|
currentAction = qt4menuactions.at(i);
|
|
|
|
|
|
|
|
if (currentAction) {
|
|
|
|
|
|
|
|
if (currentAction->isSeparator()) {
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->insertSeparator(i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
if (currentAction->icon().isNull()) {
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3String(currentAction->text()), i, i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->insertItem(convertQt4ToTQt3IconSet(currentAction->icon()), convertQt4ToTQt3String(currentAction->text()), i, i);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
// Handle pixmaps, etc.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->setItemEnabled(i, currentAction->isEnabled());
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->setItemChecked(i, currentAction->isChecked());
|
|
|
|
|
|
|
|
m_tqt3menubar_widget->setItemVisible(i, currentAction->isVisible());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TQT3WT_TQSlider:
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3slider_widget;
|
|
|
|
|
|
|
|
// Copy over all widget attributes
|
|
|
|
|
|
|
|
qt4slider_widget = dynamic_cast<const QSlider*>(w);
|
|
|
|
|
|
|
|
if (qt4slider_widget) {
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setGeometry(0, 0, qt4slider_widget->width(), qt4slider_widget->height());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setOrientation(convertQt4ToTQt3Orientation(qt4slider_widget->orientation()));
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setTracking(qt4slider_widget->hasTracking());
|
|
|
|
|
|
|
|
// m_tqt3slider_widget->setPalette(); // FIXME
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setTickmarks(convertQt4ToTQt3TickSetting(qt4slider_widget->tickPosition()));
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setTickInterval(qt4slider_widget->tickInterval());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setMinValue(qt4slider_widget->minimum());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setMaxValue(qt4slider_widget->maximum());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setLineStep(qt4slider_widget->singleStep());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setPageStep(qt4slider_widget->pageStep());
|
|
|
|
|
|
|
|
m_tqt3slider_widget->setValue(qt4slider_widget->value());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
|
|
|
|
printf("Unable to draw Qt4 slider with no Qt4 object available\n\r"); fflush(stdout);
|
|
|
|
|
|
|
|
interfaceWidget = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TQT3WT_TQScrollBar:
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3scrollbar_widget;
|
|
|
|
|
|
|
|
// Copy over all widget attributes
|
|
|
|
|
|
|
|
qt4scrollbar_widget = dynamic_cast<const QScrollBar*>(w);
|
|
|
|
|
|
|
|
if (qt4scrollbar_widget) {
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setGeometry(0, 0, qt4scrollbar_widget->width(), qt4scrollbar_widget->height());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setOrientation(convertQt4ToTQt3Orientation(qt4scrollbar_widget->orientation()));
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setTracking(qt4scrollbar_widget->hasTracking());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setMinValue(qt4scrollbar_widget->minimum());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setMaxValue(qt4scrollbar_widget->maximum());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setLineStep(qt4scrollbar_widget->singleStep());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setPageStep(qt4scrollbar_widget->pageStep());
|
|
|
|
|
|
|
|
m_tqt3scrollbar_widget->setValue(qt4scrollbar_widget->value());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
|
|
|
|
printf("Unable to draw Qt4 scrollbar with no Qt4 object available\n\r"); fflush(stdout);
|
|
|
|
|
|
|
|
interfaceWidget = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TQT3WT_TQSpinBox:
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3spinbox_widget;
|
|
|
|
|
|
|
|
// Copy over all widget attributes
|
|
|
|
|
|
|
|
qt4spinbox_widget = dynamic_cast<const QSpinBox*>(w);
|
|
|
|
|
|
|
|
if (qt4spinbox_widget) {
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget->setGeometry(0, 0, qt4spinbox_widget->width(), qt4spinbox_widget->height());
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget->setMinValue(qt4spinbox_widget->minimum());
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget->setMaxValue(qt4spinbox_widget->maximum());
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget->setLineStep(qt4spinbox_widget->singleStep());
|
|
|
|
|
|
|
|
m_tqt3spinbox_widget->setValue(qt4spinbox_widget->value());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
|
|
|
|
printf("Unable to draw Qt4 spinbox with no Qt4 object available\n\r"); fflush(stdout);
|
|
|
|
|
|
|
|
interfaceWidget = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TQT3WT_TQTitleBar:
|
|
|
|
|
|
|
|
interfaceWidget = m_tqt3titlebar_widget;
|
|
|
|
|
|
|
|
qt4titlebar_options = static_cast<const QStyleOptionTitleBar*>(qt4styleoptions);
|
|
|
|
|
|
|
|
// Construct an internal TQTitleBar widget from the options and widget provided by Qt4
|
|
|
|
|
|
|
|
m_tqt3titlebar_widget->setGeometry(qt4styleoptions->rect.x(), qt4styleoptions->rect.y(), qt4styleoptions->rect.width(), qt4styleoptions->rect.height());
|
|
|
|
|
|
|
|
m_tqt3titlebar_widget->setCaption(convertQt4ToTQt3String(qt4titlebar_options->text));
|
|
|
|
|
|
|
|
m_tqt3titlebar_widget->setIcon(convertQt4ToTQt3Pixmap(qt4titlebar_options->icon));
|
|
|
|
|
|
|
|
m_tqt3titlebar_widget->setActive(qt4titlebar_options->titleBarState & Qt::WindowActive);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return interfaceWidget;
|
|
|
|
return interfaceWidget;
|
|
|
@ -1216,6 +1412,8 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|
|
|
TQWidget* interfaceWidget = 0;
|
|
|
|
TQWidget* interfaceWidget = 0;
|
|
|
|
TQStyleOption tqt3opt(TQStyleOption::Default);
|
|
|
|
TQStyleOption tqt3opt(TQStyleOption::Default);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect tqt3rect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height());
|
|
|
|
|
|
|
|
|
|
|
|
// Determine the correct color group
|
|
|
|
// Determine the correct color group
|
|
|
|
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_NONE);
|
|
|
|
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_NONE);
|
|
|
|
TQPalette tqt3palette = convertQt4ToTQt3Palette(opt->palette);
|
|
|
|
TQPalette tqt3palette = convertQt4ToTQt3Palette(opt->palette);
|
|
|
@ -1232,6 +1430,15 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|
|
|
tqt3colorgroup = tqt3palette.disabled();
|
|
|
|
tqt3colorgroup = tqt3palette.disabled();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QStyleOptionTitleBar* tbopt;
|
|
|
|
|
|
|
|
bool drawCloseButton;
|
|
|
|
|
|
|
|
bool drawMaxButton;
|
|
|
|
|
|
|
|
bool drawMinButton;
|
|
|
|
|
|
|
|
bool drawNormalButton;
|
|
|
|
|
|
|
|
bool drawShadeButton;
|
|
|
|
|
|
|
|
bool drawUnshadeButton;
|
|
|
|
|
|
|
|
bool drawSysMenuButton;
|
|
|
|
|
|
|
|
|
|
|
|
switch (control) {
|
|
|
|
switch (control) {
|
|
|
|
case CC_ComboBox:
|
|
|
|
case CC_ComboBox:
|
|
|
|
tqtCC = TQStyle::CC_ComboBox;
|
|
|
|
tqtCC = TQStyle::CC_ComboBox;
|
|
|
@ -1240,6 +1447,120 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|
|
|
can_override = false;
|
|
|
|
can_override = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CC_Slider:
|
|
|
|
|
|
|
|
tqtCC = TQStyle::CC_Slider;
|
|
|
|
|
|
|
|
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQSlider, w);
|
|
|
|
|
|
|
|
if (interfaceWidget == 0) {
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CC_ScrollBar:
|
|
|
|
|
|
|
|
tqtCC = TQStyle::CC_ScrollBar;
|
|
|
|
|
|
|
|
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQScrollBar, w);
|
|
|
|
|
|
|
|
if (interfaceWidget == 0) {
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
// case CC_SpinBox:
|
|
|
|
|
|
|
|
// // FIXME FIXME FIXME
|
|
|
|
|
|
|
|
// // This is more complex to interface with
|
|
|
|
|
|
|
|
// // Under TQt3 there is an internal SpinWidget, and the SpinBox draws the editor through another call
|
|
|
|
|
|
|
|
// // Under Qt4 there is only the SpinBox, and we would need to draw both the SpinWidget and the editor
|
|
|
|
|
|
|
|
// tqtCC = TQStyle::CC_SpinWidget;
|
|
|
|
|
|
|
|
// interfaceWidget = initializeInterfaceWidget(TQT3WT_TQSpinBox, w);
|
|
|
|
|
|
|
|
// if (interfaceWidget == 0) {
|
|
|
|
|
|
|
|
// can_override = false;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
// break;
|
|
|
|
|
|
|
|
case CC_TitleBar:
|
|
|
|
|
|
|
|
tqtCC = TQStyle::CC_TitleBar;
|
|
|
|
|
|
|
|
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQTitleBar, w, opt);
|
|
|
|
|
|
|
|
if (interfaceWidget == 0) {
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// Select subcontrol(s) to be drawn
|
|
|
|
|
|
|
|
// Qt4 made this hard again (surprise surprise)
|
|
|
|
|
|
|
|
tbopt = static_cast<const QStyleOptionTitleBar*>(opt);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This logic is taken from Qt4 (qcommonstyle.cpp)
|
|
|
|
|
|
|
|
// It will need to be kept in sync with whatever Nokia does
|
|
|
|
|
|
|
|
drawCloseButton = (tbopt->subControls & SC_TitleBarCloseButton && tbopt->titleBarFlags & Qt::WindowSystemMenuHint);
|
|
|
|
|
|
|
|
drawMaxButton = (tbopt->subControls & SC_TitleBarMaxButton && tbopt->titleBarFlags & Qt::WindowMaximizeButtonHint && !(tbopt->titleBarState & Qt::WindowMaximized));
|
|
|
|
|
|
|
|
drawMinButton = (tbopt->subControls & SC_TitleBarMinButton && tbopt->titleBarFlags & Qt::WindowMinimizeButtonHint && !(tbopt->titleBarState & Qt::WindowMinimized));
|
|
|
|
|
|
|
|
drawNormalButton = (tbopt->subControls & SC_TitleBarNormalButton) && (((tbopt->titleBarFlags & Qt::WindowMinimizeButtonHint) && (tbopt->titleBarState & Qt::WindowMinimized)) || ((tbopt->titleBarFlags & Qt::WindowMaximizeButtonHint) && (tbopt->titleBarState & Qt::WindowMaximized)));
|
|
|
|
|
|
|
|
drawShadeButton = (tbopt->subControls & SC_TitleBarShadeButton && tbopt->titleBarFlags & Qt::WindowShadeButtonHint && !(tbopt->titleBarState & Qt::WindowMinimized));
|
|
|
|
|
|
|
|
drawUnshadeButton = (tbopt->subControls & SC_TitleBarUnshadeButton && tbopt->titleBarFlags & Qt::WindowShadeButtonHint && tbopt->titleBarState & Qt::WindowMinimized);
|
|
|
|
|
|
|
|
drawSysMenuButton = (tbopt->subControls & SC_TitleBarSysMenu && tbopt->titleBarFlags & Qt::WindowSystemMenuHint);
|
|
|
|
|
|
|
|
// End logic taken from Qt4
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
// TQt3 has no idea how to draw the restore button on a maximized window!!!
|
|
|
|
|
|
|
|
// This needs to be fixed in qcommonstyle.cpp drawComplexControl, case CC_TitleBar
|
|
|
|
|
|
|
|
// Once this is fixed in TQt3, the logic below needs to be updated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subControl = 0;
|
|
|
|
|
|
|
|
if (drawSysMenuButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarSysMenu;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawMinButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarMinButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawMaxButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarMaxButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawCloseButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarCloseButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->subControls & SC_TitleBarLabel) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarLabel;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawNormalButton && !(tbopt->titleBarState & Qt::WindowMaximized)) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarNormalButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawShadeButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarShadeButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawUnshadeButton) {
|
|
|
|
|
|
|
|
subControl = subControl | TQStyle::SC_TitleBarUnshadeButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (tbopt->subControls & SC_TitleBarContextHelpButton) {
|
|
|
|
|
|
|
|
// subControl = subControl | TQStyle::SC_TitleBarContextHelpButton;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
subControlActive = 0;
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarSysMenu) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarSysMenu;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarMinButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarMinButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarMaxButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarMaxButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarCloseButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarCloseButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarLabel) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarLabel;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarNormalButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarNormalButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarShadeButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarShadeButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (tbopt->activeSubControls & SC_TitleBarUnshadeButton) {
|
|
|
|
|
|
|
|
subControlActive = subControlActive | TQStyle::SC_TitleBarUnshadeButton;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// if (tbopt->activeSubControls & SC_TitleBarContextHelpButton) {
|
|
|
|
|
|
|
|
// subControlActive = subControlActive | TQStyle::SC_TitleBarContextHelpButton;
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case CC_GroupBox:
|
|
|
|
|
|
|
|
NO_QT3_EQUIVALENT
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
printf("No rules to draw Qt4 complex control %d\n\r", control); fflush(stdout);
|
|
|
|
printf("No rules to draw Qt4 complex control %d\n\r", control); fflush(stdout);
|
|
|
@ -1253,8 +1574,20 @@ void SimpleStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tqtCC == TQStyle::CC_TitleBar) {
|
|
|
|
|
|
|
|
// TQt3 is expecting to see a rect() from the titlebar that excludes the window frame,
|
|
|
|
|
|
|
|
// while Qt4 provides the entire rectangle (including the frame) via the widget/QStyleOptionTitleBar
|
|
|
|
|
|
|
|
// This is due to the fact that under TQt3 the titlebar is a correctly position widget,
|
|
|
|
|
|
|
|
// whereas under Qt4 the titlebar is part of the base widget itself.
|
|
|
|
|
|
|
|
// Compensate...
|
|
|
|
|
|
|
|
if (interfaceWidget) {
|
|
|
|
|
|
|
|
TQRect tbg = interfaceWidget->geometry();
|
|
|
|
|
|
|
|
tqtPainter.translate(tbg.x(), tbg.y());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Instruct TQt3 to draw the complex control
|
|
|
|
// Instruct TQt3 to draw the complex control
|
|
|
|
tqApp->style().drawComplexControl(tqtCC, &tqtPainter, interfaceWidget, TQRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height()), tqt3colorgroup, sflags, subControl, subControlActive, tqt3opt);
|
|
|
|
tqApp->style().drawComplexControl(tqtCC, &tqtPainter, interfaceWidget, tqt3rect, tqt3colorgroup, sflags, subControl, subControlActive, tqt3opt);
|
|
|
|
|
|
|
|
|
|
|
|
tqtPainter.end();
|
|
|
|
tqtPainter.end();
|
|
|
|
|
|
|
|
|
|
|
@ -1356,7 +1689,7 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
// Qt4 makes this really, really hard...
|
|
|
|
// Qt4 makes this really, really hard...
|
|
|
|
// I have to guess based on the Qt4 position of the tab in the tab bar, which may or may not work 100% in all cases
|
|
|
|
// I have to guess based on the Qt4 position of the tab in the tab bar, which may or may not work 100% in all cases
|
|
|
|
drawingTab = 0;
|
|
|
|
drawingTab = 0;
|
|
|
|
estimated_tab_index = static_cast<const QTabBar*>(w)->tabAt(QPoint(opt->rect.x(), opt->rect.y()));
|
|
|
|
estimated_tab_index = dynamic_cast<const QTabBar*>(w)->tabAt(QPoint(opt->rect.x(), opt->rect.y()));
|
|
|
|
drawingTab = m_tqt3tabbar_widget->tabAt(estimated_tab_index);
|
|
|
|
drawingTab = m_tqt3tabbar_widget->tabAt(estimated_tab_index);
|
|
|
|
|
|
|
|
|
|
|
|
if (drawingTab) {
|
|
|
|
if (drawingTab) {
|
|
|
@ -1375,6 +1708,13 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
if (tqt3tabwidth > 0) {
|
|
|
|
if (tqt3tabwidth > 0) {
|
|
|
|
tqt3elementrect = TQRect(tqt3elementrect.x()-tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()+(tqt3tabwidth*1), tqt3elementrect.height());
|
|
|
|
tqt3elementrect = TQRect(tqt3elementrect.x()-tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()+(tqt3tabwidth*1), tqt3elementrect.height());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (drawingTab) {
|
|
|
|
|
|
|
|
if (drawingTab->identifier() == 0) {
|
|
|
|
|
|
|
|
// This is the first tab in the tab bar
|
|
|
|
|
|
|
|
// We will end up clipping on the left edge if the rectangle is not adjusted
|
|
|
|
|
|
|
|
tqt3elementrect = TQRect(tqt3elementrect.x()+tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()-(tqt3tabwidth*1), tqt3elementrect.height());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
#if 0
|
|
|
|
#if 0
|
|
|
@ -1403,8 +1743,8 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
// Qt4 makes this really, really hard...
|
|
|
|
// Qt4 makes this really, really hard...
|
|
|
|
// I have to guess based on the Qt4 position of the item in the menu, which may or may not work 100% in all cases
|
|
|
|
// I have to guess based on the Qt4 position of the item in the menu, which may or may not work 100% in all cases
|
|
|
|
drawingItem = 0;
|
|
|
|
drawingItem = 0;
|
|
|
|
drawingAction = static_cast<const QMenu*>(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y()));
|
|
|
|
drawingAction = dynamic_cast<const QMenu*>(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y()));
|
|
|
|
qt4menuactions = static_cast<const QMenu*>(w)->actions();
|
|
|
|
qt4menuactions = dynamic_cast<const QMenu*>(w)->actions();
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
if (qt4menuactions.at(i) == drawingAction) {
|
|
|
|
if (qt4menuactions.at(i) == drawingAction) {
|
|
|
|
drawingItem = m_tqt3popupmenu_widget->findItem(m_tqt3popupmenu_widget->idAt(i));
|
|
|
|
drawingItem = m_tqt3popupmenu_widget->findItem(m_tqt3popupmenu_widget->idAt(i));
|
|
|
@ -1418,10 +1758,74 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_MenuBarItem:
|
|
|
|
|
|
|
|
tqtCE = TQStyle::CE_MenuBarItem;
|
|
|
|
|
|
|
|
sflags = convertQt4ToTQt3SFlags(opt->state, TQT3WT_TQMenuBar);
|
|
|
|
|
|
|
|
interfaceWidget = initializeInterfaceWidget(TQT3WT_TQMenuBar, w);
|
|
|
|
|
|
|
|
if (interfaceWidget == 0) {
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
// Convert the QStyleOption to the proper TQStyleOption
|
|
|
|
|
|
|
|
// In other words, figure out which TQt3 menu item is currently being drawn
|
|
|
|
|
|
|
|
// Qt4 makes this really, really hard...
|
|
|
|
|
|
|
|
// I have to guess based on the Qt4 position of the item in the menu, which may or may not work 100% in all cases
|
|
|
|
|
|
|
|
drawingItem = 0;
|
|
|
|
|
|
|
|
drawingAction = dynamic_cast<const QMenuBar*>(w)->actionAt(QPoint(opt->rect.x(), opt->rect.y()));
|
|
|
|
|
|
|
|
qt4menuactions = dynamic_cast<const QMenuBar*>(w)->actions();
|
|
|
|
|
|
|
|
for (i=0; i<qt4menuactions.size();++i) {
|
|
|
|
|
|
|
|
if (qt4menuactions.at(i) == drawingAction) {
|
|
|
|
|
|
|
|
drawingItem = m_tqt3menubar_widget->findItem(m_tqt3menubar_widget->idAt(i));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (drawingItem) {
|
|
|
|
|
|
|
|
tqt3opt = TQStyleOption(drawingItem);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_MenuBarEmptyArea:
|
|
|
|
|
|
|
|
tqtCE = TQStyle::CE_MenuBarEmptyArea;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_MenuEmptyArea:
|
|
|
|
|
|
|
|
tqtCE = TQStyle::CE_MenuBarEmptyArea;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ShapedFrame:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case QStyle::CE_TabBarTabShape:
|
|
|
|
case QStyle::CE_TabBarTabShape:
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
can_override = false;
|
|
|
|
can_override = false;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarAddLine:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarSubLine:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarAddPage:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarSubPage:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarSlider:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarFirst:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::CE_ScrollBarLast:
|
|
|
|
|
|
|
|
// Ignore request as Qt3 has no equivalent
|
|
|
|
|
|
|
|
can_override = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
printf("No rules to draw Qt4 control %d\n\r", element); fflush(stdout);
|
|
|
|
printf("No rules to draw Qt4 control %d\n\r", element); fflush(stdout);
|
|
|
@ -1435,6 +1839,12 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
|
|
|
|
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (element == QStyle::CE_TabBarTab) {
|
|
|
|
|
|
|
|
// CE_TabBarTab doesn't draw the base panel of the tab
|
|
|
|
|
|
|
|
tqt3tabwidth = tqApp->style().pixelMetric(TQStyle::PM_TabBarTabOverlap, interfaceWidget);
|
|
|
|
|
|
|
|
tqtPainter.fillRect(TQRect(tqt3elementrect.x()+tqt3tabwidth, tqt3elementrect.y(), tqt3elementrect.width()-(tqt3tabwidth*2), tqt3elementrect.height()), tqt3colorgroup.background());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Instruct TQt3 to draw the control
|
|
|
|
// Instruct TQt3 to draw the control
|
|
|
|
// FIXME
|
|
|
|
// FIXME
|
|
|
|
// Implement sflags and QStyleOption
|
|
|
|
// Implement sflags and QStyleOption
|
|
|
@ -1460,8 +1870,6 @@ void SimpleStyle::drawControl(ControlElement element, const QStyleOption *opt, Q
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define NO_QT3_EQUIVALENT can_override = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
|
|
|
|
void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Construct a Qt3 paint device translator on the Qt4 painter
|
|
|
|
// Construct a Qt3 paint device translator on the Qt4 painter
|
|
|
@ -1470,7 +1878,10 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
// Open a painter on the paint device translator
|
|
|
|
// Open a painter on the paint device translator
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQRect tqt3paintrect = TQRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height());
|
|
|
|
|
|
|
|
|
|
|
|
bool can_override = true;
|
|
|
|
bool can_override = true;
|
|
|
|
|
|
|
|
bool do_not_draw = false;
|
|
|
|
TQStyle::PrimitiveElement tqtPE;
|
|
|
|
TQStyle::PrimitiveElement tqtPE;
|
|
|
|
TQStyleOption tqt3opt(TQStyleOption::Default);
|
|
|
|
TQStyleOption tqt3opt(TQStyleOption::Default);
|
|
|
|
|
|
|
|
|
|
|
@ -1485,9 +1896,26 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
tqtPE = TQStyle::PE_PanelPopup;
|
|
|
|
tqtPE = TQStyle::PE_PanelPopup;
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_PanelMenuBar:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_PanelMenuBar;
|
|
|
|
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_PanelMenu:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_PanelPopup;
|
|
|
|
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
|
|
|
|
|
break;
|
|
|
|
case QStyle::PE_PanelButtonBevel:
|
|
|
|
case QStyle::PE_PanelButtonBevel:
|
|
|
|
tqtPE = TQStyle::PE_ButtonBevel;
|
|
|
|
tqtPE = TQStyle::PE_ButtonBevel;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_FrameLineEdit:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_PanelLineEdit;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_PanelStatusBar:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_Panel;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_PanelButtonTool:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_ButtonTool;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case QStyle::PE_FrameGroupBox:
|
|
|
|
case QStyle::PE_FrameGroupBox:
|
|
|
|
tqtPE = TQStyle::PE_GroupBoxFrame;
|
|
|
|
tqtPE = TQStyle::PE_GroupBoxFrame;
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
|
tqt3opt = TQStyleOption(static_cast<const QStyleOptionFrame*>(opt)->lineWidth, static_cast<const QStyleOptionFrame*>(opt)->midLineWidth);
|
|
|
@ -1503,6 +1931,15 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PE_FrameTabWidget:
|
|
|
|
case QStyle::PE_FrameTabWidget:
|
|
|
|
tqtPE = TQStyle::PE_PanelTabWidget;
|
|
|
|
tqtPE = TQStyle::PE_PanelTabWidget;
|
|
|
|
|
|
|
|
// HACK
|
|
|
|
|
|
|
|
// For an unknown reason Qt4 paints the tab border 2 pixels lower and shorter than it should
|
|
|
|
|
|
|
|
// FIXME
|
|
|
|
|
|
|
|
// Figure out why that happens!
|
|
|
|
|
|
|
|
tqt3paintrect = TQRect(tqt3paintrect.x(), tqt3paintrect.y()-2, tqt3paintrect.width(), tqt3paintrect.height()+2);
|
|
|
|
|
|
|
|
p->setClipRect(QRect(tqt3paintrect.x(), tqt3paintrect.y(), tqt3paintrect.width(), tqt3paintrect.height()));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_FrameDefaultButton:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_ButtonDefault;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PE_PanelButtonCommand:
|
|
|
|
case QStyle::PE_PanelButtonCommand:
|
|
|
|
tqtPE = TQStyle::PE_ButtonCommand;
|
|
|
|
tqtPE = TQStyle::PE_ButtonCommand;
|
|
|
@ -1528,15 +1965,34 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
case QStyle::PE_IndicatorRadioButton:
|
|
|
|
case QStyle::PE_IndicatorRadioButton:
|
|
|
|
tqtPE = TQStyle::PE_ExclusiveIndicator;
|
|
|
|
tqtPE = TQStyle::PE_ExclusiveIndicator;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PE_PanelMenu:
|
|
|
|
case QStyle::PE_IndicatorSpinDown:
|
|
|
|
tqtPE = TQStyle::PE_PanelPopup;
|
|
|
|
tqtPE = TQStyle::PE_SpinWidgetDown;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PE_PanelButtonTool:
|
|
|
|
case QStyle::PE_IndicatorSpinUp:
|
|
|
|
tqtPE = TQStyle::PE_ButtonTool;
|
|
|
|
tqtPE = TQStyle::PE_SpinWidgetUp;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_IndicatorSpinPlus:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_SpinWidgetPlus;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_IndicatorSpinMinus:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_SpinWidgetMinus;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_FrameWindow:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_WindowFrame;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case QStyle::PE_IndicatorTabTear:
|
|
|
|
case QStyle::PE_IndicatorTabTear:
|
|
|
|
NO_QT3_EQUIVALENT
|
|
|
|
NO_QT3_EQUIVALENT
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_FrameStatusBarItem:
|
|
|
|
|
|
|
|
NO_QT3_EQUIVALENT
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case QStyle::PE_PanelLineEdit:
|
|
|
|
|
|
|
|
NO_QT3_EQUIVALENT
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
// Qt3 support elements
|
|
|
|
|
|
|
|
case QStyle::PE_Q3Separator:
|
|
|
|
|
|
|
|
tqtPE = TQStyle::PE_Separator;
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
printf("No rules to draw Qt4 element %d\n\r", pe); fflush(stdout);
|
|
|
|
printf("No rules to draw Qt4 element %d\n\r", pe); fflush(stdout);
|
|
|
@ -1570,7 +2026,7 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
TQPainter tqtPainter(&qt4pd);
|
|
|
|
|
|
|
|
|
|
|
|
// Instruct TQt3 to draw the primitive
|
|
|
|
// Instruct TQt3 to draw the primitive
|
|
|
|
tqApp->style().drawPrimitive(tqtPE, &tqtPainter, TQRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height()), tqt3colorgroup, sflags, tqt3opt);
|
|
|
|
tqApp->style().drawPrimitive(tqtPE, &tqtPainter, tqt3paintrect, tqt3colorgroup, sflags, tqt3opt);
|
|
|
|
tqtPainter.end();
|
|
|
|
tqtPainter.end();
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
|
#ifdef DEBUG_WARNINGS
|
|
|
@ -1580,7 +2036,9 @@ void SimpleStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QP
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
// Tell Qt4 to draw it
|
|
|
|
if (do_not_draw == false) {
|
|
|
|
QCommonStyle::drawPrimitive(pe, opt, p, w);
|
|
|
|
// Tell Qt4 to draw it
|
|
|
|
|
|
|
|
QCommonStyle::drawPrimitive(pe, opt, p, w);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|