void GraphicsGridLayoutObject::addLayoutItem(QGraphicsLayoutItem *item) { //use attached properties if (GridLayoutAttached *obj = attachedProperties.value(item)) { int row = obj->row(); int column = obj->column(); int rowSpan = obj->rowSpan(); int columnSpan = obj->columnSpan(); Qt::Alignment alignment = obj->alignment(); if (row == -1 || column == -1) { qWarning() << "Must set row and column for an item in a grid layout"; return; } if (obj->rowSpacing() != -1) setRowSpacing(row, obj->rowSpacing()); if (obj->columnSpacing() != -1) setColumnSpacing(column, obj->columnSpacing()); if (obj->rowStretchFactor() != -1) setRowStretchFactor(row, obj->rowStretchFactor()); if (obj->columnStretchFactor() != -1) setColumnStretchFactor(column, obj->columnStretchFactor()); if (obj->rowPreferredHeight() != -1) setRowPreferredHeight(row, obj->rowPreferredHeight()); if (obj->rowMaximumHeight() != -1) setRowMaximumHeight(row, obj->rowMaximumHeight()); if (obj->rowMinimumHeight() != -1) setRowMinimumHeight(row, obj->rowMinimumHeight()); if (obj->rowFixedHeight() != -1) setRowFixedHeight(row, obj->rowFixedHeight()); if (obj->columnPreferredWidth() != -1) setColumnPreferredWidth(row, obj->columnPreferredWidth()); if (obj->columnMaximumWidth() != -1) setColumnMaximumWidth(row, obj->columnMaximumWidth()); if (obj->columnMinimumWidth() != -1) setColumnMinimumWidth(row, obj->columnMinimumWidth()); if (obj->columnFixedWidth() != -1) setColumnFixedWidth(row, obj->columnFixedWidth()); addItem(item, row, column, rowSpan, columnSpan); if (alignment != -1) setAlignment(item, alignment); QObject::connect(obj, SIGNAL(alignmentChanged(QGraphicsLayoutItem*, Qt::Alignment)), this, SLOT(updateAlignment(QGraphicsLayoutItem*, Qt::Alignment))); }
UINodeServerSelector::UINodeServerSelector (IFrontend *frontend, int rows) : Super(frontend, 1, rows) { _headlineFont = getFont(HUGE_FONT); _headlineHeight = _headlineFont->getCharHeight(); setBackgroundColor(backgroundColor); setSize(0.8f, 0.6f); setScrollingEnabled(true); setPageVisible(false); setAlignment(NODE_ALIGN_CENTER | NODE_ALIGN_MIDDLE); setId("server-selector"); setFont(HUGE_FONT); setRowHeight(getFontHeight() / static_cast<float>(_frontend->getHeight())); _mouseWheelScrollAmount = _rowHeight * _frontend->getHeight() * 5; Vector4Set(colorWhite, _fontColor); reset(); setRowSpacing(2); _entryOffsetY = _headlineHeight; _colWidth = _size.x; setAutoColsRows(); }