本文整理汇总了C++中setColumnCount函数的典型用法代码示例。如果您正苦于以下问题:C++ setColumnCount函数的具体用法?C++ setColumnCount怎么用?C++ setColumnCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setColumnCount函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTableWidget
VariableListWidget::VariableListWidget(const VariableList & variableList,
QWidget *parent)
: QTableWidget(parent)
{
// constructor of variable table
// make variable table
setRowCount(0);
setColumnCount(0);
setColumnCount(2);
// set headers for columns
QTableWidgetItem *nameItem = new QTableWidgetItem;
QTableWidgetItem *varItem = new QTableWidgetItem;
nameItem->setText(tr("Variable List:"));
varItem->setText(tr("Value:"));
setHorizontalHeaderItem(0,nameItem);
setHorizontalHeaderItem(1,varItem);
setSortingEnabled(false);
// control geometry
setMinimumWidth(300);
horizontalHeader()->setResizeMode(QHeaderView::Stretch);
// fill list
updateList(variableList);
// add connections
connect(this,SIGNAL(itemActivated(QTableWidgetItem*)),
this,SLOT(itemValue(QTableWidgetItem*)));
}
示例2: tr
void Foundlist::runQuery( const QString &query, const QString &category )
{
QStringList labels;
labels
<< tr("Category")
<< tr("ID")
<< tr("Track")
<< tr("Title")
<< tr("Playtime")
#if INCLUDE_EXT
<< tr("Ext")
#endif
;
if( !mQuery.isFinished() )
{
mQuery.stop();
mQuery.wait();
}
clear();
#if INCLUDE_EXT
setColumnCount( 6 );
#else
setColumnCount( 5 );
#endif
setRowCount( 0 );
setHorizontalHeaderLabels( labels );
mQuery.setQuery( query, category );
mQuery.start();
}
示例3: clear
void Table::setMaskType(PolyEdit::Shape type)
{
isReady = false;
clear();
mMask->clear();
switch (type)
{
case PolyEdit::Polygon:
{
setColumnCount(2);
setRowCount(1);
setHorizontalHeaderItem(0, new Cell("X"));
setHorizontalHeaderItem(1, new Cell("Y"));
break;
}
case PolyEdit::Circle:
{
setColumnCount(1);
setRowCount(3);
setHorizontalHeaderItem(0, new Cell("Circle"));
setVerticalHeaderItem(0,new Cell("X"));
setVerticalHeaderItem(1,new Cell("Y"));
setVerticalHeaderItem(2,new Cell("Radius"));
break;
}
case PolyEdit::Box:
{
setColumnCount(1);
setRowCount(4);
setHorizontalHeaderItem(0, new Cell("Box"));
setVerticalHeaderItem(0,new Cell("Left"));
setVerticalHeaderItem(1,new Cell("Top"));
setVerticalHeaderItem(2,new Cell("Width"));
setVerticalHeaderItem(3,new Cell("Height"));
break;
}
case PolyEdit::Invalid:
{
break;
}
}
clearContents();
mType = type;
horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
mMask->setType(type);
isReady = true;
}
示例4: removeRows
void MatrixModel::setDimensions(int rows, int cols) {
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if (rows < d_rows) { // first remove rows (faster)
removeRows(rows, d_rows - rows);
setColumnCount(cols);
} else {
setColumnCount(cols);
if (rows > d_rows)
insertRows(d_rows, rows - d_rows);
}
QApplication::restoreOverrideCursor();
}
示例5: QTreeWidget
CoverageView::CoverageView(bool showCallers, TraceItemView* parentView, QWidget* parent)
: QTreeWidget(parent), TraceItemView(parentView)
{
_showCallers = showCallers;
QStringList labels;
labels << tr( "Incl." );
if (_showCallers) {
setColumnCount(4);
labels << tr( "Distance" ),
labels << tr( "Called" ),
labels << tr( "Caller" );
}
else {
setColumnCount(5);
labels << tr( "Self" ),
labels << tr( "Distance" ),
labels << tr( "Calling" ),
labels << tr( "Callee" );
}
setHeaderLabels(labels);
// forbid scaling icon pixmaps to smaller size
setIconSize(QSize(99,99));
setAllColumnsShowFocus(true);
setRootIsDecorated(false);
setUniformRowHeights(true);
// sorting will be enabled after refresh()
sortByColumn(0, Qt::DescendingOrder);
setMinimumHeight(50);
this->setWhatsThis( whatsThis() );
connect( this,
SIGNAL( currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
SLOT( selectedSlot(QTreeWidgetItem*,QTreeWidgetItem*) ) );
setContextMenuPolicy(Qt::CustomContextMenu);
connect( this,
SIGNAL(customContextMenuRequested(const QPoint &) ),
SLOT(context(const QPoint &)));
connect(this,
SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
SLOT(activatedSlot(QTreeWidgetItem*,int)));
connect(header(), SIGNAL(sectionClicked(int)),
this, SLOT(headerClicked(int)));
}
示例6: setRowCount
void Spreadsheet::clear()
{
setRowCount(0);
setColumnCount(0);
setRowCount(RowCount);
setColumnCount(ColumnCount);
for (int i = 0; i < ColumnCount; ++i) {
QTableWidgetItem *item = new QTableWidgetItem;
item->setText(QString(QChar('A' + i)));
setHorizontalHeaderItem(i, item);
}
setCurrentCell(0, 0);
}
示例7: QStandardItemModel
/**************************** QgsGrassModuleInputModel ****************************/
QgsGrassModuleInputModel::QgsGrassModuleInputModel( QObject *parent )
: QStandardItemModel( parent )
, mWatcher( 0 )
{
setColumnCount( 1 );
reload();
QString locationPath = QgsGrass::getDefaultLocationPath();
mWatcher = new QFileSystemWatcher( this );
mWatcher->addPath( locationPath );
// Watching all dirs in loacation because a dir may become a mapset later, when WIND is created
//QStringList mapsets = QgsGrass::mapsets( QgsGrass::getDefaultGisdbase(), QgsGrass::getDefaultLocation() );
QStringList dirNames = locationDirNames();
foreach ( QString dirName, dirNames )
{
QString dirPath = locationPath + "/" + dirName;
// Watch the dir in any case, WIND mabe created later
mWatcher->addPath( dirPath );
foreach ( QString watchedDir, watchedDirs() )
{
watch( dirPath + "/" + watchedDir );
}
示例8: setColumnCount
CodeViewWidget::CodeViewWidget()
{
setColumnCount(5);
setShowGrid(false);
setContextMenuPolicy(Qt::CustomContextMenu);
setSelectionMode(QAbstractItemView::SingleSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
for (int i = 0; i < columnCount(); i++)
{
horizontalHeader()->setSectionResizeMode(i, QHeaderView::Fixed);
}
verticalHeader()->hide();
horizontalHeader()->hide();
horizontalHeader()->setStretchLastSection(true);
setFont(Settings::Instance().GetDebugFont());
Update();
connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu);
connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged);
connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &QWidget::setFont);
connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] {
m_address = PC;
Update();
});
connect(&Settings::Instance(), &Settings::ThemeChanged, this, &CodeViewWidget::Update);
}
示例9: QTreeWidget
AssignedListView::AssignedListView(QWidget* const parent)
: QTreeWidget(parent)
{
setSelectionMode(QAbstractItemView::SingleSelection);
setWhatsThis(i18n("This is the list of batch tools assigned."));
setIconSize(QSize(ICONSIZE, ICONSIZE));
setDragEnabled(true);
setAcceptDrops(true);
viewport()->setAcceptDrops(true);
setDropIndicatorShown(true);
setContextMenuPolicy(Qt::CustomContextMenu);
setSortingEnabled(false);
setAllColumnsShowFocus(true);
setRootIsDecorated(false);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setColumnCount(2);
setHeaderHidden(true);
header()->setSectionResizeMode(QHeaderView::ResizeToContents);
connect(this, SIGNAL(itemSelectionChanged()),
this, SLOT(slotSelectionChanged()));
connect(this, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(slotContextMenu()));
}
示例10: QWidget
ObjectTableWidget::ObjectTableWidget(unsigned button_conf, bool conf_exclusion, QWidget *parent): QWidget(parent)
{
setupUi(this);
connect(move_down_tb, SIGNAL(clicked(bool)), this, SLOT(moveRows(void)));
connect(move_up_tb, SIGNAL(clicked(bool)), this, SLOT(moveRows(void)));
connect(move_first_tb, SIGNAL(clicked(bool)), this, SLOT(moveRows(void)));
connect(move_last_tb, SIGNAL(clicked(bool)), this, SLOT(moveRows(void)));
connect(add_tb, SIGNAL(clicked(bool)), this, SLOT(addRow(void)));
connect(remove_tb, SIGNAL(clicked(bool)), this, SLOT(removeRow(void)));
connect(edit_tb, SIGNAL(clicked(bool)), this, SLOT(editRow(void)));
connect(update_tb, SIGNAL(clicked(bool)), this, SLOT(updateRow(void)));
connect(remove_all_tb, SIGNAL(clicked(bool)), this, SLOT(removeRows(void)));
connect(table_tbw, SIGNAL(cellClicked(int,int)), this, SLOT(setButtonsEnabled(void)));
connect(table_tbw, SIGNAL(cellActivated(int,int)), this, SLOT(setButtonsEnabled(void)));
connect(table_tbw, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(editRow(void)));
connect(table_tbw, SIGNAL(itemSelectionChanged(void)), this, SLOT(setButtonsEnabled(void)));
connect(table_tbw, SIGNAL(itemSelectionChanged(void)), this, SLOT(emitRowSelected(void)));
this->conf_exclusion=conf_exclusion;
setButtonConfiguration(button_conf);
setColumnCount(1);
add_tb->setToolTip(add_tb->toolTip() + QString(" (%1)").arg(add_tb->shortcut().toString()));
remove_tb->setToolTip(remove_tb->toolTip() + QString(" (%1)").arg(remove_tb->shortcut().toString()));
remove_all_tb->setToolTip(remove_all_tb->toolTip() + QString(" (%1)").arg(remove_all_tb->shortcut().toString()));
update_tb->setToolTip(update_tb->toolTip() + QString(" (%1)").arg(update_tb->shortcut().toString()));
edit_tb->setToolTip(edit_tb->toolTip() + QString(" (%1)").arg(edit_tb->shortcut().toString()));
move_last_tb->setToolTip(move_last_tb->toolTip() + QString(" (%1)").arg(move_last_tb->shortcut().toString()));
move_first_tb->setToolTip(move_first_tb->toolTip() + QString(" (%1)").arg(move_first_tb->shortcut().toString()));
move_up_tb->setToolTip(move_up_tb->toolTip() + QString(" (%1)").arg(move_up_tb->shortcut().toString()));
move_down_tb->setToolTip(move_down_tb->toolTip() + QString(" (%1)").arg(move_down_tb->shortcut().toString()));
}
示例11: KviTalTableWidget
FileTransferWidget::FileTransferWidget(QWidget * pParent)
: KviTalTableWidget(pParent)
{
//hide the header
verticalHeader()->hide();
//hide cells grids
setShowGrid(false);
//disable cell content editing
setEditTriggers(QAbstractItemView::NoEditTriggers);
//select one row at once
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::SingleSelection);
//prepare columns
setColumnCount(3);
QStringList colHeaders;
colHeaders << __tr2qs_ctx("Type", "filetransferwindow")
<< __tr2qs_ctx("Information", "filetransferwindow")
<< __tr2qs_ctx("Progress", "filetransferwindow");
setHorizontalHeaderLabels(colHeaders);
//default column widths
setColumnWidth(0, FILETRANSFERW_CELLSIZE);
horizontalHeader()->setSectionResizeMode(0, QHeaderView::Fixed);
horizontalHeader()->setSectionResizeMode(1, QHeaderView::Interactive);
setColumnWidth(1, 500);
horizontalHeader()->setStretchLastSection(true);
//focus policy
setFocusPolicy(Qt::NoFocus);
viewport()->setFocusPolicy(Qt::NoFocus);
}
示例12: QTreeWidget
ProgressTree2::ProgressTree2(QWidget *parent) :
QTreeWidget(parent)
{
this->autoExpandNodes = false;
setColumnCount(5);
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(timerTimeout()));
timer->start(1000);
this->monitoredJobLastChanged = 0;
setColumnWidth(0, 500);
setColumnWidth(1, 100);
setColumnWidth(2, 100);
setColumnWidth(3, 200);
setColumnWidth(4, 100);
header()->setStretchLastSection(false);
QStringList hls;
hls.append(QObject::tr("Task / Step"));
hls.append(QObject::tr("Elapsed time"));
hls.append(QObject::tr("Remaining time"));
hls.append(QObject::tr("Progress"));
hls.append(QObject::tr(""));
setHeaderLabels(hls);
}
示例13: QTableWidget
AdvancedSettings::AdvancedSettings(QWidget *parent)
: QTableWidget(parent)
{
// column
setColumnCount(COL_COUNT);
QStringList header = {tr("Setting"), tr("Value", "Value set for this setting")};
setHorizontalHeaderLabels(header);
// row
setRowCount(ROW_COUNT);
verticalHeader()->setVisible(false);
// etc.
setAlternatingRowColors(true);
setSelectionMode(QAbstractItemView::NoSelection);
setEditTriggers(QAbstractItemView::NoEditTriggers);
// Signals
connect(&spinBoxCache, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateCacheSpinSuffix);
connect(&comboBoxInterface, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &AdvancedSettings::updateInterfaceAddressCombo);
connect(&spinBoxSaveResumeDataInterval, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged)
, this, &AdvancedSettings::updateSaveResumeDataIntervalSuffix);
// Load settings
loadAdvancedSettings();
resizeColumnToContents(0);
horizontalHeader()->setStretchLastSection(true);
}
示例14: setColumnCount
void CrosswordGrid::setPuzzle( AcrossLitePuzzle* puzzle )
{
m_puzzle = puzzle;
m_focusOrientation = FocusHorizontal;
setColumnCount( m_puzzle->nColumns() );
setRowCount( m_puzzle->nRows() );
int colWidth = 20;
int rowHeight = 20;
for( int row = 0; row < rowCount(); row++ )
{
for( int col = 0; col < columnCount(); col++ )
{
CrosswordCell* cell = new CrosswordCell();
cell->setSolution( m_puzzle->solutionCell( col, row ) );
cell->setShowCorrectness( false );
cell->setGuess( m_puzzle->diagramCell( col, row ) );
cell->setNumber( m_puzzle->cellNumber( col, row ) );
cell->showNumber( true );
colWidth = cell->sizeHint().width();
rowHeight = cell->sizeHint().height();
setItem( row, col, cell );
}
}
for( int col = 0; col < columnCount(); col++ )
setColumnWidth( col, colWidth );
for( int row = 0; row < rowCount(); row++ )
setColumnWidth( row, rowHeight );
}
示例15: setColumnCount
MgEventsView::MgEventsView(QWidget * parent):QTableWidget(parent)
{
setColumnCount(3);
QStringList labels;
labels<<"Type"<<"Name"<<"Event";
setHorizontalHeaderLabels(labels);
}