本文整理汇总了C++中QTableWidget::setFocusPolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidget::setFocusPolicy方法的具体用法?C++ QTableWidget::setFocusPolicy怎么用?C++ QTableWidget::setFocusPolicy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTableWidget
的用法示例。
在下文中一共展示了QTableWidget::setFocusPolicy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: standartStuffForAllTables
void MainWindow::standartStuffForAllTables(QTableWidget& table)
{
table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
table.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
table.setEditTriggers(QAbstractItemView::NoEditTriggers);
table.verticalHeader()->hide();
table.horizontalHeader()->hide();
table.setEditTriggers(QAbstractItemView::NoEditTriggers);
table.setSelectionMode(QAbstractItemView::NoSelection);
table.setFocusPolicy(Qt::NoFocus);
}
示例2: getTableWidget
TableView::TableView(QObject * parent):VisualNode(parent)
{
_realcount=0;
this->_widget = new visual::ui::QTableWidgetCopy(_invisibleParent);
QTableWidget* table = getTableWidget();
if(0!=table){
table->setEditTriggers(QTableWidget::NoEditTriggers);
table->setFocusPolicy(Qt::NoFocus);
}
//setHeader("Col1;Col2;Col3");
}
示例3: QWidget
KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent)
{
this->defaultText = defaultText;
enableSignal = false;
// Two-column tab layout
QHBoxLayout * pageKeysLayout = new QHBoxLayout(this);
pageKeysLayout->setSpacing(0);
pageKeysLayout->setContentsMargins(0, 0, 0, 0);
// Table for category list
QVBoxLayout * catListContainer = new QVBoxLayout();
catListContainer->setContentsMargins(10, 10, 10, 10);
catList = new QListWidget();
catList->setFixedWidth(180);
catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }");
catList->setFocusPolicy(Qt::NoFocus);
connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int)));
catListContainer->addWidget(catList);
pageKeysLayout->addLayout(catListContainer);
// Reset all binds button
if (!resetButtonText.isEmpty())
{
QPushButton * btnResetAll = new QPushButton(resetButtonText);
catListContainer->addWidget(btnResetAll);
btnResetAll->setFixedHeight(40);
catListContainer->setStretch(1, 0);
catListContainer->setSpacing(10);
connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds()));
}
// Container for pages of key bindings
QWidget * bindingsPagesContainer = new QWidget();
QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer);
// Scroll area for key bindings
QScrollArea * scrollArea = new QScrollArea();
scrollArea->setContentsMargins(0, 0, 0, 0);
scrollArea->setWidget(bindingsPagesContainer);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scrollArea->setWidgetResizable(true);
scrollArea->setFrameShape(QFrame::NoFrame);
scrollArea->setStyleSheet("background: #130F2A;");
// Add key binding pages to bindings tab
pageKeysLayout->addWidget(scrollArea);
pageKeysLayout->setStretch(1, 1);
// Custom help text
QLabel * helpLabel = new QLabel();
helpLabel->setText(helpText);
helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;");
helpLabel->setFixedHeight(24);
rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter);
// Category list and bind table row heights
const int rowHeight = 20;
QSize catSize, headerSize;
catSize.setHeight(36);
headerSize.setHeight(24);
// Category list header
QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category"));
catListHeader->setSizeHint(headerSize);
catListHeader->setFlags(Qt::NoItemFlags);
catListHeader->setForeground(QBrush(QColor("#130F2A")));
catListHeader->setBackground(QBrush(QColor("#F6CB1C")));
catListHeader->setTextAlignment(Qt::AlignCenter);
catList->addItem(catListHeader);
// Populate
bindingsPages = new QHBoxLayout();
bindingsPages->setContentsMargins(0, 0, 0, 0);
rightLayout->addLayout(bindingsPages);
QWidget * curPage = NULL;
QVBoxLayout * curLayout = NULL;
QTableWidget * curTable = NULL;
bool bFirstPage = true;
selectedBindTable = NULL;
bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>();
bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>();
for (int i = 0; i < BINDS_NUMBER; i++)
{
if (cbinds[i].category != NULL)
{
// Add stretch at end of previous layout
if (curLayout != NULL) curLayout->insertStretch(-1, 1);
// Category list item
QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category));
catItem->setSizeHint(catSize);
catList->addItem(catItem);
// Create new page
curPage = new QWidget();
curLayout = new QVBoxLayout(curPage);
curLayout->setSpacing(2);
bindingsPages->addWidget(curPage);
if (!bFirstPage) curPage->setVisible(false);
//.........这里部分代码省略.........