Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void Component::initDIPSymbol ( const QStringList &  pins,
int  width 
) [protected, inherited]

Creates the DIP symbol:

  • constructs rectangular shape
  • puts on text labels in appropriate positions from QStringList pins

Definition at line 455 of file component.cpp.

References CNItem::addDisplayText(), Item::font(), Item::setSize(), and Component::updateAttachedPositioning().

Referenced by ECSubcircuit::doneSCInit(), PICComponent::initPackage(), Multiplexer::initPins(), Demultiplexer::initPins(), DAC::initPins(), ADC::initPins(), and ECSubcircuit::setNumExtCon().

{
    const int numPins = pins.size();
    const int numSide = numPins/2 + numPins%2;

    setSize( -(_width-(_width%16))/2, -(numSide+1)*8, _width, (numSide+1)*16, true );

    QWidget tmpWidget;
    QPainter p(&tmpWidget);

    p.setFont( font() );

    // Pins along left
    for ( int i=0; i<numSide; i++ )
    {
        if ( !pins[i].isEmpty() )
        {
            const QString text = *pins.at(i);

            const int _top = (i+1)*16-8 + offsetY();
            const int _width = width()/2 - 6;
            const int _left = 6 + offsetX();
            const int _height = 16;

            QRect br = p.boundingRect( QRect( _left, _top, _width, _height ), Qt::AlignLeft, text );
            addDisplayText( text, br, text );
        }
    }
    // Pins along right
    for ( int i=numSide; i<numPins; i++ )
    {
        if ( !pins[i].isEmpty() )
        {
            const QString text = *pins.at(i);

            const int _top = (2*numSide-i)*16 - 8 + offsetY();
            const int _width = width()/2 - 6;
            const int _left = (width()/2) + offsetX();
            const int _height = 16;

            QRect br = p.boundingRect( QRect( _left, _top, _width, _height ), Qt::AlignRight, text );
            addDisplayText( text, br, text );
        }
    }

    updateAttachedPositioning();
}


Generated by  Doxygen 1.6.0   Back to index