⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cppwriteinitialization.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
            m_output << m_option.indent << varName << "->resize(" << r->elementWidth() << ", " << r->elementHeight() << ");\n";            continue;        } else if (propertyName == QLatin1String("buttonGroupId") && buttonGroupWidget) { // Q3ButtonGroup support            m_output << m_option.indent << m_driver->findOrInsertWidget(buttonGroupWidget) << "->insert("                   << varName << ", " << p->elementNumber() << ");\n";            continue;        } else if (propertyName == QLatin1String("currentRow") // QListWidget::currentRow                    && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QListWidget"))) {            m_delayedOut << m_option.indent << varName << "->setCurrentRow("                       << p->elementNumber() << ");\n";            continue;        } else if (propertyName == QLatin1String("currentIndex") // set currentIndex later                    && (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QComboBox"))                    || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStackedWidget"))                    || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTabWidget"))                    || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox")))) {            m_delayedOut << m_option.indent << varName << "->setCurrentIndex("                       << p->elementNumber() << ");\n";            continue;        } else if (propertyName == QLatin1String("control") // ActiveQt support                    && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) {            // already done ;)            continue;        } else if (propertyName == QLatin1String("database")                    && p->elementStringList()) {            // Sql support            continue;        } else if (propertyName == QLatin1String("frameworkCode")                    && p->kind() == DomProperty::Bool) {            // Sql support            continue;        } else if (propertyName == QLatin1String("orientation")                    && m_uic->customWidgetsInfo()->extends(className, QLatin1String("Line"))) {            // Line support            QString shape = QLatin1String("QFrame::HLine");            if (p->elementEnum() == QLatin1String("Qt::Vertical"))                shape = QLatin1String("QFrame::VLine");            m_output << m_option.indent << varName << "->setFrameShape(" << shape << ");\n";            // QFrame Default is 'Plain'. Make the line 'Sunken' unless otherwise specified            if (!frameShadowEncountered)                m_output << m_option.indent << varName << "->setFrameShadow(QFrame::Sunken);\n";            continue;        } else if ((flags & WritePropertyIgnoreMargin)  && propertyName == QLatin1String("margin")) {            continue;        } else if ((flags & WritePropertyIgnoreSpacing) && propertyName == QLatin1String("spacing")) {            continue;        } else if (propertyName == QLatin1String("leftMargin") && p->kind() == DomProperty::Number) {            leftMargin = p->elementNumber();            continue;        } else if (propertyName == QLatin1String("topMargin") && p->kind() == DomProperty::Number) {            topMargin = p->elementNumber();            continue;        } else if (propertyName == QLatin1String("rightMargin") && p->kind() == DomProperty::Number) {            rightMargin = p->elementNumber();            continue;        } else if (propertyName == QLatin1String("bottomMargin") && p->kind() == DomProperty::Number) {            bottomMargin = p->elementNumber();            continue;        } else if (propertyName == QLatin1String("frameShadow"))            frameShadowEncountered = true;        bool stdset = m_stdsetdef;        if (p->hasAttributeStdset())            stdset = p->attributeStdset();        QString setFunction;        if (stdset) {            setFunction = QLatin1String("->set");            setFunction += propertyName.left(1).toUpper();            setFunction += propertyName.mid(1);            setFunction += QLatin1Char('(');        } else {            setFunction = QLatin1String("->setProperty(\"");            setFunction += propertyName;            setFunction += QLatin1String("\", QVariant(");        }        QString varNewName = varName;        switch (p->kind()) {        case DomProperty::Bool: {            propertyValue = p->elementBool();            break;        }        case DomProperty::Color: {            const DomColor *c = p->elementColor();            propertyValue = QString::fromLatin1("QColor(%1, %2, %3)")                  .arg(c->elementRed())                  .arg(c->elementGreen())                  .arg(c->elementBlue()); }            break;        case DomProperty::Cstring:            if (propertyName == QLatin1String("buddy") && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QLabel"))) {                m_buddies.append(Buddy(varName, p->elementCstring()));            } else {                if (stdset)                    propertyValue = fixString(p->elementCstring(), m_option.indent);                else {                    propertyValue = QLatin1String("QByteArray(");                    propertyValue += fixString(p->elementCstring(), m_option.indent);                    propertyValue += QLatin1Char(')');                }            }            break;        case DomProperty::Cursor:            propertyValue = QString::fromLatin1("QCursor(static_cast<Qt::CursorShape>(%1))")                            .arg(p->elementCursor());            break;        case DomProperty::CursorShape:            if (p->hasAttributeStdset() && !p->attributeStdset())                varNewName += QLatin1String("->viewport()");            propertyValue = QString::fromLatin1("QCursor(Qt::%1)")                            .arg(p->elementCursorShape());            break;        case DomProperty::Enum:            propertyValue = p->elementEnum();            if (!propertyValue.contains(QLatin1String("::"))) {                QString scope  = className;                scope += QLatin1String("::");                propertyValue.prepend(scope);            }            break;        case DomProperty::Set:            propertyValue = p->elementSet();            break;        case DomProperty::Font:            propertyValue = writeFontProperties(p->elementFont());            break;        case DomProperty::IconSet:            propertyValue = pixCall(p);            break;        case DomProperty::Pixmap:            propertyValue = pixCall(p);            break;        case DomProperty::Palette: {            const DomPalette *pal = p->elementPalette();            const QString paletteName = m_driver->unique(QLatin1String("palette"));            m_output << m_option.indent << "QPalette " << paletteName << ";\n";            writeColorGroup(pal->elementActive(), QLatin1String("QPalette::Active"), paletteName);            writeColorGroup(pal->elementInactive(), QLatin1String("QPalette::Inactive"), paletteName);            writeColorGroup(pal->elementDisabled(), QLatin1String("QPalette::Disabled"), paletteName);            propertyValue = paletteName;            break;        }        case DomProperty::Point: {            const DomPoint *po = p->elementPoint();            propertyValue = QString::fromLatin1("QPoint(%1, %2)")                            .arg(po->elementX()).arg(po->elementY());            break;        }        case DomProperty::PointF: {            const DomPointF *pof = p->elementPointF();            propertyValue = QString::fromLatin1("QPointF(%1, %2)")                            .arg(pof->elementX()).arg(pof->elementY());            break;        }        case DomProperty::Rect: {            const DomRect *r = p->elementRect();            propertyValue = QString::fromLatin1("QRect(%1, %2, %3, %4)")                            .arg(r->elementX()).arg(r->elementY())                            .arg(r->elementWidth()).arg(r->elementHeight());            break;        }        case DomProperty::RectF: {            const DomRectF *rf = p->elementRectF();            propertyValue = QString::fromLatin1("QRectF(%1, %2, %3, %4)")                            .arg(rf->elementX()).arg(rf->elementY())                            .arg(rf->elementWidth()).arg(rf->elementHeight());            break;        }        case DomProperty::Locale: {             const DomLocale *locale = p->elementLocale();             propertyValue = QString::fromLatin1("QLocale(QLocale::%1, QLocale::%2)")                             .arg(locale->attributeLanguage()).arg(locale->attributeCountry());            break;        }        case DomProperty::SizePolicy: {            const QString spName = writeSizePolicy( p->elementSizePolicy());            m_output << m_option.indent << spName << QString::fromLatin1(                ".setHeightForWidth(%1->sizePolicy().hasHeightForWidth());\n")                .arg(varName);            propertyValue = spName;            break;        }        case DomProperty::Size: {             const DomSize *s = p->elementSize();              propertyValue = QString::fromLatin1("QSize(%1, %2)")                             .arg(s->elementWidth()).arg(s->elementHeight());            break;        }        case DomProperty::SizeF: {            const DomSizeF *sf = p->elementSizeF();             propertyValue = QString::fromLatin1("QSizeF(%1, %2)")                            .arg(sf->elementWidth()).arg(sf->elementHeight());            break;        }        case DomProperty::String: {            if (propertyName == QLatin1String("objectName")) {                const QString v = p->elementString()->text();                if (v == varName)                    break;                // ### qWarning("Deprecated: the property `objectName' is different from the variable name");            }            if (p->elementString()->hasAttributeNotr()                    && toBool(p->elementString()->attributeNotr())) {                propertyValue = QLatin1String("QString::fromUtf8(");                propertyValue += fixString(p->elementString()->text(), m_option.indent);                propertyValue += QLatin1Char(')');            } else {                propertyValue = trCall(p->elementString());            }            break;        }        case DomProperty::Number:            propertyValue = QString::number(p->elementNumber());            break;        case DomProperty::UInt:            propertyValue = QString::number(p->elementUInt());            propertyValue += QLatin1Char('u');            break;        case DomProperty::LongLong:            propertyValue = QLatin1String("Q_INT64_C(");            propertyValue += QString::number(p->elementLongLong());            propertyValue += QLatin1Char(')');;            break;        case DomProperty::ULongLong:            propertyValue = QLatin1String("Q_UINT64_C(");            propertyValue += QString::number(p->elementULongLong());            propertyValue += QLatin1Char(')');            break;        case DomProperty::Float:            propertyValue = QString::number(p->elementFloat());            break;        case DomProperty::Double:            propertyValue = QString::number(p->elementDouble());            break;        case DomProperty::Char: {            const DomChar *c = p->elementChar();            propertyValue = QString::fromLatin1("QChar(%1)")                            .arg(c->elementUnicode());            break;        }        case DomProperty::Date: {            const DomDate *d = p->elementDate();            propertyValue = QString::fromLatin1("QDate(%1, %2, %3)")                            .arg(d->elementYear())                            .arg(d->elementMonth())                            .arg(d->elementDay());            break;        }        case DomProperty::Time: {            const DomTime *t = p->elementTime();            propertyValue = QString::fromLatin1("QTime(%1, %2, %3)")                            .arg(t->elementHour())                            .arg(t->elementMinute())                            .arg(t->elementSecond());            break;        }        case DomProperty::DateTime: {            const DomDateTime *dt = p->elementDateTime();            propertyValue = QString::fromLatin1("QDateTime(QDate(%1, %2, %3), QTime(%4, %5, %6))")                            .arg(dt->elementYear())                            .arg(dt->elementMonth())                            .arg(dt->elementDay())                            .arg(dt->elementHour())                            .arg(dt->elementMinute())                            .arg(dt->elementSecond());            break;        }        case DomProperty::StringList:            propertyValue = QLatin1String("QStringList()");            if (p->elementStringList()->elementString().size()) {                const QStringList lst = p->elementStringList()->elementString();                for (int i=0; i<lst.size(); ++i) {                    propertyValue += QLatin1String(" << ");                    propertyValue +=fixString(lst.at(i), m_option.indent);                }            }            break;        case DomProperty::Url: {            const DomUrl* u = p->elementUrl();            propertyValue = QString::fromLatin1("QUrl(%1)")                            .arg(fixString(u->elementString()->text(), m_option.indent));            break;        }        case DomProperty::Unknown:            break;        }        if (propertyValue.size()) {            QTextStream *o = &m_output;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -