QT_BEGIN_NAMESPACE

/*!
    \class Q3HBox
    \brief The Q3HBox widget provides horizontal geometry management
    for its child widgets.

    \compat

    All the horizontal box's child widgets will be placed alongside
    each other and sized according to their sizeHint()s.

    Use setMargin() to add space around the edges, and use
    setSpacing() to add space between the widgets. Use
    setStretchFactor() if you want the widgets to be different sizes
    in proportion to one another. (See \link layout.html
    Layouts\endlink for more information on stretch factors.)

    \img qhbox-m.png Q3HBox

    \sa QHBoxLayout Q3VBox Q3Grid
*/


/*!
    Constructs an hbox widget with parent \a parent, called \a name.
    The parent, name and widget flags, \a f, are passed to the Q3Frame
    constructor.
*/
Q3HBox::Q3HBox(QWidget *parent, const char *name, Qt::WindowFlags f)
    :Q3Frame(parent, name, f)
{
    (new QHBoxLayout(this, frameWidth(), frameWidth(), name))->setAutoAdd(true);
}
Example #2
0
void FOListView::rename_item(QListViewItem *i)
{
  if (le_==0)
  {
    le_ = new RenameLineEdit(this);
    connect(le_, SIGNAL(lost_focus()), this, SLOT(rename()));
  }

  rename_item_=(FOListViewItem *)i;

  qDebug("in rename_item(QListViewItem *i)");
  int header_height = header()->height();
  QRect r = itemRect(i);
  r.setTop( r.top() + frameWidth() + 1 + header_height);
  r.setBottom( r.bottom() + frameWidth() + header_height);
  r.setLeft( r.left() + cal_step_size(i));
  //r.setWidth( current( 0 ) );
  ensureItemVisible(i);
  horizontalScrollBar()->setValue(0);
  horizontalScrollBar()->setEnabled(false);
  verticalScrollBar()->setEnabled(false);
  le_->setGeometry( r );
  QString fn=i->text(0);
  if (fn[fn.length()-1]=='/')
    fn.remove(fn.length()-1,1);
  le_->setText(fn);
  le_->selectAll();
  le_->show();
  le_->setFocus();
}
Example #3
0
int MessageEditor::textHeight(int ALines) const
{
	if (ALines > 0)
		return fontMetrics().height()*ALines + (frameWidth() + qRound(document()->documentMargin()))*2;
	else
		return qRound(document()->documentLayout()->documentSize().height()) + frameWidth()*2;
}
Example #4
0
void MiniMap::updateMap()
{
	QRectF maxRect;
	maxRect.setLeft( sceneRect().x() < visibleRect.x() ? sceneRect().x() : visibleRect.x() );
	maxRect.setTop( sceneRect().y() < visibleRect.y() ? sceneRect().y() : visibleRect.y() );
	maxRect.setRight( (sceneRect().x() + sceneRect().width()) > (visibleRect.x()+visibleRect.width())
			? (sceneRect().x() + sceneRect().width()) : (visibleRect.x()+visibleRect.width()));
	maxRect.setBottom( (sceneRect().y() + sceneRect().height()) > (visibleRect.y()+visibleRect.height())
			? (sceneRect().y() + sceneRect().height()) : (visibleRect.y()+visibleRect.height()));

	qreal xScale = (width() - 2*frameWidth() - 2*margin) / maxRect.width();
	qreal yScale = (height() - 2*frameWidth() - 2*margin) / maxRect.height();
	qreal scale = xScale < yScale ? xScale : yScale;

	qreal rectX = margin + (visibleRect.x() - maxRect.x())*scale;
	qreal rectY = margin + (visibleRect.y() - maxRect.y())*scale;

	if (xScale < yScale) rectY += (height() - 2*(frameWidth() + margin) - maxRect.height()*scale) / 2;
	else rectX += (width() - 2*(frameWidth() + margin) - maxRect.width()*scale) / 2;

	// Below we subtract 0.5 and take the ceiling. This rounds the number. We further subtract 1 in order to compensate
	// for the pen width of the drawn rectangle.
	drawnRect.setRect(rectX, rectY, ceil(visibleRect.width()*scale - 1.5), ceil(visibleRect.height()*scale - 1.5));

	setTransform(QTransform::fromScale(scale,scale).translate(margin, margin));

	viewport()->update();
}
Example #5
0
VectorWidget::VectorWidget(DataContainer * d, QWidget *parent) :
        LabWidget(d, parent),
        phasor1(new QwtPlotCurve("Phasor 1")),
        phasor2(new QwtPlotCurve("Phasor 2")),
        sumVector(new QwtPlotCurve("Resultant Vector")),
        plotLine(new QwtPlotCurve("Plot Line")),
        phasor1_pen(new QPen(Qt::red)),
        phasor2_pen(new QPen(Qt::green)),
        sumVector_pen(new QPen(Qt::black)),
        plotLine_pen(new QPen(Qt::blue)),
        xScale(new QwtPlotScaleItem(QwtScaleDraw::BottomScale, frameWidth() / 2.0)),
        yScale(new QwtPlotScaleItem(QwtScaleDraw::LeftScale, frameWidth() / 2.0))
{    
    xScale->attach(this);
    enableAxis(QwtPlot::xBottom, false);

    yScale->attach(this);
    enableAxis(QwtPlot::yLeft, false);

    //-------------------------------
    // Modify line widths, 1 is normal
    phasor1_pen->setWidthF(1.5);
    phasor2_pen->setWidthF(1.5);
    sumVector_pen->setWidthF(1.5);
    plotLine_pen->setWidthF(1.5);
    //-------------------------------

    phasor1->setPen(*phasor1_pen);
    phasor2->setPen(*phasor2_pen);
    sumVector->setPen(*sumVector_pen);
    plotLine->setPen(*plotLine_pen);
}
Example #6
0
/*!
    \reimp
*/
QSize QWidgetStack::minimumSizeHint() const
{
    constPolish();

    QSize size( 0, 0 );

    QIntDictIterator<QWidget> it( *dict );
    QWidget *w;

    while ( (w = it.current()) != 0 ) {
	++it;
	QSize sh = w->minimumSizeHint();
	if ( w->sizePolicy().horData() == QSizePolicy::Ignored )
	    sh.rwidth() = 0;
	if ( w->sizePolicy().verData() == QSizePolicy::Ignored )
	    sh.rheight() = 0;
#ifndef QT_NO_LAYOUT
	size = size.expandedTo( sh ).expandedTo( w->minimumSize() );
#endif
    }
    if ( size.isNull() )
	size = QSize( 64, 32 );
    size += QSize( 2*frameWidth(), 2*frameWidth() );
    return size;
}
Example #7
0
QRect SparqlTextEdit::lineNumbersRect() const
{
    QRect frame = frameRect();
    frame.adjust(frameWidth(), frameWidth(), -frameWidth(), -frameWidth());
    frame.setWidth(qMin(frame.width(), leftMargin));
    return frame;
}
Example #8
0
void TabSwitcher::showSwitcher()
{
    setModel(new AppModel(this, m_tabs));

    if (!model()->rowCount())
        return;

    QStyleOptionViewItem option;

    int w = 0;
    int h = 0;
    int maxApp = 15;

    for(int i = 0; i < model()->rowCount(); ++i){
        QSize siz = itemDelegate()->sizeHint(option, model()->index(i, 0));
        w = qMax(w, siz.width());
        h += siz.height();
        if (i > maxApp)
            break;
    }


    w += 2 * frameWidth();
    h += 2 * frameWidth();
    resize(w, h);

    QPoint pos = m_tabs->mapToGlobal(m_tabs->geometry().topLeft());
    move(pos.x()+m_tabs->geometry().width()/2 - w / 2, pos.y()+m_tabs->geometry().height()/2 - h / 2);

    show();
}
Example #9
0
/** must be called after EffectKeeper activation! */
void CrChainView::activate()
{
  Q_ASSERT(m_threadEffector == 0);
  m_threadEffector = m_effectKeeper->threadEffector();
  //assert(m_threadEffector->getProcessorChainSize() == static_cast<int>(m_effectKeeper->effectList().count()));

  m_chainButtonArray = new CrChainButton*[m_threadEffector->getProcessorChainSize()];

  //create chainButtons
  int maxWidth = 0, maxHeight = 2*frameWidth();
  for(QListIterator<CrEffectGui*> effectIterator(m_effectKeeper->effectList()) ; effectIterator.hasNext();){
    CrChainButton* chainButton = new CrChainButton(effectIterator.next(), this);
    m_chainButtonList.append(chainButton);
    //compute sizeHint
    const QSize buttonSize = chainButton->sizeHint();
    if(buttonSize.width() > maxWidth){
      maxWidth = buttonSize.width();
    }
    maxHeight += buttonSize.height();
  }
  maxWidth += 2*frameWidth();
  m_sizeHint.setWidth(maxWidth);
  m_sizeHint.setHeight(maxHeight);
  syncChainButtons();
}
Example #10
0
void SimpleText::drawFrame(QPainter* painter) const
      {
      if (!textStyle().hasFrame())
            return;

      QColor color(frameColor());
      if (!visible())
            color = Qt::gray;
      else if (selected())
            color = Qt::blue;
      if (frameWidth().val() != 0.0) {
            QPen pen(color, frameWidth().val() * spatium());
            painter->setPen(pen);
            }
      else
            painter->setPen(Qt::NoPen);
      QColor bg(backgroundColor());
      painter->setBrush(bg.alpha() ? QBrush(bg) : Qt::NoBrush);
      if (circle())
            painter->drawArc(frame, 0, 5760);
      else {
            int r2 = frameRound() * lrint((frame.width() / frame.height()));
            if (r2 > 99)
                  r2 = 99;
            painter->drawRoundRect(frame, frameRound(), r2);
            }
      }
Example #11
0
//! Return a size hint.
QSize QwtLegend::sizeHint() const
{
    QSize hint = d_data->view->contentsWidget->sizeHint();
    hint += QSize( 2 * frameWidth(), 2 * frameWidth() );

    return hint;
}
Example #12
0
K3b::FillStatusDisplay::FillStatusDisplay( K3b::Doc* doc, QWidget *parent )
    : QFrame(parent)
{
    d = new Private;
    d->doc = doc;

    d->displayWidget = new K3b::FillStatusDisplayWidget( doc, this );
    d->buttonMenu = new QToolButton( this );
    d->buttonMenu->setIcon( QIcon::fromTheme( "configure" ) );
    d->buttonMenu->setAutoRaise( true );
    d->buttonMenu->setToolTip( i18n( "Set medium size" ) );
    connect( d->buttonMenu, SIGNAL(clicked()), this, SLOT(slotMenuButtonClicked()) );

    QHBoxLayout* layout = new QHBoxLayout( this );
    layout->setSpacing( frameWidth() );
    layout->setContentsMargins( frameWidth(), frameWidth(), frameWidth(), frameWidth() );
    layout->addWidget( d->displayWidget, 1, Qt::AlignVCenter );
    layout->addWidget( d->buttonMenu );

    setupPopupMenu();

    connect( d->doc, SIGNAL(changed()), this, SLOT(slotDocChanged()) );
    connect( &d->updateTimer, SIGNAL(timeout()), this, SLOT(slotUpdateDisplay()) );
    connect( k3bappcore->mediaCache(), SIGNAL(mediumChanged(K3b::Device::Device*)),
             this, SLOT(slotMediumChanged(K3b::Device::Device*)) );

    slotLoadUserDefaults();
}
Example #13
0
void KALedMeter::resizeEvent( QResizeEvent *e )
{
    Q3Frame::resizeEvent( e );
    int w = ( width() - frameWidth() - 2 ) / mCount * mCount;
    w += frameWidth() + 2;
    setFrameRect( QRect( 0, 0, w, height() ) );
}
Example #14
0
QgsDateTimeEdit::QgsDateTimeEdit( QWidget *parent )
  : QDateTimeEdit( parent )
{
  mClearButton = new QToolButton( this );
  mClearButton->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mIconClearText.svg" ) ) );
  mClearButton->setCursor( Qt::ArrowCursor );
  mClearButton->setStyleSheet( QStringLiteral( "position: absolute; border: none; padding: 0px;" ) );
  mClearButton->hide();
  connect( mClearButton, &QAbstractButton::clicked, this, &QgsDateTimeEdit::clear );

  mNullLabel = new QLineEdit( QgsApplication::nullRepresentation(), this );
  mNullLabel->setReadOnly( true );
  mNullLabel->setStyleSheet( QStringLiteral( "position: absolute; border: none; font-style: italic; color: grey;" ) );
  mNullLabel->hide();

  setStyleSheet( QStringLiteral( ".QWidget, QLineEdit, QToolButton { padding-right: %1px; }" ).arg( mClearButton->sizeHint().width() + spinButtonWidth() + frameWidth() + 1 ) );

  QSize msz = minimumSizeHint();
  setMinimumSize( std::max( msz.width(), mClearButton->sizeHint().height() + frameWidth() * 2 + 2 ),
                  std::max( msz.height(), mClearButton->sizeHint().height() + frameWidth() * 2 + 2 ) );

  connect( this, &QDateTimeEdit::dateTimeChanged, this, &QgsDateTimeEdit::changed );

  // init with current time so mIsNull is properly initialized
  QDateTimeEdit::setDateTime( QDateTime::currentDateTime() );
  setMinimumEditDateTime();
}
QSize MyCompletionBox::sizeHint() const
{
    int h = count()?(sizeHintForRow(0)):0;
    h=qMin(count()*h,10*h) + 2*frameWidth();
    int w = sizeHintForColumn(0) + verticalScrollBar()->width() + 2*frameWidth();
    return QSize(w, h);
}
Example #16
0
void TracksView::keepVisible(const QModelIndex &previous, const QModelIndex &current)
      {
      // update scroll bars to show the cell hidden by the frozen table view if it gets focus
      const int hInvisibleGap = visualRect(current).topLeft().x() - frozenVTableWidth();
      const int vInvisibleGap = visualRect(current).topLeft().y() - frozenHTableHeight();

      if (current.column() != previous.column() && current.column() >= _frozenColCount
                  && hInvisibleGap < 0) {
            const int newValue = horizontalScrollBar()->value() + hInvisibleGap;
            horizontalScrollBar()->setValue(newValue);
            }
      if (current.row() != previous.row() && current.row() >= _frozenRowCount
                  && vInvisibleGap < 0) {
            const int newValue = verticalScrollBar()->value() + vInvisibleGap;
            verticalScrollBar()->setValue(newValue);
            }

      // update scroll bars to show the cell hidden by the borders of main table view
      const int hInvisibleGap2 = width() - verticalHeader()->width() - 4 * frameWidth()
                  - ((verticalScrollBar()->isHidden()) ? 0 : verticalScrollBar()->width())
                  - visualRect(current).bottomRight().x();
      const int vInvisibleGap2 = height() - horizontalHeader()->height() - 4 * frameWidth()
                  - ((horizontalScrollBar()->isHidden()) ? 0 : horizontalScrollBar()->height())
                  - visualRect(current).bottomRight().y();

      if (current.column() != previous.column() && hInvisibleGap2 < 0) {
            const int newValue = horizontalScrollBar()->value() - hInvisibleGap2;
            horizontalScrollBar()->setValue(newValue);
            }
      if (current.row() != previous.row() && vInvisibleGap2 < 0) {
            const int newValue = verticalScrollBar()->value() - vInvisibleGap2;
            verticalScrollBar()->setValue(newValue);
            }
      }
Example #17
0
void SnapshotCanvas::adjustMaximumSize()
{
    QRectF sr = sceneRect();

    int width = sr.width() + frameWidth() * 2;
    int height = sr.height() + frameWidth() * 2;

    if (minimumWidth() > width) {
        width = minimumWidth();
    }

    if (minimumHeight() > height) {
        height = minimumHeight();
    }

    int scrollBarExtent = style()->pixelMetric(QStyle::PM_ScrollBarExtent);

    if (verticalScrollBar()->isVisible()) {
        width += scrollBarExtent + frameWidth() * 2;
    }

    if (horizontalScrollBar()->isVisible()) {
        height += scrollBarExtent + frameWidth() * 2;
    }

    setMaximumSize(width, height);
}
Example #18
0
QgsDateTimeEdit::QgsDateTimeEdit( QWidget *parent )
    : QDateTimeEdit( parent )
    , mAllowNull( true )
    , mIsNull( true )
{
    mClearButton = new QToolButton( this );
    mClearButton->setIcon( QgsApplication::getThemeIcon( "/mIconClear.svg" ) );
    mClearButton->setCursor( Qt::ArrowCursor );
    mClearButton->setStyleSheet( "position: absolute; border: none; padding: 0px;" );
    mClearButton->hide();
    connect( mClearButton, SIGNAL( clicked() ), this, SLOT( clear() ) );

    mNullLabel = new QLineEdit( QSettings().value( "qgis/nullValue", "NULL" ).toString(), this );
    mNullLabel->setReadOnly( true );
    mNullLabel->setStyleSheet( "position: absolute; border: none; font-style: italic; color: grey;" );
    mNullLabel->hide();

    setStyleSheet( QString( "padding-right: %1px;" ).arg( mClearButton->sizeHint().width() + spinButtonWidth() + frameWidth() + 1 ) );

    QSize msz = minimumSizeHint();
    setMinimumSize( qMax( msz.width(), mClearButton->sizeHint().height() + frameWidth() * 2 + 2 ),
                    qMax( msz.height(), mClearButton->sizeHint().height() + frameWidth() * 2 + 2 ) );

    connect( this, SIGNAL( dateTimeChanged( QDateTime ) ), this, SLOT( changed( QDateTime ) ) );

    // init with current time so mIsNull is properly initialized
    QDateTimeEdit::setDateTime( QDateTime::currentDateTime() );
}
Example #19
0
static void
clientAutoMaximize (Client * c, int full_w, int full_h)
{
    if (FLAG_TEST (c->flags, CLIENT_FLAG_FULLSCREEN) ||
        !FLAG_TEST (c->xfwm_flags, XFWM_FLAG_HAS_BORDER))
    {
        /*
         * Fullscreen or undecorated windows should not be
         * automatically maximized...
         */
        return;
    }

    if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ) &&
        (frameWidth (c) > full_w))
    {
        TRACE ("The application \"%s\" has requested a window width "
               "(%u) larger than the actual width available in the workspace (%u), "
               "the window will be maximized horizontally.", c->name, frameWidth (c), full_w);
        FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_HORIZ);
    }

    if (!FLAG_TEST (c->flags, CLIENT_FLAG_MAXIMIZED_VERT) &&
        (frameHeight (c) > full_h))
    {
        TRACE ("The application \"%s\" has requested a window height "
               "(%u) larger than the actual height available in the workspace (%u), "
               "the window will be maximized vertically.", c->name, frameHeight (c), full_h);
        FLAG_SET (c->flags, CLIENT_FLAG_MAXIMIZED_VERT);
    }
}
Example #20
0
/*!
  \brief Return a minimum size hint
*/
QSize QwtPlot::minimumSizeHint() const
{
    QSize hint = d_layout->minimumSizeHint(this);
    hint += QSize(2 * frameWidth(), 2 * frameWidth());

    return hint;
}
Example #21
0
void DirContent::new_dir()
{
  cout << "DirContentView new_dir" << endl;
  char *fn="new_dir";

  if(fn)
  {
    DirContentViewItem *i=new DirContentViewItem(this,fn);
    //ensureItemVisible(item);
    //FOListView::rename_item(item);
    le_ = new RenameLineEdit(this);

  int header_height = header()->height();
  header_height =0;
  QRect r = itemRect(i);
  r.setTop( r.top() + frameWidth() + 1 + header_height + 20);
  r.setBottom( r.bottom() + frameWidth() + header_height + 20);
  r.setLeft( r.left() + cal_step_size(i));

  le_->setGeometry( r );
    le_->setText("abc");
    le_->setFocus();
    le_->show();

  }
}
Example #22
0
//***************************************************************************
void Kwave::AboutContributor::updateLayout()
{
    if (layout()) delete layout();

    int row = 0;
    if (!m_text[0] || !m_text[0]->text().isEmpty()) { ++row; }
    if (!m_text[1] || !m_text[1]->text().isEmpty()) { ++row; }
    if (!m_text[2] || !m_text[2]->text().isEmpty()) { ++row; }
    if (!m_text[3] || !m_text[3]->text().isEmpty()) { ++row; }

    QGridLayout *gbox;
    if (row == 0) {
	gbox = new QGridLayout(this);
	Q_ASSERT(gbox);
	if (!gbox) return;
	gbox->setSpacing(1);
	for (int i=0; i<4; ++i)
	    if (m_text[i]) m_text[i]->hide();
    } else {
	if (m_text[0] && m_text[0]->text().isEmpty()) {
	    gbox = new QGridLayout(this);
	    Q_ASSERT(gbox);
	    if (!gbox) return;
	    gbox->setMargin(frameWidth()+1);
	    gbox->setSpacing(2);
	} else {
	    gbox = new QGridLayout(this);
	    Q_ASSERT(gbox);
	    if (!gbox) return;
	    gbox->setMargin(frameWidth()+1);
	    gbox->setSpacing(2);
	    gbox->addItem(new QSpacerItem(20, 0), 0, 0);
	    gbox->setColumnStretch(1, 10);
	}

	for (int i = 0, r = 0; i < 4; ++i) {
	    if (!m_text[i]) continue;

	    if (i != 3) {
		m_text[i]->setFixedHeight(fontMetrics().lineSpacing());
	    }

	    if (!m_text[i]->text().isEmpty()) {
		if (!i) {
		    gbox->addWidget(m_text[i], r, 0, 1, 2, Qt::AlignLeft);
		} else {
		    gbox->addWidget(m_text[i], r, 1, Qt::AlignLeft );
		}
		m_text[i]->show();
		++r;
	    } else {
		m_text[i]->hide();
	    }
	}
    }

    gbox->activate();
    setMinimumSize(sizeHint());
}
Example #23
0
/*!
  Draw the border of the plot canvas

  \param painter Painter
  \sa setBorderRadius()
*/
void QwtPlotCanvas::drawBorder( QPainter *painter )
{
    if ( d_data->borderRadius > 0 )
    {
        if ( frameWidth() > 0 )
        {
            QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), 
                d_data->borderRadius, d_data->borderRadius,
                palette(), frameWidth(), frameStyle() );
        }
    }
    else
    {
#if QT_VERSION >= 0x040500
#if QT_VERSION < 0x050000
        QStyleOptionFrameV3 opt;
#else
        QStyleOptionFrame opt;
#endif
        opt.init(this);

        int frameShape  = frameStyle() & QFrame::Shape_Mask;
        int frameShadow = frameStyle() & QFrame::Shadow_Mask;

        opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape );
#if 0
        opt.rect = frameRect();
#endif

        switch (frameShape) 
        {
            case QFrame::Box:
            case QFrame::HLine:
            case QFrame::VLine:
            case QFrame::StyledPanel:
            case QFrame::Panel:
            {
                opt.lineWidth = lineWidth();
                opt.midLineWidth = midLineWidth();
                break; 
            }
            default: 
            {
                opt.lineWidth = frameWidth();
                break;
            }
        }
    
        if ( frameShadow == Sunken )
            opt.state |= QStyle::State_Sunken;
        else if ( frameShadow == Raised )
            opt.state |= QStyle::State_Raised;

        style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, this);
#else
        drawFrame( painter );
#endif
    }
}
Example #24
0
QHBox::QHBox( bool horizontal, QWidget *parent , const char *name, WFlags f )
    :QFrame( parent, name, f )
{
    lay = new QBoxLayout( this,
		       horizontal ? QBoxLayout::LeftToRight : QBoxLayout::Down,
			  frameWidth(), frameWidth(), name );
    lay->setAutoAdd( TRUE );
}
QSize PFSViewWidgetArea::sizeHint() const
{
  QSize sz = widget()->sizeHint();
//  printf( "widget: %d %d\n", sz.width(), sz.height() );
  sz += QSize( frameWidth()*2, frameWidth()*2 );  
//  printf( "area: %d %d\n", sz.width(), sz.height() );
  return sz;
}
Example #26
0
void
KPopupFrame::setMainWidget(QWidget* m)
{
  main=m;
  if(main!=0)
    {
      resize(main->width()+2*frameWidth(), main->height()+2*frameWidth());
    }
}
Example #27
0
void
KPopupFrame::resizeEvent(QResizeEvent*)
{
  if(main!=0)
    {
      main->setGeometry(frameWidth(), frameWidth(),
          width()-2*frameWidth(), height()-2*frameWidth());
    }
}
Example #28
0
/*!
  \return The preferred height, for the width w.
  \param width Width
*/
int QwtLegend::heightForWidth( int width ) const
{
    width -= 2 * frameWidth();

    int h = d_data->view->contentsWidget->heightForWidth( width );
    if ( h >= 0 )
        h += 2 * frameWidth();

    return h;
}
Example #29
0
 virtual QSize sizeHint() const 
 {
    QSize sh(2*frameWidth()+1,2*frameWidth()+1);
    if (verticalScrollBar())
       sh.setWidth(sh.width() + verticalScrollBar()->sizeHint().width());
    if (horizontalScrollBar())
       sh.setHeight(sh.height() + horizontalScrollBar()->sizeHint().height());
    if (widget())
       sh += widgetResizable() ? widget()->sizeHint() : widget()->size();
    return sh;
 }
Example #30
0
void PanIconWidget::setImage(const QImage *fullsize) {
	m_image = new QImage(fullsize->scaled(180,120,Qt::KeepAspectRatio));
	m_width           = m_image->width();
	m_height          = m_image->height();
	m_orgWidth        = fullsize->width();
	m_orgHeight       = fullsize->height();
	setFixedSize(m_width+2*frameWidth(), m_height+2*frameWidth());
// 	m_rect = QRect(width()/2-m_width/2, height()/2-m_height/2, m_width, m_height);
	//KPopupFrame::setMainWidget = resize
	resize(m_width+2*frameWidth(), m_height+2*frameWidth());
// 	qDebug("wanted w=%d, h=%d",m_width+2*frameWidth(), m_height+2*frameWidth());
}