本文整理汇总了C++中widget::Ptr::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::connect方法的具体用法?C++ Ptr::connect怎么用?C++ Ptr::connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类widget::Ptr
的用法示例。
在下文中一共展示了Ptr::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addWidget
void Grid::addWidget(const Widget::Ptr& widget, unsigned int row, unsigned int col,
const Borders& borders, Alignment alignment)
{
// If the widget hasn't already been added then add it now
if (std::find(getWidgets().begin(), getWidgets().end(), widget) == getWidgets().end())
add(widget);
// Create the row if it did not exist yet
if (m_gridWidgets.size() < row + 1)
{
m_gridWidgets.resize(row + 1);
m_objBorders.resize(row + 1);
m_objAlignment.resize(row + 1);
}
// Create the column if it did not exist yet
if (m_gridWidgets[row].size() < col + 1)
{
m_gridWidgets[row].resize(col + 1, nullptr);
m_objBorders[row].resize(col + 1);
m_objAlignment[row].resize(col + 1);
}
// If this is a new row then reserve some space for it
if (m_rowHeight.size() < row + 1)
m_rowHeight.resize(row + 1, 0);
// If this is the first row to have so many columns then reserve some space for it
if (m_columnWidth.size() < col + 1)
m_columnWidth.resize(col + 1, 0);
// Add the widget to the grid
m_gridWidgets[row][col] = widget;
m_objBorders[row][col] = borders;
m_objAlignment[row][col] = alignment;
// Update the widgets
updateWidgets();
// Automatically update the widgets when their size changes
m_connectedCallbacks[widget] = widget->connect("SizeChanged", &Grid::updateWidgets, this);
}