Adjusted to latest QVariant::QVariant(bool) function.

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/2/head
Michele Calgaro 5 years ago
parent 2c29133f7e
commit a2fa7ca983
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -85,7 +85,7 @@ bool QUType_QVariant::convertFrom( QUObject *o, QUType *t )
else if ( isEqual( o->type, &static_QUType_int ) ) else if ( isEqual( o->type, &static_QUType_int ) )
var = new QVariant( static_QUType_int.get( o ) ); var = new QVariant( static_QUType_int.get( o ) );
else if ( isEqual( o->type, &static_QUType_bool ) ) else if ( isEqual( o->type, &static_QUType_bool ) )
var = new QVariant( static_QUType_bool.get( o ), 42 ); var = new QVariant( static_QUType_bool.get( o ) );
else if ( isEqual( o->type, &static_QUType_double ) ) else if ( isEqual( o->type, &static_QUType_double ) )
var = new QVariant( static_QUType_double.get( o ) ); var = new QVariant( static_QUType_double.get( o ) );
else if ( isEqual( o->type, &static_QUType_charstar ) ) else if ( isEqual( o->type, &static_QUType_charstar ) )

@ -877,12 +877,10 @@ QVariant::QVariant( Q_ULLONG val )
} }
/*! /*!
Constructs a new variant with a boolean value, \a val. The integer Constructs a new variant with a boolean value, \a val.
argument is a dummy, necessary for compatibility with some
compilers.
*/ */
QVariant::QVariant( bool val, int ) QVariant::QVariant( bool val )
{ // this is the comment that does NOT name said compiler. {
d = new Private; d = new Private;
d->typ = Bool; d->typ = Bool;
d->value.b = val; d->value.b = val;

@ -167,8 +167,7 @@ public:
QVariant( uint ); QVariant( uint );
QVariant( Q_LLONG ); QVariant( Q_LLONG );
QVariant( Q_ULLONG ); QVariant( Q_ULLONG );
// ### Problems on some compilers ? QVariant( bool );
QVariant( bool, int );
QVariant( double ); QVariant( double );
QVariant( QSizePolicy ); QVariant( QSizePolicy );

@ -3441,16 +3441,14 @@ void generateClass() // generate C++ source code for a class
} }
if ( it.current()->getfunc ) { if ( it.current()->getfunc ) {
if ( it.current()->gspec == Property::Pointer ) if ( it.current()->gspec == Property::Pointer )
fprintf( out, "\tcase 1: if ( this->%s() ) *v = QVariant( %s*%s()%s ); break;\n", fprintf( out, "\tcase 1: if ( this->%s() ) *v = QVariant( %s*%s() ); break;\n",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data(),
!isVariantType( it.current()->type ) ? "(int)" : "", !isVariantType( it.current()->type ) ? "(int)" : "",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data());
it.current()->type == "bool" ? ", 0" : "" );
else else
fprintf( out, "\tcase 1: *v = QVariant( %sthis->%s()%s ); break;\n", fprintf( out, "\tcase 1: *v = QVariant( %sthis->%s() ); break;\n",
!isVariantType( it.current()->type ) ? "(int)" : "", !isVariantType( it.current()->type ) ? "(int)" : "",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data());
it.current()->type == "bool" ? ", 0" : "" );
} else if ( it.current()->override ) { } else if ( it.current()->override ) {
flag_propagate |= 1<< (1+1); flag_propagate |= 1<< (1+1);
} }

@ -6267,16 +6267,14 @@ void generateClass() // generate C++ source code for a class
} }
if ( it.current()->getfunc ) { if ( it.current()->getfunc ) {
if ( it.current()->gspec == Property::Pointer ) if ( it.current()->gspec == Property::Pointer )
fprintf( out, "\tcase 1: if ( this->%s() ) *v = QVariant( %s*%s()%s ); break;\n", fprintf( out, "\tcase 1: if ( this->%s() ) *v = QVariant( %s*%s() ); break;\n",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data(),
!isVariantType( it.current()->type ) ? "(int)" : "", !isVariantType( it.current()->type ) ? "(int)" : "",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data());
it.current()->type == "bool" ? ", 0" : "" );
else else
fprintf( out, "\tcase 1: *v = QVariant( %sthis->%s()%s ); break;\n", fprintf( out, "\tcase 1: *v = QVariant( %sthis->%s() ); break;\n",
!isVariantType( it.current()->type ) ? "(int)" : "", !isVariantType( it.current()->type ) ? "(int)" : "",
it.current()->getfunc->name.data(), it.current()->getfunc->name.data());
it.current()->type == "bool" ? ", 0" : "" );
} else if ( it.current()->override ) { } else if ( it.current()->override ) {
flag_propagate |= 1<< (1+1); flag_propagate |= 1<< (1+1);
} }

@ -288,7 +288,7 @@ QVariant QPSQLResult::data( int i )
switch ( type ) { switch ( type ) {
case QVariant::Bool: case QVariant::Bool:
{ {
QVariant b ( (bool)(val == "t"), 0 ); QVariant b ( (bool)(val == "t") );
return ( b ); return ( b );
} }
case QVariant::String: case QVariant::String:

@ -185,12 +185,12 @@ QDialogButtons::setDefaultButton(Button button)
if(d->def != button) { if(d->def != button) {
#ifndef QT_NO_PROPERTIES #ifndef QT_NO_PROPERTIES
if(d->buttons.contains(d->def)) if(d->buttons.contains(d->def))
d->buttons[d->def]->setProperty("default", QVariant(FALSE,0)); d->buttons[d->def]->setProperty("default", QVariant(false));
#endif #endif
d->def = button; d->def = button;
#ifndef QT_NO_PROPERTIES #ifndef QT_NO_PROPERTIES
if(d->buttons.contains(d->def)) if(d->buttons.contains(d->def))
d->buttons[d->def]->setProperty("default", QVariant(FALSE,0)); d->buttons[d->def]->setProperty("default", QVariant(false));
#endif #endif
} }
} }
@ -413,7 +413,7 @@ QDialogButtons::layoutButtons()
if(b == d->def) { if(b == d->def) {
w->setFocus(); w->setFocus();
#ifndef QT_NO_PROPERTIES #ifndef QT_NO_PROPERTIES
w->setProperty("default", QVariant(TRUE,0)); w->setProperty("default", QVariant(true));
#endif #endif
} }
w->setEnabled(d->enabled & b); w->setEnabled(d->enabled & b);

@ -1740,8 +1740,8 @@ void MainWindow::handleRMBProperties( int id, QMap<QString, int> &props, QWidget
if ( oldDoWrap != doWrap ) { if ( oldDoWrap != doWrap ) {
QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) ); QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) );
SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor,
"wordwrap", QVariant( oldDoWrap, 0 ), "wordwrap", QVariant( oldDoWrap ),
QVariant( doWrap, 0 ), QString::null, QString::null ); QVariant( doWrap ), QString::null, QString::null );
cmd->execute(); cmd->execute();
formWindow()->commandHistory()->addCommand( cmd ); formWindow()->commandHistory()->addCommand( cmd );
MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE ); MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE );
@ -2647,8 +2647,8 @@ bool MainWindow::openEditor( QWidget *w, FormWindow *f )
if ( oldDoWrap != doWrap ) { if ( oldDoWrap != doWrap ) {
QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) ); QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) );
SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor, SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor,
"wordwrap", QVariant( oldDoWrap, 0 ), "wordwrap", QVariant( oldDoWrap ),
QVariant( doWrap, 0 ), QString::null, QString::null ); QVariant( doWrap ), QString::null, QString::null );
cmd->execute(); cmd->execute();
formWindow()->commandHistory()->addCommand( cmd ); formWindow()->commandHistory()->addCommand( cmd );
MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE ); MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE );

@ -1103,7 +1103,7 @@ PropertyBoolItem::~PropertyBoolItem()
void PropertyBoolItem::toggle() void PropertyBoolItem::toggle()
{ {
bool b = value().toBool(); bool b = value().toBool();
setValue( QVariant( !b, 0 ) ); setValue( QVariant( !b ) );
setValue(); setValue();
} }
@ -1158,7 +1158,7 @@ void PropertyBoolItem::setValue()
return; return;
setText( 1, combo()->currentText() ); setText( 1, combo()->currentText() );
bool b = combo()->currentItem() == 0 ? (bool)FALSE : (bool)TRUE; bool b = combo()->currentItem() == 0 ? (bool)FALSE : (bool)TRUE;
PropertyItem::setValue( QVariant( b, 0 ) ); PropertyItem::setValue( QVariant( b ) );
notifyValueChange(); notifyValueChange();
} }
@ -1900,13 +1900,13 @@ void PropertyFontItem::initChildren()
} else if ( item->name() == tr( "Point Size" ) ) } else if ( item->name() == tr( "Point Size" ) )
item->setValue( val.toFont().pointSize() ); item->setValue( val.toFont().pointSize() );
else if ( item->name() == tr( "Bold" ) ) else if ( item->name() == tr( "Bold" ) )
item->setValue( QVariant( val.toFont().bold(), 0 ) ); item->setValue( QVariant( val.toFont().bold() ) );
else if ( item->name() == tr( "Italic" ) ) else if ( item->name() == tr( "Italic" ) )
item->setValue( QVariant( val.toFont().italic(), 0 ) ); item->setValue( QVariant( val.toFont().italic() ) );
else if ( item->name() == tr( "Underline" ) ) else if ( item->name() == tr( "Underline" ) )
item->setValue( QVariant( val.toFont().underline(), 0 ) ); item->setValue( QVariant( val.toFont().underline() ) );
else if ( item->name() == tr( "Strikeout" ) ) else if ( item->name() == tr( "Strikeout" ) )
item->setValue( QVariant( val.toFont().strikeOut(), 0 ) ); item->setValue( QVariant( val.toFont().strikeOut() ) );
} }
} }
@ -3702,9 +3702,9 @@ void PropertyList::setPropertyValue( PropertyItem *i )
} else if ( i->name() == "wordwrap" ) { } else if ( i->name() == "wordwrap" ) {
int align = editor->widget()->property( "alignment" ).toInt(); int align = editor->widget()->property( "alignment" ).toInt();
if ( align & WordBreak ) if ( align & WordBreak )
i->setValue( QVariant( TRUE, 0 ) ); i->setValue( QVariant( true ) );
else else
i->setValue( QVariant( FALSE, 0 ) ); i->setValue( QVariant( false ) );
} else if ( i->name() == "layoutSpacing" ) { } else if ( i->name() == "layoutSpacing" ) {
( (PropertyLayoutItem*)i )->setValue( MetaDataBase::spacing( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) ); ( (PropertyLayoutItem*)i )->setValue( MetaDataBase::spacing( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) );
} else if ( i->name() == "layoutMargin" ) { } else if ( i->name() == "layoutMargin" ) {

@ -1486,13 +1486,13 @@ QVariant WidgetFactory::defaultValue( QObject *w, const QString &propName )
{ {
if ( propName == "wordwrap" ) { if ( propName == "wordwrap" ) {
int v = defaultValue( w, "alignment" ).toInt(); int v = defaultValue( w, "alignment" ).toInt();
return QVariant( ( v & WordBreak ) == WordBreak, 0 ); return QVariant( ( v & WordBreak ) == WordBreak );
} else if ( propName == "toolTip" || propName == "whatsThis" ) { } else if ( propName == "toolTip" || propName == "whatsThis" ) {
return QVariant( QString::fromLatin1( "" ) ); return QVariant( QString::fromLatin1( "" ) );
} else if ( w->inherits( "CustomWidget" ) ) { } else if ( w->inherits( "CustomWidget" ) ) {
return QVariant(); return QVariant();
} else if ( propName == "frameworkCode" ) { } else if ( propName == "frameworkCode" ) {
return QVariant( TRUE, 0 ); return QVariant( true );
} else if ( propName == "layoutMargin" || propName == "layoutSpacing" ) { } else if ( propName == "layoutMargin" || propName == "layoutSpacing" ) {
return QVariant( -1 ); return QVariant( -1 );
} }

@ -718,7 +718,7 @@ void Dlg2Ui::emitWidgetBody( const QDomElement& e, bool layouted )
if ( tagName == QString("Style") ) { if ( tagName == QString("Style") ) {
if ( getTextValue(n) == QString("ReadWrite") ) if ( getTextValue(n) == QString("ReadWrite") )
emitProperty( QString("editable"), emitProperty( QString("editable"),
QVariant(TRUE, 0) ); QVariant(true) );
} }
} else if ( parentTagName == QString("DlgWidget") ) { } else if ( parentTagName == QString("DlgWidget") ) {
if ( tagName == QString("Name") ) { if ( tagName == QString("Name") ) {
@ -891,7 +891,7 @@ QVariant Dlg2Ui::getValue( const QDomElement& e, const QString& tagName,
if ( type == QString("integer") ) { if ( type == QString("integer") ) {
return getTextValue( e ).toInt(); return getTextValue( e ).toInt();
} else if ( type == QString("boolean") ) { } else if ( type == QString("boolean") ) {
return QVariant( isTrue(getTextValue(e)), 0 ); return QVariant( isTrue(getTextValue(e)) );
} else if ( type == QString("double") ) { } else if ( type == QString("double") ) {
return getTextValue( e ).toDouble(); return getTextValue( e ).toDouble();
} else if ( type == QString("qcstring") ) { } else if ( type == QString("qcstring") ) {

@ -839,7 +839,7 @@ void Glade2Ui::emitPushButton( const QString& text, const QString& name )
emitProperty( QString("name"), name.latin1() ); emitProperty( QString("name"), name.latin1() );
emitProperty( QString("text"), text ); emitProperty( QString("text"), text );
if ( name.contains(QString("ok")) > 0 ) { if ( name.contains(QString("ok")) > 0 ) {
emitProperty( QString("default"), QVariant(TRUE, 0) ); emitProperty( QString("default"), QVariant(true) );
} else if ( name.contains(QString("help")) > 0 ) { } else if ( name.contains(QString("help")) > 0 ) {
emitProperty( QString("accel"), (int) Qt::Key_F1 ); emitProperty( QString("accel"), (int) Qt::Key_F1 );
} }
@ -1215,7 +1215,7 @@ void Glade2Ui::emitQListViewColumns( const QDomElement& qlistview )
} else if ( tagName == QString("class") ) { } else if ( tagName == QString("class") ) {
QString gtkClass = getTextValue( n ); QString gtkClass = getTextValue( n );
if ( gtkClass.endsWith(QString("Tree")) ) if ( gtkClass.endsWith(QString("Tree")) )
emitProperty( QString("rootIsDecorated"), QVariant(TRUE, 0) ); emitProperty( QString("rootIsDecorated"), QVariant(true) );
} else if ( tagName == QString("selection_mode") ) { } else if ( tagName == QString("selection_mode") ) {
emitProperty( QString("selectionMode"), emitProperty( QString("selectionMode"),
gtk2qtSelectionMode(getTextValue(n)) ); gtk2qtSelectionMode(getTextValue(n)) );
@ -1815,16 +1815,16 @@ QString Glade2Ui::emitWidget( const QDomElement& widget, bool layouted,
if ( !layouted && (x != 0 || y != 0 || width != 0 || height != 0) ) if ( !layouted && (x != 0 || y != 0 || width != 0 || height != 0) )
emitProperty( QString("geometry"), QRect(x, y, width, height) ); emitProperty( QString("geometry"), QRect(x, y, width, height) );
if ( gtkClass == QString("GtkToggleButton") ) { if ( gtkClass == QString("GtkToggleButton") ) {
emitProperty( QString("toggleButton"), QVariant(TRUE, 0) ); emitProperty( QString("toggleButton"), QVariant(true) );
if ( active ) if ( active )
emitProperty( QString("on"), QVariant(TRUE, 0) ); emitProperty( QString("on"), QVariant(true) );
} else { } else {
if ( active ) if ( active )
emitProperty( QString("checked"), QVariant(TRUE, 0) ); emitProperty( QString("checked"), QVariant(true) );
} }
if ( !editable ) if ( !editable )
emitProperty( QString("readOnly"), QVariant(TRUE, 0) ); emitProperty( QString("readOnly"), QVariant(true) );
if ( !focusTarget.isEmpty() ) if ( !focusTarget.isEmpty() )
emitProperty( QString("buddy"), emitProperty( QString("buddy"),
fixedName(focusTarget).latin1() ); fixedName(focusTarget).latin1() );
@ -1889,7 +1889,7 @@ QString Glade2Ui::emitWidget( const QDomElement& widget, bool layouted,
} }
if ( !showText ) if ( !showText )
emitProperty( QString("percentageVisible"), emitProperty( QString("percentageVisible"),
QVariant(FALSE, 0) ); QVariant(false) );
if ( step != 1 ) if ( step != 1 )
emitProperty( QString("lineStep"), step ); emitProperty( QString("lineStep"), step );
if ( tabPos.endsWith(QString("_BOTTOM")) || if ( tabPos.endsWith(QString("_BOTTOM")) ||
@ -1905,12 +1905,12 @@ QString Glade2Ui::emitWidget( const QDomElement& widget, bool layouted,
if ( !tooltip.isEmpty() ) if ( !tooltip.isEmpty() )
emitProperty( QString("toolTip"), tooltip ); emitProperty( QString("toolTip"), tooltip );
if ( !valueInList ) if ( !valueInList )
emitProperty( QString("editable"), QVariant(TRUE, 0) ); emitProperty( QString("editable"), QVariant(true) );
if ( wrap && gtkClass == QString("GtkSpinButton") ) if ( wrap && gtkClass == QString("GtkSpinButton") )
emitProperty( QString("wrapping"), QVariant(TRUE, 0) ); emitProperty( QString("wrapping"), QVariant(true) );
if ( gtkClass.endsWith(QString("Tree")) ) { if ( gtkClass.endsWith(QString("Tree")) ) {
emitProperty( QString("rootIsDecorated"), QVariant(TRUE, 0) ); emitProperty( QString("rootIsDecorated"), QVariant(true) );
} else if ( gtkOrientedWidget.exactMatch(gtkClass) ) { } else if ( gtkOrientedWidget.exactMatch(gtkClass) ) {
QString s = ( gtkOrientedWidget.cap(1) == QChar('H') ) ? QString s = ( gtkOrientedWidget.cap(1) == QChar('H') ) ?
QString( "Horizontal" ) : QString( "Vertical" ); QString( "Horizontal" ) : QString( "Vertical" );

@ -199,7 +199,7 @@ QVariant DomTool::elementToVariant( const QDomElement& e, const QVariant& defVal
v = QVariant( e.firstChild().toText().data().toDouble() ); v = QVariant( e.firstChild().toText().data().toDouble() );
} else if ( e.tagName() == "bool" ) { } else if ( e.tagName() == "bool" ) {
QString t = e.firstChild().toText().data(); QString t = e.firstChild().toText().data();
v = QVariant( t == "true" || t == "1", 0 ); v = QVariant( t == "true" || t == "1" );
} else if ( e.tagName() == "pixmap" ) { } else if ( e.tagName() == "pixmap" ) {
v = QVariant( e.firstChild().toText().data() ); v = QVariant( e.firstChild().toText().data() );
} else if ( e.tagName() == "iconset" ) { } else if ( e.tagName() == "iconset" ) {

@ -1052,7 +1052,7 @@ void Uic::createFormImpl( const QDomElement &e )
QString label = DomTool::readAttribute( n, "title", "", comment ).toString(); QString label = DomTool::readAttribute( n, "title", "", comment ).toString();
out << indent << "addPage( " << page << ", QString(\"\") );" << endl; out << indent << "addPage( " << page << ", QString(\"\") );" << endl;
trout << indent << "setTitle( " << page << ", " << trcall( label, comment ) << " );" << endl; trout << indent << "setTitle( " << page << ", " << trcall( label, comment ) << " );" << endl;
QVariant def( FALSE, 0 ); QVariant def( false );
if ( DomTool::hasAttribute( n, "backEnabled" ) ) if ( DomTool::hasAttribute( n, "backEnabled" ) )
out << indent << "setBackEnabled( " << page << ", " << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << endl; out << indent << "setBackEnabled( " << page << ", " << mkBool( DomTool::readAttribute( n, "backEnabled", def).toBool() ) << endl;
if ( DomTool::hasAttribute( n, "nextEnabled" ) ) if ( DomTool::hasAttribute( n, "nextEnabled" ) )

@ -537,7 +537,7 @@ QString Uic::setObjectProperty( const QString& objClass, const QString& obj, con
if ( stdset ) if ( stdset )
v = "%1"; v = "%1";
else else
v = "QVariant( %1, 0 )"; v = "QVariant( %1 )";
v = v.arg( mkBool( e.firstChild().toText().data() ) ); v = v.arg( mkBool( e.firstChild().toText().data() ) );
} else if ( e.tagName() == "pixmap" ) { } else if ( e.tagName() == "pixmap" ) {
v = e.firstChild().toText().data(); v = e.firstChild().toText().data();

@ -263,7 +263,7 @@ bool Uic::isFrameworkCodeGenerated( const QDomElement& e )
{ {
QDomElement n = getObjectProperty( e, "frameworkCode" ); QDomElement n = getObjectProperty( e, "frameworkCode" );
if ( n.attribute("name") == "frameworkCode" && if ( n.attribute("name") == "frameworkCode" &&
!DomTool::elementToVariant( n.firstChild().toElement(), QVariant( TRUE, 0 ) ).toBool() ) !DomTool::elementToVariant( n.firstChild().toElement(), QVariant( true ) ).toBool() )
return FALSE; return FALSE;
return TRUE; return TRUE;
} }

@ -637,7 +637,7 @@ void QWidgetFactory::unpackVariant( const UibStrTable& strings, QDataStream& in,
break; break;
case QVariant::Bool: case QVariant::Bool:
in >> bit; in >> bit;
value = QVariant( bit != 0, 0 ); value = QVariant( bit != 0 );
break; break;
case QVariant::Double: case QVariant::Double:
in >> value.asDouble(); in >> value.asDouble();

Loading…
Cancel
Save