int main( int argc, char **argv )
{
    QApplication app( argc, argv );

    QFile xmlFile( argc == 2 ? argv[1] : "fnord.xml" );
    QXmlInputSource source( &xmlFile );

    QXmlSimpleReader reader;

    QGrid * container = new QGrid( 3 );

    QListView * nameSpace = new QListView( container, "table_namespace" );
    StructureParser * handler = new StructureParser( nameSpace );
    reader.setContentHandler( handler );
    reader.parse( source );

    QListView * namespacePrefix = new QListView( container,
                                                 "table_namespace_prefix" );
    handler->setListView( namespacePrefix );
    reader.setFeature( "http://xml.org/sax/features/namespace-prefixes",
                       TRUE );
    source.reset();
    reader.parse( source );

    QListView * prefix = new QListView( container, "table_prefix");
    handler->setListView( prefix );
    reader.setFeature( "http://xml.org/sax/features/namespaces", FALSE );
    source.reset();
    reader.parse( source );

    // namespace label
    (void) new QLabel(
             "Default:\n"
             "http://xml.org/sax/features/namespaces: TRUE\n"
             "http://xml.org/sax/features/namespace-prefixes: FALSE\n",
             container );

    // namespace prefix label
    (void) new QLabel(
             "\n"
             "http://xml.org/sax/features/namespaces: TRUE\n"
             "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
             container );

    // prefix label
    (void) new QLabel(
             "\n"
             "http://xml.org/sax/features/namespaces: FALSE\n"
             "http://xml.org/sax/features/namespace-prefixes: TRUE\n",
             container );


    app.setMainWidget( container );
    container->show();
    return app.exec();
}
示例#2
0
int main (int argc, char ** argv)
{
    KApplication::disableAutoDcopRegistration();
    KCmdLineArgs::init(argc,argv,"kobordertest", 0, 0, 0, 0);
    KApplication app;

    KoZoomHandler* zh = new KoZoomHandler();

    QGrid* grid = new QGrid(2, Qt::Horizontal, 0L); // 2 columns
    {
        // First square
        MyWidget* w = new MyWidget(zh, grid);
        w->m_leftBorder.setPenWidth( 6 );
        w->m_leftBorder.color = Qt::red;
        w->m_rightBorder.setPenWidth( 9 );
        w->m_rightBorder.color = Qt::red;
        w->m_topBorder.setPenWidth( 11 );
        w->m_topBorder.color = Qt::blue;
        w->m_bottomBorder.setPenWidth( 13 );
        w->m_bottomBorder.color = Qt::green;
    }
    {
        // Second square, with opposite (odd/even-wise) widths
        MyWidget* w = new MyWidget(zh, grid);
        w->m_leftBorder.setPenWidth( 7 );
        w->m_leftBorder.color = Qt::red;
        w->m_rightBorder.setPenWidth( 8 );
        w->m_rightBorder.color = Qt::red;
        w->m_topBorder.setPenWidth( 10 );
        w->m_topBorder.color = Qt::blue;
        w->m_bottomBorder.setPenWidth( 12 );
        w->m_bottomBorder.color = Qt::green;
    }
    {
        // Third square, with double borders
        MyWidget* w2 = new MyWidget(zh, grid);
        w2->m_leftBorder.setPenWidth( 2 );
        w2->m_leftBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_rightBorder.setPenWidth( 6 );
        w2->m_rightBorder.color = Qt::red;
        w2->m_rightBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_topBorder.setPenWidth( 4 );
        w2->m_topBorder.color = Qt::blue;
        w2->m_topBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_bottomBorder.setPenWidth( 6 );
        w2->m_bottomBorder.color = Qt::green;
        w2->m_bottomBorder.setStyle( KoBorder::DOUBLE_LINE );
    }
    {
        // Fourth square, with double borders
        MyWidget* w2 = new MyWidget(zh, grid);
        w2->m_leftBorder.setPenWidth( 1 );
        w2->m_leftBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_rightBorder.setPenWidth( 5 );
        w2->m_rightBorder.color = Qt::red;
        w2->m_rightBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_topBorder.setPenWidth( 3 );
        w2->m_topBorder.color = Qt::blue;
        w2->m_topBorder.setStyle( KoBorder::DOUBLE_LINE );
        w2->m_bottomBorder.setPenWidth( 5 );
        w2->m_bottomBorder.color = Qt::green;
        w2->m_bottomBorder.setStyle( KoBorder::DOUBLE_LINE );
    }
    grid->show();
    return app.exec();
}