Пример #1
0
void pTabbedWorkspace::setTabShape( QTabBar::Shape s )
{
	if ( tabShape() != s )
	{
		// get sizepolicy
		QSizePolicy sp = mTabBar->sizePolicy();
		
		// update view layout
		switch ( s )
		{
		case QTabBar::RoundedNorth:
		case QTabBar::TriangularNorth:
			mTabLayout->setDirection( QBoxLayout::LeftToRight );
			mLayout->setDirection( QBoxLayout::TopToBottom );
			if ( tabShape() != QTabBar::RoundedSouth && tabShape() != QTabBar::TriangularSouth )
				sp.transpose();
			break;
		case QTabBar::RoundedSouth:
		case QTabBar::TriangularSouth:
			mTabLayout->setDirection( QBoxLayout::LeftToRight );
			mLayout->setDirection( QBoxLayout::BottomToTop );
			if ( tabShape() != QTabBar::RoundedNorth && tabShape() != QTabBar::TriangularNorth )
				sp.transpose();
			break;
		case QTabBar::RoundedWest:
		case QTabBar::TriangularWest:
			mTabLayout->setDirection( QBoxLayout::BottomToTop );
			mLayout->setDirection( QBoxLayout::LeftToRight );
			if ( tabShape() != QTabBar::RoundedEast && tabShape() != QTabBar::TriangularEast )
				sp.transpose();
			break;
		case QTabBar::RoundedEast:
		case QTabBar::TriangularEast:
			mTabLayout->setDirection( QBoxLayout::TopToBottom );
			mLayout->setDirection( QBoxLayout::RightToLeft );
			if ( tabShape() != QTabBar::RoundedWest && tabShape() != QTabBar::TriangularWest )
				sp.transpose();
			break;
		}
		
		// set size policy
		mTabBar->setSizePolicy( sp );
		
		// apply tab shape
		mTabBar->setShape( s );
		
		// update corners
		updateCorners();
		
		// emit shape changed
		emit tabShapeChanged( s );
	}
}
Пример #2
0
/*!
  \brief Set the wheel's orientation.
  \param o Orientation. Allowed values are
           Qt::Horizontal and Qt::Vertical.
   Defaults to Qt::Horizontal.
  \sa QwtAbstractSlider::orientation()
*/
void QwtWheel::setOrientation(Qt::Orientation o)
{
    if ( orientation() == o )
        return;

#if QT_VERSION >= 0x040000
    if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) )
#else
    if ( !testWState( WState_OwnSizePolicy ) ) 
#endif
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);

#if QT_VERSION >= 0x040000
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
#else
        clearWState( WState_OwnSizePolicy );
#endif
    }

    QwtAbstractSlider::setOrientation(o);
    layoutWheel();
}
Пример #3
0
/*!
  \brief Set the orientation.
  \param o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical.

  If the new orientation and the old scale position are an invalid combination,
  the scale position will be set to QwtSlider::NoScale.
  \sa QwtAbstractSlider::orientation()
*/
void QwtSlider::setOrientation( Qt::Orientation o )
{
    if ( o == orientation() )
        return;

    if ( o == Qt::Horizontal )
    {
        if ( d_data->scalePos == LeftScale 
            || d_data->scalePos == RightScale )
        {
            d_data->scalePos = NoScale;
        }
    }
    else // if (o == Qt::Vertical)
    {
        if ( d_data->scalePos == BottomScale || 
            d_data->scalePos == TopScale )
        {
            d_data->scalePos = NoScale;
        }
    }

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    QwtAbstractSlider::setOrientation( o );
    layoutSlider( true );
}
/*!
  \brief Set the thermometer orientation and the scale position.

  The scale position NoScale disables the scale.
  \param o orientation. Possible values are Qt::Horizontal and Qt::Vertical.
         The default value is Qt::Vertical.
  \param s Position of the scale.
         The default value is NoScale.

  A valid combination of scale position and orientation is enforced:
  - a horizontal thermometer can have the scale positions TopScale,
    BottomScale or NoScale;
  - a vertical thermometer can have the scale positions LeftScale,
    RightScale or NoScale;
  - an invalid scale position will default to NoScale.

  \sa QwtThermo::setScalePosition()
*/
void QwtThermo::setOrientation(Qt::Orientation o, ScalePos s)
{
    if ( o == d_data->orientation && s == d_data->scalePos )
        return;

    switch(o)
    {
    case Qt::Horizontal:
    {
        if ((s == NoScale) || (s == BottomScale) || (s == TopScale))
            d_data->scalePos = s;
        else
            d_data->scalePos = NoScale;
        break;
    }
    case Qt::Vertical:
    {
        if ((s == NoScale) || (s == LeftScale) || (s == RightScale))
            d_data->scalePos = s;
        else
            d_data->scalePos = NoScale;
        break;
    }
    }

    if ( o != d_data->orientation )
    {
#if QT_VERSION >= 0x040000
        if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) )
#else
        if ( !testWState( WState_OwnSizePolicy ) )
#endif
        {
            QSizePolicy sp = sizePolicy();
            sp.transpose();
            setSizePolicy(sp);

#if QT_VERSION >= 0x040000
            setAttribute(Qt::WA_WState_OwnSizePolicy, false);
#else
            clearWState( WState_OwnSizePolicy );
#endif
        }
    }

    d_data->orientation = o;
    layoutThermo();
}
Пример #5
0
void QProgressBar::setOrientation(Qt::Orientation orientation)
{
    Q_D(QProgressBar);
    if (d->orientation == orientation)
        return;
    d->orientation = orientation;
    if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
    }
    d->resetLayoutItemMargins();
    update();
    updateGeometry();
}
Пример #6
0
/*!
    \property QAbstractSlider::orientation
    \brief the orientation of the slider

    The orientation must be \l Qt::Vertical (the default) or \l
    Qt::Horizontal.
*/
void QAbstractSlider::setOrientation(Qt::Orientation orientation)
{
    Q_D(QAbstractSlider);
    if (d->orientation == orientation)
        return;

    d->orientation = orientation;
    if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
    }
    update();
    updateGeometry();
}
Пример #7
0
/*!
  \brief Set the wheel's orientation.
  \param o Orientation. Allowed values are
           Qt::Horizontal and Qt::Vertical.
   Defaults to Qt::Horizontal.
  \sa QwtAbstractSlider::orientation()
*/
void QwtWheel::setOrientation( Qt::Orientation o )
{
    if ( orientation() == o )
        return;

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    QwtAbstractSlider::setOrientation( o );
    update();
}
Пример #8
0
/*!
  \brief Set the wheel's orientation.

  The default orientation is Qt::Horizontal.

  \param orientation Qt::Horizontal or Qt::Vertical.
  \sa orientation()
*/
void QwtWheel::setOrientation( Qt::Orientation orientation )
{
    if ( d_data->orientation == orientation )
        return;

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    d_data->orientation = orientation;
    update();
}
Пример #9
0
/*!
  \brief Set the orientation.
  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.

  \sa orientation(), scalePosition()
*/
void QwtThermo::setOrientation( Qt::Orientation orientation )
{
    if ( orientation == d_data->orientation )
        return;

    d_data->orientation = orientation;

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    layoutThermo( true );
}
Пример #10
0
void QSplitter::setOrientation(Qt::Orientation orientation)
{
    Q_D(QSplitter);
    if (d->orient == orientation)
        return;

    if (!testAttribute(Qt::WA_WState_OwnSizePolicy)) {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
    }

    d->orient = orientation;

    for (int i = 0; i < d->list.size(); ++i) {
        QSplitterLayoutStruct *s = d->list.at(i);
        s->handle->setOrientation(orientation);
    }
    d->recalc(isVisible());
}
Пример #11
0
/*!
  \brief Set the orientation.
  \param orientation Allowed values are Qt::Horizontal and Qt::Vertical.

  \sa orientation(), scalePosition()
*/
void QwtSlider::setOrientation( Qt::Orientation orientation )
{
    if ( orientation == d_data->orientation )
        return;

    d_data->orientation = orientation;

    scaleDraw()->setAlignment( 
        qwtScaleDrawAlignment( orientation, d_data->scalePosition ) );

    if ( !testAttribute( Qt::WA_WState_OwnSizePolicy ) )
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy( sp );

        setAttribute( Qt::WA_WState_OwnSizePolicy, false );
    }

    if ( testAttribute( Qt::WA_WState_Polished ) )
        layoutSlider( true );
}
Пример #12
0
/*!
  \brief Set the orientation.
  \param o Orientation. Allowed values are Qt::Horizontal and Qt::Vertical.
  
  If the new orientation and the old scale position are an invalid combination,
  the scale position will be set to QwtSlider::NoScale.
  \sa QwtAbstractSlider::orientation()
*/
void QwtSlider::setOrientation(Qt::Orientation o) 
{
    if ( o == orientation() )
        return;

    if (o == Qt::Horizontal)
    {
        if ((d_data->scalePos == LeftScale) || (d_data->scalePos == RightScale))
            d_data->scalePos = NoScale;
    }
    else // if (o == Qt::Vertical)
    {
        if ((d_data->scalePos == BottomScale) || (d_data->scalePos == TopScale))
            d_data->scalePos = NoScale;
    }

#if QT_VERSION >= 0x040000
    if ( !testAttribute(Qt::WA_WState_OwnSizePolicy) )
#else
    if ( !testWState( WState_OwnSizePolicy ) ) 
#endif
    {
        QSizePolicy sp = sizePolicy();
        sp.transpose();
        setSizePolicy(sp);

#if QT_VERSION >= 0x040000
        setAttribute(Qt::WA_WState_OwnSizePolicy, false);
#else
        clearWState( WState_OwnSizePolicy );
#endif
    }

    QwtAbstractSlider::setOrientation(o);
    layoutSlider();
}
Пример #13
0
int SizePolicy::transpose(lua_State * L) 
{
    QSizePolicy* lhs = QtValue<QSizePolicy>::check( L, 1 );
	lhs->transpose();
	return 0;
}