Example #1
0
    bool BoxLayout::setFixedSize(std::size_t index, float size)
    {
        if (index >= m_layoutWidgets.size())
            return false;

        m_widgetsFixedSizes[index] = size;
        updateWidgetPositions();
        return true;
    }
Example #2
0
    bool BoxLayout::setRatio(std::size_t index, float ratio)
    {
        if (index >= m_layoutWidgets.size())
            return false;

        m_widgetsRatio[index] = ratio;
        updateWidgetPositions();
        return true;
    }
Example #3
0
    bool BoxLayout::remove(std::size_t index)
    {
        if (index >= m_layoutWidgets.size())
            return false;

        Container::remove(m_layoutWidgets[index]);
        m_layoutWidgets.erase(m_layoutWidgets.begin() + index);
        m_widgetsRatio.erase(m_widgetsRatio.begin() + index);
        m_widgetsFixedSizes.erase(m_widgetsFixedSizes.begin() + index);
        updateWidgetPositions();
        return true;
    }
Example #4
0
    bool BoxLayout::insert(std::size_t index, const tgui::Widget::Ptr& widget, const sf::String& widgetName)
    {
        Container::add(widget, widgetName);

        if (index > m_layoutWidgets.size())
        {
            m_layoutWidgets.emplace_back(widget);
            m_widgetsRatio.emplace_back(1.f);
            m_widgetsFixedSizes.emplace_back(0.f);
            updateWidgetPositions();
            return false;
        }
        else
        {
            m_layoutWidgets.insert(m_layoutWidgets.begin() + index, widget);
            m_widgetsRatio.insert(m_widgetsRatio.begin() + index, 1.f);
            m_widgetsFixedSizes.insert(m_widgetsFixedSizes.begin() + index, 0.f);
            updateWidgetPositions();
            return true;
        }
    }
FilterHorizontalHeaderView::FilterHorizontalHeaderView(SortMultiFilterProxyModel *model, QTableView *parent):
	QHeaderView(Qt::Horizontal,parent)
{
	//setModel(parent->model());
	_model=model;

	setSectionsMovable(parent->horizontalHeader()->sectionsMovable());
	setSectionsClickable(parent->horizontalHeader()->sectionsClickable());

	insertColumns(0,model->columnCount()-1);

	updateWidgetPositions();

	contextMenu.addAction(&saveAct);
	contextMenu.addAction(&clearAct);
	contextMenu.addSeparator();
	connect(&saveAct,&QAction::triggered,this,&FilterHorizontalHeaderView::savePreset);
	connect(&clearAct,&QAction::triggered,this,&FilterHorizontalHeaderView::clearAllFilters);

	connect(parent->horizontalScrollBar(),SIGNAL(valueChanged(int)),
		this,SLOT(updateWidgetPositions()) );
	connect(this,SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),
		this,SLOT(setSortIndicator(int,Qt::SortOrder)));
	connect(this,SIGNAL(sectionResized(int,int,int)),
		this,SLOT(updateWidgetPositions()));

	connect(model,&QAbstractItemModel::columnsInserted,
		[=](const QModelIndex&,
		int logicalFirst, int logicalLast) {
		insertColumns(logicalFirst,logicalLast);
	});

	timer.setInterval(300);
	timer.setSingleShot(true);
	connect(&timer,SIGNAL(timeout()),this,SLOT(applyFilters()));

	//TODO: add header data update
	//TODO: add sections removal
}
Example #6
0
 void BoxLayout::setFont(const Font& font)
 {
     Panel::setFont(font);
     updateWidgetPositions();
 }
Example #7
0
 void BoxLayout::setSize(const Layout2d& size)
 {
     Panel::setSize(size);
     updateWidgetPositions();
 }