Branch: master

a2fa7ca9 2019-05-26 15:31:56 Michele Calgaro
Adjusted to latest QVariant::QVariant(bool) function.

Signed-off-by: Michele Calgaro <michele.calgaro@...>
M src/kernel/qucomextra.cpp
M src/kernel/qvariant.cpp
M src/kernel/qvariant.h
M src/moc/moc.y
M src/moc/moc_yacc.cpp
M src/sql/drivers/psql/qsql_psql.cpp
M src/widgets/qdialogbuttons.cpp
M tools/designer/designer/mainwindow.cpp
M tools/designer/designer/propertyeditor.cpp
M tools/designer/designer/widgetfactory.cpp
M tools/designer/plugins/dlg/dlg2ui.cpp
M tools/designer/plugins/glade/glade2ui.cpp
M tools/designer/shared/domtool.cpp
M tools/designer/uic/form.cpp
M tools/designer/uic/object.cpp
M tools/designer/uic/uic.cpp
M tools/designer/uilib/qwidgetfactory.cpp

src/kernel/qucomextra.cpp

diff --git a/src/kernel/qucomextra.cpp b/src/kernel/qucomextra.cpp
index 427c29a..0ea698a 100644
--- a/src/kernel/qucomextra.cpp
+++ b/src/kernel/qucomextra.cpp
@@ -85,7 +85,7 @@
     else if ( isEqual( o->type, &static_QUType_int ) )
 	var = new QVariant( static_QUType_int.get( o ) );
     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 ) )
 	var = new QVariant( static_QUType_double.get( o ) );
     else if ( isEqual( o->type, &static_QUType_charstar ) )

src/kernel/qvariant.cpp

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

src/kernel/qvariant.h

diff --git a/src/kernel/qvariant.h b/src/kernel/qvariant.h
index b2cab8d..d4b49df 100644
--- a/src/kernel/qvariant.h
+++ b/src/kernel/qvariant.h
@@ -167,8 +167,7 @@
     QVariant( uint );
     QVariant( Q_LLONG );
     QVariant( Q_ULLONG );
-    // ### Problems on some compilers ?
-    QVariant( bool, int );
+    QVariant( bool );
     QVariant( double );
     QVariant( QSizePolicy );
 

src/moc/moc.y

diff --git a/src/moc/moc.y b/src/moc/moc.y
index 90f72ab..b117b68 100644
--- a/src/moc/moc.y
+++ b/src/moc/moc.y
@@ -3441,16 +3441,14 @@
 	    }
 	    if ( it.current()->getfunc ) {
 		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(),
 			     !isVariantType( it.current()->type ) ? "(int)" : "",
-			     it.current()->getfunc->name.data(),
-			     it.current()->type == "bool" ? ", 0" : "" );
+			     it.current()->getfunc->name.data());
 		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)" : "",
-			     it.current()->getfunc->name.data(),
-			     it.current()->type == "bool" ? ", 0" : "" );
+			     it.current()->getfunc->name.data());
 	    } else if ( it.current()->override ) {
 		flag_propagate |= 1<< (1+1);
 	    }

src/moc/moc_yacc.cpp

diff --git a/src/moc/moc_yacc.cpp b/src/moc/moc_yacc.cpp
index 2ab0be7..8d48f86 100644
--- a/src/moc/moc_yacc.cpp
+++ b/src/moc/moc_yacc.cpp
@@ -6267,16 +6267,14 @@
 	    }
 	    if ( it.current()->getfunc ) {
 		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(),
 			     !isVariantType( it.current()->type ) ? "(int)" : "",
-			     it.current()->getfunc->name.data(),
-			     it.current()->type == "bool" ? ", 0" : "" );
+			     it.current()->getfunc->name.data());
 		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)" : "",
-			     it.current()->getfunc->name.data(),
-			     it.current()->type == "bool" ? ", 0" : "" );
+			     it.current()->getfunc->name.data());
 	    } else if ( it.current()->override ) {
 		flag_propagate |= 1<< (1+1);
 	    }

src/sql/drivers/psql/qsql_psql.cpp

diff --git a/src/sql/drivers/psql/qsql_psql.cpp b/src/sql/drivers/psql/qsql_psql.cpp
index 9d028c0..c5e93c0 100644
--- a/src/sql/drivers/psql/qsql_psql.cpp
+++ b/src/sql/drivers/psql/qsql_psql.cpp
@@ -288,7 +288,7 @@
     switch ( type ) {
     case QVariant::Bool:
 	{
-	    QVariant b ( (bool)(val == "t"), 0 );
+	    QVariant b ( (bool)(val == "t") );
 	    return ( b );
 	}
     case QVariant::String:

src/widgets/qdialogbuttons.cpp

diff --git a/src/widgets/qdialogbuttons.cpp b/src/widgets/qdialogbuttons.cpp
index 39f6d67..07e09cf 100644
--- a/src/widgets/qdialogbuttons.cpp
+++ b/src/widgets/qdialogbuttons.cpp
@@ -185,12 +185,12 @@
     if(d->def != button) {
 #ifndef QT_NO_PROPERTIES
 	if(d->buttons.contains(d->def))
-	    d->buttons[d->def]->setProperty("default", QVariant(FALSE,0));
+	    d->buttons[d->def]->setProperty("default", QVariant(false));
 #endif
 	d->def = button;
 #ifndef QT_NO_PROPERTIES
 	if(d->buttons.contains(d->def))
-	    d->buttons[d->def]->setProperty("default", QVariant(FALSE,0));
+	    d->buttons[d->def]->setProperty("default", QVariant(false));
 #endif
     }
 }
@@ -413,7 +413,7 @@
 		    if(b == d->def) {
 			w->setFocus();
 #ifndef QT_NO_PROPERTIES
-			w->setProperty("default", QVariant(TRUE,0));
+			w->setProperty("default", QVariant(true));
 #endif
 		    }
 		    w->setEnabled(d->enabled & b);

tools/designer/designer/mainwindow.cpp

diff --git a/tools/designer/designer/mainwindow.cpp b/tools/designer/designer/mainwindow.cpp
index 1263c6b..4a786ed 100644
--- a/tools/designer/designer/mainwindow.cpp
+++ b/tools/designer/designer/mainwindow.cpp
@@ -1740,8 +1740,8 @@
 	    if ( oldDoWrap != doWrap ) {
 		QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) );
 		SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor,
-								  "wordwrap", QVariant( oldDoWrap, 0 ),
-								  QVariant( doWrap, 0 ), QString::null, QString::null );
+								  "wordwrap", QVariant( oldDoWrap ),
+								  QVariant( doWrap ), QString::null, QString::null );
 		cmd->execute();
 		formWindow()->commandHistory()->addCommand( cmd );
 		MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE );
@@ -2647,8 +2647,8 @@
 	    if ( oldDoWrap != doWrap ) {
 		QString pn( tr( "Set 'wordwrap' of '%1'" ).arg( w->name() ) );
 		SetPropertyCommand *cmd = new SetPropertyCommand( pn, formWindow(), w, propertyEditor,
-								  "wordwrap", QVariant( oldDoWrap, 0 ),
-								  QVariant( doWrap, 0 ), QString::null, QString::null );
+								  "wordwrap", QVariant( oldDoWrap ),
+								  QVariant( doWrap ), QString::null, QString::null );
 		cmd->execute();
 		formWindow()->commandHistory()->addCommand( cmd );
 		MetaDataBase::setPropertyChanged( w, "wordwrap", TRUE );

tools/designer/designer/propertyeditor.cpp

diff --git a/tools/designer/designer/propertyeditor.cpp b/tools/designer/designer/propertyeditor.cpp
index 98d299c..c1cde23 100644
--- a/tools/designer/designer/propertyeditor.cpp
+++ b/tools/designer/designer/propertyeditor.cpp
@@ -1103,7 +1103,7 @@
 void PropertyBoolItem::toggle()
 {
     bool b = value().toBool();
-    setValue( QVariant( !b, 0 ) );
+    setValue( QVariant( !b ) );
     setValue();
 }
 
@@ -1158,7 +1158,7 @@
 	return;
     setText( 1, combo()->currentText() );
     bool b = combo()->currentItem() == 0 ? (bool)FALSE : (bool)TRUE;
-    PropertyItem::setValue( QVariant( b, 0 ) );
+    PropertyItem::setValue( QVariant( b ) );
     notifyValueChange();
 }
 
@@ -1900,13 +1900,13 @@
 	} else if ( item->name() == tr( "Point Size" ) )
 	    item->setValue( val.toFont().pointSize() );
 	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" ) )
-	    item->setValue( QVariant( val.toFont().italic(), 0 ) );
+	    item->setValue( QVariant( val.toFont().italic() ) );
 	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" ) )
-	    item->setValue( QVariant( val.toFont().strikeOut(), 0 ) );
+	    item->setValue( QVariant( val.toFont().strikeOut() ) );
     }
 }
 
@@ -3702,9 +3702,9 @@
 	} else if ( i->name() == "wordwrap" ) {
 	    int align = editor->widget()->property( "alignment" ).toInt();
 	    if ( align & WordBreak )
-		i->setValue( QVariant( TRUE, 0 ) );
+		i->setValue( QVariant( true ) );
 	    else
-		i->setValue( QVariant( FALSE, 0 ) );
+		i->setValue( QVariant( false ) );
 	} else if ( i->name() == "layoutSpacing" ) {
 	    ( (PropertyLayoutItem*)i )->setValue( MetaDataBase::spacing( WidgetFactory::containerOfWidget( (QWidget*)editor->widget() ) ) );
 	} else if ( i->name() == "layoutMargin" ) {

tools/designer/designer/widgetfactory.cpp

diff --git a/tools/designer/designer/widgetfactory.cpp b/tools/designer/designer/widgetfactory.cpp
index 3757f5c..9ae35f4 100644
--- a/tools/designer/designer/widgetfactory.cpp
+++ b/tools/designer/designer/widgetfactory.cpp
@@ -1486,13 +1486,13 @@
 {
     if ( propName == "wordwrap" ) {
 	int v = defaultValue( w, "alignment" ).toInt();
-	return QVariant( ( v & WordBreak ) == WordBreak, 0 );
+	return QVariant( ( v & WordBreak ) == WordBreak );
     } else if ( propName == "toolTip" || propName == "whatsThis" ) {
 	return QVariant( QString::fromLatin1( "" ) );
     } else if ( w->inherits( "CustomWidget" ) ) {
 	return QVariant();
     } else if ( propName == "frameworkCode" ) {
-	return QVariant( TRUE, 0 );
+	return QVariant( true );
     } else if ( propName == "layoutMargin" || propName == "layoutSpacing" ) {
 	return QVariant( -1 );
     }

tools/designer/plugins/dlg/dlg2ui.cpp

diff --git a/tools/designer/plugins/dlg/dlg2ui.cpp b/tools/designer/plugins/dlg/dlg2ui.cpp
index c309eb2..6b23453 100644
--- a/tools/designer/plugins/dlg/dlg2ui.cpp
+++ b/tools/designer/plugins/dlg/dlg2ui.cpp
@@ -718,7 +718,7 @@
 			if ( tagName == QString("Style") ) {
 			    if ( getTextValue(n) == QString("ReadWrite") )
 				emitProperty( QString("editable"),
-					      QVariant(TRUE, 0) );
+					      QVariant(true) );
 			}
 		    } else if ( parentTagName == QString("DlgWidget") ) {
 			if ( tagName == QString("Name") ) {
@@ -891,7 +891,7 @@
** Diff limit reached (max: 250 lines) **