本文整理汇总了C++中QComboBox::setFocusPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setFocusPolicy方法的具体用法?C++ QComboBox::setFocusPolicy怎么用?C++ QComboBox::setFocusPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setFocusPolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
DofDialog::DofDialog(Graph* graph, Shape* shape, QWidget *parent) :
QDialog(parent),
m_graph(graph),
m_shape(shape)
{
m_ui.setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
connect(shape, SIGNAL(destroyed()), this, SLOT(close()));
connect(this, SIGNAL(dofActivated(int)), shape, SLOT(setModeEditDof(int)));
m_comboBoxes.clear();
for (int i = 0; i < m_shape->dofCount(); ++i)
{
QComboBox* comboBox = new QComboBox(this);
comboBox->addItem("None");
DOF* dof = m_shape->dof(i);
Attribute* currentAttribute = (dof == 0 ? 0 : dof->attribute());
for (size_t j = 0; j < m_graph->getSizeAttributes(); ++j)
{
Attribute* attribute = m_graph->getAttribute(j);
comboBox->addItem(attribute->name());
if (currentAttribute == attribute)
{
comboBox->setCurrentIndex(comboBox->count()-1);
}
}
m_ui.formLayout->addRow(m_shape->dofLabel(i), comboBox);
m_comboBoxes.insert(i, comboBox);
connect(comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(attributeSelected(int)));
comboBox->setFocusPolicy(Qt::StrongFocus);
comboBox->installEventFilter(this);
}
m_ui.colorLabel->setText(m_shape->colorDOF()->label());
m_ui.opacityLabel->setText(m_shape->opacityDOF()->label());
m_colorChooser = new ColorChooser(m_ui.colorChooser, m_shape->colorDOF(), &m_shape->colorYValues(), ColorChooser::HueColor);
m_ui.colorChooser->layout()->addWidget(m_colorChooser);
connect(m_colorChooser, SIGNAL(activated()), this, SLOT(colorActivated()));
m_opacityChooser = new ColorChooser(m_ui.opacityChooser, m_shape->opacityDOF(), &m_shape->opacityYValues(), ColorChooser::OpacityColor);
m_ui.opacityChooser->layout()->addWidget(m_opacityChooser);
connect(m_opacityChooser , SIGNAL(activated()), this, SLOT(opacityActivated()));
}
示例2: QComboBox
QWidget *ScanFoldersDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{
if (index.column() != ScanFoldersModel::DOWNLOAD) return 0;
QComboBox* editor = new QComboBox(parent);
editor->setFocusPolicy(Qt::StrongFocus);
editor->addItem(tr("Watch Folder"));
editor->addItem(tr("Default Folder"));
editor->addItem(tr("Browse..."));
if (index.data(Qt::UserRole).toInt() == ScanFoldersModel::CUSTOM_LOCATION) {
editor->insertSeparator(3);
editor->addItem(index.data().toString());
}
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(comboboxIndexChanged(int)));
return editor;
}
示例3: QComboBox
QWidget *PropListDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &, const QModelIndex &index) const
{
if (index.column() != PRIORITY) return 0;
if (m_properties) {
BitTorrent::TorrentHandle *const torrent = m_properties->getCurrentTorrent();
if (!torrent || !torrent->hasMetadata() || torrent->isSeed())
return 0;
}
if (index.data().toInt() <= 0) {
// IGNORED or MIXED
return 0;
}
QComboBox* editor = new QComboBox(parent);
editor->setFocusPolicy(Qt::StrongFocus);
editor->addItem(tr("Normal", "Normal (priority)"));
editor->addItem(tr("High", "High (priority)"));
editor->addItem(tr("Maximum", "Maximum (priority)"));
return editor;
}