Exemplo n.º 1
0
QString Ui3Reader::getDatabaseInfo(const QDomElement& e, const QString& tag)
{
    QDomElement n;
    QDomElement n1;
    int child = 0;
    // database info is a stringlist stored in this order
    if (tag == QLatin1String("connection"))
        child = 0;
    else if (tag == QLatin1String("table"))
        child = 1;
    else if (tag == QLatin1String("field"))
        child = 2;
    else
        return QString();
    n = getObjectProperty(e, QLatin1String("database"));
    if (n.firstChild().toElement().tagName() == QLatin1String("stringlist")) {
        // find correct stringlist entry
        QDomElement n1 = n.firstChild().firstChild().toElement();
        for (int i = 0; i < child && !n1.isNull(); ++i)
            n1 = n1.nextSibling().toElement();
        if (n1.isNull())
            return QString();
        return n1.firstChild().toText().data();
    }
    return QString();
}
Exemplo n.º 2
0
/*! Extracts an object name from \a e. It's stored in the 'name'
 property.
 */
QString Ui3Reader::getObjectName(const QDomElement& e)
{
    QDomElement n = getObjectProperty(e, QLatin1String("name"));
    if (n.firstChild().toElement().tagName() == QLatin1String("cstring"))
        return n.firstChild().toElement().firstChild().toText().data();
    return QString();
}
Exemplo n.º 3
0
/*! Extracts an object name from \a e. It's stored in the 'name'
 property.
 */
QString Uic::getObjectName( const QDomElement& e )
{
    QDomElement n = getObjectProperty( e, "name" );
    if ( n.firstChild().toElement().tagName() == "cstring" )
	return n.firstChild().toElement().firstChild().toText().data();
    return QString::null;
}
Exemplo n.º 4
0
bool Uic::isFrameworkCodeGenerated( const QDomElement& e ) {
  QDomElement n = getObjectProperty( e, "frameworkCode" );
  if ( n.attribute( "name" ) == "frameworkCode" &&
       !DomTool::elementToVariant( n.firstChild().toElement(), QVariant( TRUE, 0 ) ).toBool() )
    return FALSE;
  return TRUE;
}
Exemplo n.º 5
0
bool Ui3Reader::isFrameworkCodeGenerated(const QDomElement& e)
{
    QDomElement n = getObjectProperty(e, QLatin1String("frameworkCode"));
    if (n.attribute(QLatin1String("name")) == QLatin1String("frameworkCode") &&
            !DomTool::elementToVariant(n.firstChild().toElement(), QVariant(true)).toBool())
        return false;
    return true;
}
Exemplo n.º 6
0
/*! Extracts an layout name from \a e. It's stored in the 'name'
 property of the preceeding sibling (the first child of a QLayoutWidget).
 */
QString Uic::getLayoutName( const QDomElement& e ) {
  QDomElement p = e.parentNode().toElement();
  QString name;

  if ( getClassName( p ) != "QLayoutWidget" )
    name = "Layout";

  QDomElement n = getObjectProperty( p, "name" );
  if ( n.firstChild().toElement().tagName() == "cstring" ) {
    name.prepend( n.firstChild().toElement().firstChild().toText().data() );
    return QStringList::split( "::", name ).last();
  }
  return e.tagName();
}
Exemplo n.º 7
0
/*! Extracts an layout name from \a e. It's stored in the 'name'
 property of the preceding sibling (the first child of a QLayoutWidget).
 */
QString Ui3Reader::getLayoutName(const QDomElement& e)
{
    QDomElement p = e.parentNode().toElement();
    QString name;

    if (getClassName(p) != QLatin1String("QLayoutWidget"))
        name = QLatin1String("Layout");

    QDomElement n = getObjectProperty(p, QLatin1String("name"));
    if (n.firstChild().toElement().tagName() == QLatin1String("cstring")) {
        name.prepend(n.firstChild().toElement().firstChild().toText().data());
        return name.split(QLatin1String("::")).last();
    }
    return e.tagName();
}
Exemplo n.º 8
0
/*!
  Creates a PerlQt attribute declaration for the object given in \a e.

  Children are not traversed recursively.

 */
void Uic::createAttrDecl( const QDomElement& e )
{
    if ( e.tagName() == "vbox" || e.tagName() == "hbox" || e.tagName() == "grid" ) {
	out << indent << registerObject(getLayoutName(e) ) << endl;
    } else {
	QString objClass = getClassName( e );
	if ( objClass.isEmpty() )
	    return;
	QString objName = getObjectName( e );
	if ( objName.isEmpty() )
	    return;
	// ignore QLayoutWidgets
	if ( objClass == "Qt::LayoutWidget" )
	    return;
        // register the object and unify its name
	objName = registerObject( objName );
	out << indent << objName << endl;
        QDomElement n = getObjectProperty( e, "font");
	if ( !n.isNull() )
            out << indent << objName + "_font" << endl;
    }
}