Exemplo n.º 1
0
void StackLayout::doRelayout()
{
	const List<DisplayItem *> &items = getItems();
	DisplayItem *inputField = items.getAt(0);
	int bottom;
	if (isItemVisible(inputField)) {
		setItemSize(inputField, getWidth(), font->getLineHeight());
		bottom = getHeight() - inputField->getHeight();
		setItemPosition(inputField, 0, bottom);
	}
	else {
		bottom = getHeight();
	}
	int i = 0;
	upperItemNr = 0;
	while (bottom > 0 && i + firstLevelVisible < stack->getLength()) {
		upperItemNr++;
		DisplayItem *item;
		if (items.getLength() <= upperItemNr) {
			item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font);
			addItem(item);
		}
		else {
			item = items.getAt(upperItemNr);
			if (item == NULL) {
				item = stack->getAt(i + firstLevelVisible)->getDisplayItem(*font);
				setItemAt(upperItemNr, item);
			}
		}
		if (item) {
			int nw = getNumberWidth(upperItemNr + firstLevelVisible);
			setItemSize(item, getWidth() - nw, -1);
			int h = item->getHeight();
			if (h < font->getLineHeight())
				h = font->getLineHeight();
			bottom -= h;
			int w = item->getWidth();
			if (w < getWidth() - nw)
				setItemPosition(item, getWidth() - w, bottom);
			else
				setItemPosition(item, nw, bottom);
		}
		else {
			bottom -= font->getLineHeight();
		}
		i++;
	}
	while (items.getLength() > upperItemNr + 1) {
		removeItemAt(upperItemNr + 1);
	}
	while (bottom > 0) {
		upperItemNr++;
		bottom -= font->getLineHeight();
	}
	upperItemScanStart = -bottom;
}
Exemplo n.º 2
0
void QDeclarativeAnchorsPrivate::fillChanged()
{
    Q_Q(QDeclarativeAnchors);
    if (!fill || !isItemComplete())
        return;

    if (updatingFill < 2) {
        ++updatingFill;

        qreal horizontalMargin = q->mirrored() ? rightMargin : leftMargin;

        if (fill == item->parentItem()) {                         //child-parent
            setItemPos(QPointF(horizontalMargin, topMargin));
        } else if (fill->parentItem() == item->parentItem()) {   //siblings
            setItemPos(QPointF(fill->x()+horizontalMargin, fill->y()+topMargin));
        }
        QGraphicsItemPrivate *fillPrivate = QGraphicsItemPrivate::get(fill);
        setItemSize(QSizeF(fillPrivate->width()-leftMargin-rightMargin, fillPrivate->height()-topMargin-bottomMargin));

        --updatingFill;
    } else {
        // ### Make this certain :)
        qmlInfo(item) << QDeclarativeAnchors::tr("Possible anchor loop detected on fill.");
    }

}
Exemplo n.º 3
0
void TupFramesTable::setup()
{
    setItemDelegate(new TupFramesTableItemDelegate(this));
    setSelectionBehavior(QAbstractItemView::SelectItems);
    setSelectionMode(QAbstractItemView::SingleSelection);
    
    setHorizontalHeader(k->ruler);

    connect(this, SIGNAL(currentCellChanged(int, int, int, int)), this, SLOT(emitRequestSelectFrame(int, int, int, int)));

    connect(k->ruler, SIGNAL(logicalSectionSelected(int)), this, SLOT(emitFrameSelected(int)));

    // connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(emitFrameSelectionChanged()));

    connect(this, SIGNAL(currentItemChanged(QTableWidgetItem *, QTableWidgetItem *)), this, 
            SLOT(emitFrameSelected(QTableWidgetItem *, QTableWidgetItem *)));

    verticalHeader()->hide();
    
    setItemSize(10, 25);
    
    horizontalHeader()->setResizeMode(QHeaderView::Custom);
    verticalHeader()->setResizeMode(QHeaderView::Custom);

    // horizontalHeader()->setSectionResizeMode(QHeaderView::Custom);
    // verticalHeader()->setSectionResizeMode(QHeaderView::Custom);
}
QgsLayoutItemPropertiesDialog::QgsLayoutItemPropertiesDialog( QWidget *parent, Qt::WindowFlags flags )
  : QDialog( parent, flags )
{
  setupUi( this );

  QgsGui::instance()->enableAutoGeometryRestore( this );

  //make button exclusive
  QButtonGroup *buttonGroup = new QButtonGroup( this );
  buttonGroup->addButton( mUpperLeftRadioButton );
  buttonGroup->addButton( mUpperMiddleRadioButton );
  buttonGroup->addButton( mUpperRightRadioButton );
  buttonGroup->addButton( mMiddleLeftRadioButton );
  buttonGroup->addButton( mMiddleRadioButton );
  buttonGroup->addButton( mMiddleRightRadioButton );
  buttonGroup->addButton( mLowerLeftRadioButton );
  buttonGroup->addButton( mLowerMiddleRadioButton );
  buttonGroup->addButton( mLowerRightRadioButton );
  buttonGroup->setExclusive( true );

  QgsSettings settings;
  double lastWidth = settings.value( QStringLiteral( "LayoutDesigner/lastItemWidth" ), QStringLiteral( "50" ) ).toDouble();
  double lastHeight = settings.value( QStringLiteral( "LayoutDesigner/lastItemHeight" ), QStringLiteral( "50" ) ).toDouble();
  QgsUnitTypes::LayoutUnit lastSizeUnit = settings.enumValue( QStringLiteral( "LayoutDesigner/lastSizeUnit" ), QgsUnitTypes::LayoutMillimeters );
  setItemSize( QgsLayoutSize( lastWidth, lastHeight, lastSizeUnit ) );

  mPosUnitsComboBox->linkToWidget( mXPosSpin );
  mPosUnitsComboBox->linkToWidget( mYPosSpin );
  mSizeUnitsComboBox->linkToWidget( mWidthSpin );
  mSizeUnitsComboBox->linkToWidget( mHeightSpin );

  mLockAspectRatio->setWidthSpinBox( mWidthSpin );
  mLockAspectRatio->setHeightSpinBox( mHeightSpin );
}
Exemplo n.º 5
0
void TodoHandleItem::init()
{
  setItemSize( 30 );

  setBrush( Qt::white );

  QPen pen;
  pen.setBrush( Qt::NoBrush );
  setPen( pen );
}
Exemplo n.º 6
0
void Braces::update()
{
	if ( sizeSpecified() == InnerSize )
	{
		textSize_ = height();
		if (textSize_ < style()->minHeight()) textSize_ = style()->minHeight();
		QSize lb = getSizeOfBrace(style()->leftBrace(), style()->leftBraceFont(), textSize_, &leftBraceOffset_);
		QSize rb = getSizeOfBrace(style()->rightBrace(), style()->rightBraceFont(), textSize_, &rightBraceOffset_);

		while (lb.height() < height() && rb.height() < height())
		{
			textSize_++;
			lb = getSizeOfBrace(style()->leftBrace(), style()->leftBraceFont(), textSize_, &leftBraceOffset_);
			rb = getSizeOfBrace(style()->rightBrace(), style()->rightBraceFont(), textSize_, &rightBraceOffset_);
		}

		contentTop_ = (lb.height() - height() )/ 2;
		contentLeft_ = lb.width();
		rightBraceLeft_ = contentLeft_ + width();

		setItemSize(xOffset() + lb.width()+width()+rb.width(), yOffset() + lb.height());
	}
	else
	{
		textSize_ = height();
		if (textSize_ < style()->minHeight()) textSize_ = style()->minHeight();
		QSize lb = getSizeOfBrace(style()->leftBrace(), style()->leftBraceFont(), textSize_, &leftBraceOffset_);
		QSize rb = getSizeOfBrace(style()->rightBrace(), style()->rightBraceFont(), textSize_, &rightBraceOffset_);

		while(textSize_ >= 0 && (lb.width() + rb.width() > width() || lb.height() + rb.height() > height()))
		{
			textSize_--;
			lb = getSizeOfBrace(style()->leftBrace(), style()->leftBraceFont(), textSize_, &leftBraceOffset_);
			rb = getSizeOfBrace(style()->rightBrace(), style()->rightBraceFont(), textSize_, &rightBraceOffset_);
		}

		contentTop_ = 0;
		contentLeft_ = lb.width();
		rightBraceLeft_ = width() - rb.width();

		setItemSize(xOffset() + width(), yOffset() + height());
	}
}
Exemplo n.º 7
0
void KasBar::rereadMaster()
{
    if ( !master_ )
	return;

    setItemSize( master_->itemSize() );
    setTint( master_->hasTint() );
    setTintColor( master_->tintColor() );
    setTintAmount( master_->tintAmount() );
}
Exemplo n.º 8
0
void ThingTypeBrowser::setupViewOptions()
{
	if (browser_thing_tiles)
	{
		setFont(Drawing::FONT_CONDENSED);
		setItemSize(48);
		setItemViewType(BrowserCanvas::ITEMS_TILES);
	}
	else
	{
		setFont(Drawing::FONT_BOLD);
		setItemSize(80);
		setItemViewType(BrowserCanvas::ITEMS_NORMAL);
	}

	canvas->updateScrollBar();
	canvas->updateLayout();
	canvas->showSelectedItem();
}
Exemplo n.º 9
0
void MainMenuItem::hoverEnterEvent( QGraphicsSceneHoverEvent *event )
{
  Q_UNUSED( event );

  m_timer.stop();

  setItemSize( m_defaultItemSize + 20 );

  m_fanMenu->show();
  emit menuShown();
}
Exemplo n.º 10
0
void TCellView::setup()
{
    setItemDelegate(new TCellViewItemDelegate(this));

    setSelectionBehavior(QAbstractItemView::SelectItems);
    setSelectionMode(QAbstractItemView::SingleSelection);

    verticalHeader()->hide();
    horizontalHeader()->hide();

    setItemSize(18, 18);

    horizontalHeader()->setResizeMode(QHeaderView::Custom);
    verticalHeader()->setResizeMode(QHeaderView::Custom);
}
Exemplo n.º 11
0
void DCellView::setup()
{
	setItemDelegate( new DCellViewItemDelegate(this));
	
	setSelectionBehavior(QAbstractItemView::SelectItems);
	setSelectionMode (QAbstractItemView::SingleSelection);
	
	verticalHeader()->hide();
	horizontalHeader()->hide();
	
	setItemSize( 18, 18 );
	
	horizontalHeader()->setResizeMode(QHeaderView::Custom);
	verticalHeader()->setResizeMode(QHeaderView::Custom);
	
// #if QT_VERSION >= 0x040100
// 	setAutoFillBackground(true);
// #endif
}
Exemplo n.º 12
0
MainMenuItem::MainMenuItem()
  : m_defaultItemSize( 55 )
{
  m_timer.setSingleShot( true );
  connect( &m_timer, SIGNAL( timeout() ), SLOT( hideItems() ) );

  setItemSize( m_defaultItemSize );

  setBrush( QColor( 230,229,229 ) );

  QPen pen;
  pen.setBrush( Qt::NoBrush );
  setPen( pen );

  QGraphicsTextItem *textItem = new QGraphicsTextItem( i18n("Menu"), this );

  int textWidth = textItem->boundingRect().width();
  int textHeight = textItem->boundingRect().height();

  textItem->setPos( - textWidth / 2, - textHeight / 2 );

  m_fanMenu = new FanMenu( this );
  m_fanMenu->setZValue( 50 );
  m_fanMenu->hide();
  m_fanMenu->setStartAngle( 170 );
  m_fanMenu->setEndAngle( 280 );
  m_fanMenu->setRadius( 220 );
  m_fanMenu->setSpacing( 5 );

  FanMenuItem *menuItem = m_fanMenu->addItem( i18n("Clone\ngroup") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( cloneGroup() ) );
  menuItem = m_fanMenu->addItem( i18n("Remove\ngroup") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( removeGroup() ) );
  menuItem = m_fanMenu->addItem( i18n("Add\ngroup") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( addGroup() ) );
  menuItem = m_fanMenu->addItem( i18n("Add\nperson") );
  connect( menuItem, SIGNAL( clicked() ), SIGNAL( addPerson() ) );

  m_fanMenu->setupItems( 90 );

  setAcceptHoverEvents( true );
}
Exemplo n.º 13
0
void MainMenuItem::hideItems()
{
  setItemSize( m_defaultItemSize );

  m_fanMenu->hide();
}
Exemplo n.º 14
0
int process_pat(adapter *ad, unsigned char *b)
{
	int pat_len = 0, i, tid = 0, sid, pid, ver, csid = 0;
	int64_t pid_key = TABLES_ITEM + ((1 + ad->id) << 24) + 0;
	int16_t *pids;
	unsigned char *init_b = b;
	SPid *p;

	if (((b[1] & 0x1F) != 0) || (b[2] != 0))
		return 0;

	if (b[0] != 0x47)
		return 0;

	if ((b[1] & 0x40) && ((b[4] != 0) || (b[5] != 0)))
		return 0;

//	p = find_pid(ad->id, 0);
//	if(!p)
//		return 0;

	tid = b[8] * 256 + b[9];
	ver = b[10] & 0x3E;

	if ((ad->transponder_id == tid) && (ad->pat_ver == ver)) //pat already processed
		return 0;

	if (!(pat_len = assemble_packet(&b, ad, 1)))
		return 0;

	tid = b[3] * 256 + b[4];
	ver = b[5] & 0x3E;
	if (((ad->transponder_id != tid) || (ad->pat_ver != ver)) && (pat_len > 0)
			&& (pat_len < 1500))
	{
		ad->pat_processed = 0;
	}

	if (ad->pat_processed)
		return 0;

	ad->pat_ver = ver;
	ad->transponder_id = tid;
#ifndef DISABLE_DVBAPI
	dvbapi_delete_keys_for_adapter(ad->id);
#endif
//	LOG("tid %d pat_len %d: %02X %02X %02X %02X %02X %02X %02X %02X", tid, pat_len, b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]);
	setItem(pid_key, b, 1, 0);
	setItemSize(pid_key, 8192 * sizeof(*pids));
	pids = (int16_t *) getItem(pid_key);
	memset(pids, 0, 8192 * sizeof(*pids));
	pat_len -= 9;
	b += 8;
	LOGL(2, "PAT Adapter %d, Transponder ID %d, len %d, version %d", ad->id,
			tid, pat_len, ad->pat_ver);
	if (pat_len > 1500)
		return 0;

	for (i = 0; i < pat_len; i += 4)
	{
		sid = b[i] * 256 + b[i + 1];
		pid = (b[i + 2] & 0x1F) * 256 + b[i + 3];
		LOGL(2, "Adapter %d, PMT sid %d (%04X), pid %d", ad->id, sid, sid, pid);
		if (sid > 0)
		{
			pids[pid] = -TYPE_PMT;
			p = find_pid(ad->id, pid);
			if (!p)
				mark_pid_add(-1, ad->id, pid);
			if ((p = find_pid(ad->id, pid)))
			{
				p->type = TYPE_PMT;
				csid = pid;
				if (p->flags == 3)
					p->flags = 1;
			}
		}
	}
	update_pids(ad->id);
	ad->pat_processed = 1;
	return csid;
}