@ -1561,7 +1561,7 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
const QComboBox * qt4combobox_widget = 0 ;
const QComboBox * qt4combobox_widget = 0 ;
const QSlider * qt4slider_widget = 0 ;
const QSlider * qt4slider_widget = 0 ;
const QScrollBar * qt4scrollbar_widget = 0 ;
const QScrollBar * qt4scrollbar_widget = 0 ;
const Q SpinBox* qt4spinbox_widget = 0 ;
const Q Abstract SpinBox* qt4spinbox_widget = 0 ;
const QMenuBar * qt4menubar_widget = 0 ;
const QMenuBar * qt4menubar_widget = 0 ;
const QToolBox * qt4toolbox_widget = 0 ;
const QToolBox * qt4toolbox_widget = 0 ;
const QToolButton * qt4toolbutton_widget = 0 ;
const QToolButton * qt4toolbutton_widget = 0 ;
@ -1815,10 +1815,11 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
interfaceWidget = 0 ;
interfaceWidget = 0 ;
}
}
break ;
break ;
#if 0
case TQT3WT_TQSpinBox :
case TQT3WT_TQSpinBox :
interfaceWidget = m_tqt3spinbox_widget ;
interfaceWidget = m_tqt3spinbox_widget ;
// Copy over all widget attributes
// Copy over all widget attributes
qt4spinbox_widget = dynamic_cast < const Q SpinBox* > ( w ) ;
qt4spinbox_widget = dynamic_cast < const Q Abstract SpinBox* > ( w ) ;
if ( qt4spinbox_widget ) {
if ( qt4spinbox_widget ) {
m_tqt3spinbox_widget - > setGeometry ( 0 , 0 , qt4spinbox_widget - > width ( ) , qt4spinbox_widget - > height ( ) ) ;
m_tqt3spinbox_widget - > setGeometry ( 0 , 0 , qt4spinbox_widget - > width ( ) , qt4spinbox_widget - > height ( ) ) ;
m_tqt3spinbox_widget - > setEnabled ( qt4spinbox_widget - > isEnabled ( ) ) ;
m_tqt3spinbox_widget - > setEnabled ( qt4spinbox_widget - > isEnabled ( ) ) ;
@ -1834,18 +1835,16 @@ TQWidget* Qt4TDEStyle::initializeInterfaceWidget(TQt3WidgetType wt, const QWidge
interfaceWidget = 0 ;
interfaceWidget = 0 ;
}
}
break ;
break ;
# endif
case TQT3WT_TQSpinWidget :
case TQT3WT_TQSpinWidget :
interfaceWidget = m_tqt3spinwidget_widget ;
interfaceWidget = m_tqt3spinwidget_widget ;
// Copy over all widget attributes
// Copy over all widget attributes
qt4spinbox_widget = dynamic_cast < const Q SpinBox* > ( w ) ;
qt4spinbox_widget = dynamic_cast < const Q Abstract SpinBox* > ( w ) ;
if ( qt4spinbox_widget ) {
if ( qt4spinbox_widget ) {
m_tqt3spinwidget_widget - > setGeometry ( 0 , 0 , qt4spinbox_widget - > width ( ) , qt4spinbox_widget - > height ( ) ) ;
m_tqt3spinwidget_widget - > setGeometry ( 0 , 0 , qt4spinbox_widget - > width ( ) , qt4spinbox_widget - > height ( ) ) ;
m_tqt3spinwidget_widget - > setEnabled ( qt4spinbox_widget - > isEnabled ( ) ) ;
m_tqt3spinwidget_widget - > setEnabled ( qt4spinbox_widget - > isEnabled ( ) ) ;
// FIXME
m_tqt3spinwidget_widget - > setUpEnabled ( qt4spinbox_widget - > stepEnabled ( ) & QSpinBox : : StepUpEnabled ) ;
// m_tqt3spinwidget_widget->setMinValue(qt4spinbox_widget->minimum());
m_tqt3spinwidget_widget - > setDownEnabled ( qt4spinbox_widget - > stepEnabled ( ) & QSpinBox : : StepDownEnabled ) ;
// m_tqt3spinwidget_widget->setMaxValue(qt4spinbox_widget->maximum());
// m_tqt3spinwidget_widget->setLineStep(qt4spinbox_widget->singleStep());
// m_tqt3spinwidget_widget->setValue(qt4spinbox_widget->value());
}
}
else {
else {
if ( enable_debug_warnings ) {
if ( enable_debug_warnings ) {
@ -1971,6 +1970,92 @@ QRect Qt4TDEStyle::subElementRect(SubElement element, const QStyleOption *opt, c
return retRect ;
return retRect ;
}
}
QRect Qt4TDEStyle : : subControlRect ( ComplexControl control , const QStyleOptionComplex * opt , SubControl subControl , const QWidget * w ) const
{
TQStyle : : SFlags sflags = 0 ;
bool can_override = true ;
TQStyle : : ComplexControl tqtCC ;
TQStyle : : SubControl tqtSC ;
TQWidget * interfaceWidget = 0 ;
TQStyleOption tqt3opt ( TQStyleOption : : Default ) ;
QRect retRect ;
switch ( control ) {
case CC_SpinBox : {
tqtCC = TQStyle : : CC_SpinWidget ;
switch ( subControl ) {
case SC_SpinBoxUp :
tqtSC = TQStyle : : SC_SpinWidgetUp ;
interfaceWidget = initializeInterfaceWidget ( TQT3WT_TQSpinWidget , w , opt ) ;
if ( interfaceWidget = = 0 ) {
can_override = false ;
}
break ;
case SC_SpinBoxDown :
tqtSC = TQStyle : : SC_SpinWidgetDown ;
interfaceWidget = initializeInterfaceWidget ( TQT3WT_TQSpinWidget , w , opt ) ;
if ( interfaceWidget = = 0 ) {
can_override = false ;
}
break ;
case SC_SpinBoxEditField :
tqtSC = TQStyle : : SC_SpinWidgetEditField ;
interfaceWidget = initializeInterfaceWidget ( TQT3WT_TQSpinWidget , w , opt ) ;
if ( interfaceWidget = = 0 ) {
can_override = false ;
}
break ;
case SC_SpinBoxFrame :
tqtSC = TQStyle : : SC_SpinWidgetFrame ;
interfaceWidget = initializeInterfaceWidget ( TQT3WT_TQSpinWidget , w , opt ) ;
if ( interfaceWidget = = 0 ) {
can_override = false ;
}
break ;
default :
if ( enable_debug_warnings ) {
printf ( " No rules to obtain Qt4 subcontrol rect %d for control %d \n \r " , subControl , control ) ; fflush ( stdout ) ;
}
can_override = false ;
}
break ;
}
default :
if ( enable_debug_warnings ) {
printf ( " No rules to obtain Qt4 subcontrol rect %d for control %d \n \r " , subControl , control ) ; fflush ( stdout ) ;
}
can_override = false ;
}
if ( can_override ) {
// Instruct TQt3 to obtain the subelement rect information
retRect = convertTQt3ToQt4Rect ( tqApp - > style ( ) . querySubControlMetrics ( tqtCC , interfaceWidget , tqtSC , tqt3opt ) ) ;
if ( ( tqtCC = = TQStyle : : CC_SpinWidget ) & & ( tqtSC = = TQStyle : : SC_SpinWidgetEditField ) ) {
// HACK
// For an unknown reason, Qt4 instantly resizes SpinBoxes to a very small height if TQt3 returns
// an editor height hint that is different (larger?) than the Qt4 editor height hint!
// Work around this problem here...
QRect qt4Rect = BASE_QT4_STYLE_CLASS : : subControlRect ( control , opt , subControl , w ) ;
retRect . setHeight ( qt4Rect . height ( ) ) ;
}
if ( enable_debug_warnings ) {
# ifdef DEBUG_SPEW
printf ( " Used Qt3 subcontrol rect %d for control %d to handle Qt4 subcontrol rect %d for control %d \n \r " , tqtSC , tqtCC , subControl , control ) ; fflush ( stdout ) ;
# endif
}
}
else {
// Tell Qt4 to obtain the subelement rect information
retRect = BASE_QT4_STYLE_CLASS : : subControlRect ( control , opt , subControl , w ) ;
}
return retRect ;
}
void Qt4TDEStyle : : drawComplexControl ( ComplexControl control , const QStyleOptionComplex * opt , QPainter * p , const QWidget * w ) const
void Qt4TDEStyle : : drawComplexControl ( ComplexControl control , const QStyleOptionComplex * opt , QPainter * p , const QWidget * w ) const
{
{
TQStyle : : SFlags sflags = 0 ;
TQStyle : : SFlags sflags = 0 ;
@ -2048,12 +2133,26 @@ void Qt4TDEStyle::drawComplexControl(ComplexControl control, const QStyleOptionC
if ( ( sbopt - > subControls & QStyle : : SC_SpinBoxUp ) | | ( sbopt - > subControls & QStyle : : SC_SpinBoxDown ) ) {
if ( ( sbopt - > subControls & QStyle : : SC_SpinBoxUp ) | | ( sbopt - > subControls & QStyle : : SC_SpinBoxDown ) ) {
subControl = subControl | TQStyle : : SC_SpinWidgetButtonField ;
subControl = subControl | TQStyle : : SC_SpinWidgetButtonField ;
}
}
if ( sbopt - > subControls & QStyle : : SC_SpinBoxUp ) {
subControl = subControl | TQStyle : : SC_SpinWidgetUp ;
}
if ( sbopt - > subControls & QStyle : : SC_SpinBoxDown ) {
subControl = subControl | TQStyle : : SC_SpinWidgetDown ;
}
if ( sbopt - > subControls & QStyle : : SC_SpinBoxEditField ) {
if ( sbopt - > subControls & QStyle : : SC_SpinBoxEditField ) {
subControl = subControl | TQStyle : : SC_SpinWidgetFrame ;
subControl = subControl | TQStyle : : SC_SpinWidget EditField ;
}
}
if ( sbopt - > subControls & QStyle : : SC_SpinBoxFrame ) {
if ( sbopt - > subControls & QStyle : : SC_SpinBoxFrame ) {
subControl = subControl | TQStyle : : SC_SpinWidgetFrame ;
subControl = subControl | TQStyle : : SC_SpinWidgetFrame ;
}
}
subControlActive = 0 ;
if ( sbopt - > activeSubControls & QStyle : : SC_SpinBoxUp ) {
subControlActive = subControlActive | TQStyle : : SC_SpinWidgetUp ;
}
if ( sbopt - > activeSubControls & QStyle : : SC_SpinBoxDown ) {
subControlActive = subControlActive | TQStyle : : SC_SpinWidgetDown ;
}
break ;
break ;
case CC_TitleBar :
case CC_TitleBar :
tqtCC = TQStyle : : CC_TitleBar ;
tqtCC = TQStyle : : CC_TitleBar ;