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); }
void UIListView::setColumnVisible( int col, bool show ) { if ( columnVisible( col ) == show ) return ; ColumnData * data = m_data.find( col ); if ( show == false ) { data->name = columnText( col ); data->size = columnWidth( col ); data->mode = columnWidthMode( col ); setColumnText ( col, "" ); setColumnWidth( col, 0 ); setColumnWidthMode( col, QListView::Manual ); header()->setResizeEnabled( false, col ); } else { setColumnText ( col, data->name ); setColumnWidth( col, data->size ); setColumnWidthMode( col, data->mode ); header()->setResizeEnabled( true, col ); } }
VariablesListView::VariablesListView(QWidget *parent, const char *name) : KListView(parent, name), m_variables(0), m_isReadOnly(false) { setAllColumnsShowFocus(true); setRootIsDecorated(true); setSorting(-1); addColumn(tr2i18n("Name")); addColumn(tr2i18n("Value")); addColumn(tr2i18n("Type")); setColumnWidthMode(NameCol, Manual); setColumnWidthMode(ValueCol, Manual); setColumnWidthMode(TypeCol, Manual); setColumnWidth(NameCol, 150); setColumnWidth(ValueCol, 150); setColumnWidth(TypeCol, 150); connect(this, SIGNAL(expanded(QListViewItem*)), this, SLOT(slotItemExpanded(QListViewItem*))); connect(this, SIGNAL(collapsed(QListViewItem*)), this, SLOT(slotItemCollapsed(QListViewItem*))); connect(this, SIGNAL(itemRenamed(QListViewItem*, int, const QString&)), this, SLOT(slotItemRenamed(QListViewItem*, int, const QString&))); connect(this, SIGNAL(doubleClicked(QListViewItem *, const QPoint &, int )), this, SLOT(slotDoubleClick( QListViewItem *, const QPoint &, int ))); //connect(m_menu, SIGNAL(activated(int)), this, SLOT(slotCopyVarToClipboard(int))); connect(this, SIGNAL(contextMenuRequested(QListViewItem *, const QPoint& , int)), this, SLOT(slotContextMenuRequested(QListViewItem *, const QPoint &, int))); }
void KNMusicTreeViewBase::resetHeaderState() { //Hide all column first. for(int i=Name+1; i<MusicDataCount; i++) { setColumnHidden(i, true); } //Show the default columns. setColumnHidden(Time, false); setColumnHidden(Artist, false); setColumnHidden(Album, false); setColumnHidden(Genre, false); setColumnHidden(Rating, false); //Reorder the columns. moveToFirst(Rating); moveToFirst(Genre); moveToFirst(Album); moveToFirst(Artist); moveToFirst(Time); moveToFirst(Name); //Set the default width. setColumnWidth(Genre, 81); setColumnWidth(Album, 126); setColumnWidth(Artist, 126); setColumnWidth(Time, 60); setColumnWidth(Name, 200); }
CMSCoffeeUserTableView::CMSCoffeeUserTableView(CMSCoffeeUserModel* model, QWidget *parent) : QTableView(parent), userModel_(model) { setModel(userModel_); setAlternatingRowColors(true); setMinimumWidth(450); setMinimumHeight(400); setColumnWidth(0, 300); setColumnWidth(1, 50); setColumnWidth(2, 90); setColumnWidth(3, 90); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) horizontalHeader()->setResizeMode(0, QHeaderView::Stretch); horizontalHeader()->setResizeMode(1, QHeaderView::Fixed); horizontalHeader()->setResizeMode(2, QHeaderView::Fixed); horizontalHeader()->setResizeMode(3, QHeaderView::Fixed); #else horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); horizontalHeader()->setSectionResizeMode(1, QHeaderView::Fixed); horizontalHeader()->setSectionResizeMode(2, QHeaderView::Fixed); horizontalHeader()->setSectionResizeMode(3, QHeaderView::Fixed); #endif setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum); }
//---------------------------------------------------------------------------------------- FileListWidget::FileListWidget(int rows, int columns, QWidget *parent) : QTableWidget(rows, columns, parent) { QStringList headers; headers << tr("Name"); headers << tr("Size"); headers << tr("Type"); headers << tr("Date"); headers << tr("UUID"); setEditTriggers(QTableWidget::NoEditTriggers); setSelectionBehavior(QAbstractItemView::SelectRows); setHorizontalHeaderLabels(headers); horizontalHeader()->setSelectionBehavior(QAbstractItemView::SelectItems); verticalHeader()->setVisible(false); setShowGrid(false); setColumnWidth(0, 450); setColumnWidth(1, 80); setColumnWidth(2, 120); setColumnWidth(3, 120); setColumnWidth(4, 200); setAcceptDrops(true); setContextMenuPolicy(Qt::CustomContextMenu); }
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 ); }
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); }
void DiveListView::setupUi(){ QSettings settings; static bool firstRun = true; if(firstRun) backupExpandedRows(); settings.beginGroup("ListWidget"); /* if no width are set, use the calculated width for each column; * for that to work we need to temporarily expand all rows */ expandAll(); for (int i = DiveTripModel::NR; i < DiveTripModel::COLUMNS; i++) { if(isColumnHidden(i)) continue; QVariant width = settings.value(QString("colwidth%1").arg(i)); if (width.isValid()) setColumnWidth(i, width.toInt()); else setColumnWidth(i, 100); } settings.endGroup(); if(firstRun) restoreExpandedRows(); else collapseAll(); firstRun = false; }
AELoadedResourcesTreeView::AELoadedResourcesTreeView(AEDocument* doc, AEResourcesManagerModelViewer* resourcesViewer) { _document = doc; _resourcesViewer = resourcesViewer; _resourcesModel = new AELoadedResourcesTreeViewItemModel(_document, 0, 2); setModel(_resourcesModel); _modelResourcesItem = new QStandardItem(tr("Models")); _materialResourcesItem = new QStandardItem(tr("Materials")); _textureResourcesItem = new QStandardItem(tr("Textures")); // _meshResourcesItem = new QStandardItem(tr("Meshes")); // _modelInstancesResourcesItem = new QStandardItem(tr("Model instances")); // _meshInstancesResourcesItem = new QStandardItem(tr("Mesh instances")); _resourcesModel->insertRow(0, _modelResourcesItem); _resourcesModel->insertRow(1, _materialResourcesItem); _resourcesModel->insertRow(2, _textureResourcesItem); // _resourcesModel->insertRow(3, _meshResourcesItem); // _resourcesModel->insertRow(4, _modelInstancesResourcesItem); // _resourcesModel->insertRow(5, _meshInstancesResourcesItem); _resourcesModel->setHorizontalHeaderItem(0, new QStandardItem(tr("Resource name"))); _resourcesModel->setHorizontalHeaderItem(1, new QStandardItem(tr("File name"))); setColumnWidth(0, 150); setColumnWidth(1, 100); QItemSelectionModel* selectModel = selectionModel(); connect(selectModel, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT(resourceSelectionChanged(const QItemSelection&, const QItemSelection&))); createMenus(); }
void ProcessView::updateView() { setAlternatingRowColors(true); resizeColumnToContents(0); setColumnWidth(1, 50); setColumnWidth(2, 50); }
void SourceView::updateSourceItems() { setColumnWidth(1, 50); setColumnWidth(2, _costType2 ? 50:0); // Allow resizing of column 2 setColumnWidthMode(2, QListView::Maximum); if (_costType) setColumnText(1, _costType->name()); if (_costType2) setColumnText(2, _costType2->name()); SourceItem* si; QListViewItem* item = firstChild(); for (;item;item = item->nextSibling()) { si = (SourceItem*)item; TraceLine* l = si->line(); if (!l) continue; si->updateCost(); QListViewItem *next, *i = si->firstChild(); for (;i;i = next) { next = i->nextSibling(); ((SourceItem*)i)->updateCost(); } } if (!_costType2) { setColumnWidthMode(2, QListView::Manual); setColumnWidth(2, 0); } }
void PortfolioOverviewTable::resizeEvent(QResizeEvent *event) { int marginRight = 8; int totalWidthToFill = viewport()->width() - marginRight; // Split the width equally in three int width1, width2, width3; width1 = width2 = width3 = totalWidthToFill/3; width2 += totalWidthToFill%3; // Once we go below 590 px we no longer have the luxury of doing the below, rather let column 2 ellipses so that others don't. if(totalWidthToFill > 580) { // Ensure that width2 is wide enough not to have ellipses if(width2 < 280) { int diff = 280 - width2; width2 = 280; width1 -= diff/2; width3 -= diff/2+diff%2; } } setColumnWidth(0, width1); setColumnWidth(1, width2); setColumnWidth(2, width3); }
void GeoTreeView::updateView() { setAlternatingRowColors(true); setColumnWidth(0,150); setColumnWidth(1,75); setColumnWidth(2,75); setColumnWidth(3,75); }
void GeoTreeView::updateView() { setAlternatingRowColors(true); //resizeColumnToContents(0); setColumnWidth(0,150); setColumnWidth(1,50); setColumnWidth(2,50); }
void ProgressTree2::setNarrowColumns() { setColumnWidth(0, 110); setColumnWidth(1, 60); setColumnWidth(2, 60); setColumnWidth(3, 100); setColumnWidth(4, 70); }
SampleList::SampleList(QWidget *parent) : QTableWidget(parent) , ui() { ui.setupUi(this); setColumnWidth(0, 150); setColumnWidth(1, 250); setColumnWidth(2, 250); }
void ScTreeWidget::handleMousePress(QTreeWidgetItem *item) { if (item == 0) return; if (item->parent() == 0) { if (item->isDisabled()) { setItemExpanded(item, false); return; } int wide = 0; int tops = topLevelItemCount(); if (m_toolbox_mode) { for (int t = 0; t < tops; t++) { setItemExpanded(topLevelItem(t), false); } setCurrentItem(item); setItemExpanded(item, true); if (item->childCount() != 0) { QTreeWidgetItem *child = item->child(0); if (child != 0) wide = itemWidget(child, 0)->minimumSizeHint().width()+5; } if (wide != 0) setColumnWidth(0, wide); else resizeColumnToContents(0); } else { setItemExpanded(item, !isItemExpanded(item)); for (int t = 0; t < tops; t++) { QTreeWidgetItem *top = topLevelItem(t); if (isItemExpanded(top)) { if (top->childCount() != 0) { QTreeWidgetItem *child = top->child(0); if (child != 0) wide = qMax(wide, itemWidget(child, 0)->minimumSizeHint().width()+5); } } } } if (wide != 0) setColumnWidth(0, wide); else resizeColumnToContents(0); emit currentChanged2(indexOfTopLevelItem(item)); } }
FactListView(FactListModel* model, Wt::WContainerWidget* p=0): Wt::WTableView(p) { setModel(model); resize(770, 250); setColumnWidth(N_COLUMN, 40); setColumnWidth(TEXT_COLUMN, 570); setColumnWidth(WHEN_ADDED_COLUMN, 75); setRowHeaderCount(1); setAlternatingRowColors(true); }
void JobListView::setServerColumnVisible(bool visible) { if (visible == isServerColumnVisible()) return; if (visible) setColumnWidth(JobColumnServer, 50); // at least the user can see it again else setColumnWidth(JobColumnServer, 0); }
CompParamsWidget::CompParamsWidget (QWidget *parent) : QTreeView (parent) { setItemDelegate (new EditDelegate (this)); setRootIsDecorated (false); setColumnWidth (0, fontMetrics ().width ("Average compositor option description length")); setColumnWidth (1, fontMetrics ().width ("average value")); setColumnWidth (2, fontMetrics ().width ("flag")); }
IpListView(IpListModel* model, Wt::WContainerWidget* p = 0): Wt::WTableView(p) { setModel(model); resize(ILP::WIDTH, ILP::HEIGHT); setColumnWidth(IpListModel::USER, 70); setColumnWidth(IpListModel::TYPE, 70); setColumnWidth(IpListModel::VALUE, 380); setColumnWidth(IpListModel::LAST_USE, 140); setColumnWidth(IpListModel::BAN, 100); setSelectable(true); }
SensorsList::SensorsList(QWidget *parent) : QTableWidget(parent) { setColumnCount(3); setColumnWidth(1, 80); setColumnWidth(2, 80); setHorizontalHeaderLabels(QStringList({ tr("Port"), tr("Normalized"), tr("Raw") })); verticalHeader()->setVisible(false); horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); }
DischargeItemTable::DischargeItemTable(QWidget *parent) : UiAutoRowTable(parent), _variable(&Rad::EmptyQuantity) { setColumnCount(2); setRowCount(1); setColumnWidth(0, 120); setColumnWidth(1, 230); DischargeItemDelegate * itemDelegate = new DischargeItemDelegate(this); this->setItemDelegate(itemDelegate); this->setToolTip(tr("Double click cell to input radionuclide and associated value")); }
void TestLevelTreeView::setModel(TestLevelModel* model) { QTreeView::setModel(model); _model = model; setColumnWidth(0, 120); for (int k = 1; k < 4; k++) setColumnWidth(k, 70); expandAll(); // connect(_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(debugDataChanged(QModelIndex,QModelIndex))); }
void TodoView::showDates(bool show) { static int oldColWidth = 0; if (!show) { oldColWidth = columnWidth(4); setColumnWidth(4, 0); } else { setColumnWidth(4, oldColWidth); } repaint(); }
void CoverageView::refresh() { clear(); setColumnWidth(0, 50); if (!_showCallers) setColumnWidth(1, 50); if (!_data || !_activeItem) return; TraceItem::CostType t = _activeItem->type(); TraceFunction* f = 0; if (t == TraceItem::Function) f = (TraceFunction*) _activeItem; if (t == TraceItem::FunctionCycle) f = (TraceFunction*) _activeItem; if (!f) return; TraceFunction* ff; TraceFunctionList l; _hc.clear(Configuration::maxListCount()); SubCost realSum = f->inclusive()->subCost(_costType); if (_showCallers) l = Coverage::coverage(f, Coverage::Caller, _costType); else l = Coverage::coverage(f, Coverage::Called, _costType); for (ff=l.first();ff;ff=l.next()) { Coverage* c = (Coverage*) ff->assoziation(Coverage::Rtti); if (c && (c->inclusive()>0.0)) _hc.addCost(ff, SubCost(realSum * c->inclusive())); } for(int i=0;i<_hc.realCount();i++) { ff = (TraceFunction*) _hc[i]; Coverage* c = (Coverage*) ff->assoziation(Coverage::Rtti); if (_showCallers) new CallerCoverageItem(this, c, f, _costType, _groupType); else new CalleeCoverageItem(this, c, f, _costType, _groupType); } if (_hc.hasMore()) { // a placeholder for all the functions skipped ... ff = (TraceFunction*) _hc[_hc.maxSize()-1]; Coverage* c = (Coverage*) ff->assoziation(Coverage::Rtti); if (_showCallers) new CallerCoverageItem(this, _hc.count() - _hc.maxSize(), c, f, _costType, _groupType); else new CalleeCoverageItem(this, _hc.count() - _hc.maxSize(), c, f, _costType, _groupType); } }
/*! * \brief New OptionList instance. Key-value pairs of command line arguments. */ OptionList::OptionList(QWidget *parent) : QTableWidget(parent) { setMaximumWidth(180); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setFrameStyle(QFrame::Sunken | QFrame::StyledPanel); setAutoFillBackground(true); setColumnCount(2); setColumnWidth(0, 80); setColumnWidth(1, 80); clear(); }
openvolume::openvolume( QWidget * parent ) : QDialog( parent ),m_ui( new Ui::openvolume() ) { m_ui->setupUi( this ) ; this->setFixedSize( this->size() ) ; this->setFont( parent->font() ) ; connect( m_ui->tableWidget,SIGNAL( itemDoubleClicked( QTableWidgetItem * ) ), this,SLOT( tableEntryDoubleClicked( QTableWidgetItem * ) ) ) ; connect( m_ui->tableWidget,SIGNAL( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ), this,SLOT( currentItemChanged( QTableWidgetItem *,QTableWidgetItem * ) ) ) ; connect( m_ui->pbHelp,SIGNAL( clicked() ),this,SLOT( pbHelp() ) ) ; connect( m_ui->pbUUID,SIGNAL( clicked() ),this,SLOT( pbUUID() ) ) ; connect( m_ui->pbCancel,SIGNAL( clicked() ),this,SLOT( pbCancel() ) ) ; connect( m_ui->pbOpen,SIGNAL( clicked() ),this,SLOT( pbOpen() ) ) ; this->addAction( [ this ](){ auto ac = new QAction( this ) ; ac->setShortcuts( { Qt::Key_Enter,Qt::Key_Return } ) ; connect( ac,SIGNAL( triggered() ),this,SLOT( EnterKeyPressed() ) ) ; return ac ; }() ) ; auto tw = m_ui->tableWidget ; tw->setColumnWidth( 0,183 ) ; tw->setColumnWidth( 1,90 ) ; //tw->setColumnWidth( 2,110 ) ; tw->hideColumn( 2 ) ; tw->setColumnWidth( 3,90 ) ; tw->setColumnWidth( 4,309 ) ; for( int i = 0 ; i < 5 ; i++ ){ tw->horizontalHeaderItem( i )->setFont( this->font() ) ; } tw->horizontalHeader()->setVisible( true ) ; m_ui->checkBoxUUID->setVisible( false ) ; m_ui->pbHelp->setVisible( false ) ; this->installEventFilter( this ) ; this->disableAll() ; }
/****************************************************************************** * Set which time columns are to be displayed. */ void AlarmListView::selectTimeColumns(bool time, bool timeTo) { if(!time && !timeTo) return; // always show at least one time column bool changed = false; int w = columnWidth(mColumn[TIME_COLUMN]); if(time && !w) { // Unhide the time column int colWidth = mTimeColumnHeaderWidth; QFontMetrics fm = fontMetrics(); for(AlarmListViewItem *item = firstChild(); item; item = item->nextSibling()) { int w = item->width(fm, this, mColumn[TIME_COLUMN]); if(w > colWidth) colWidth = w; } setColumnWidth(mColumn[TIME_COLUMN], colWidth); setColumnWidthMode(mColumn[TIME_COLUMN], QListView::Maximum); changed = true; } else if(!time && w) { // Hide the time column setColumnWidthMode(mColumn[TIME_COLUMN], QListView::Manual); setColumnWidth(mColumn[TIME_COLUMN], 0); changed = true; } w = columnWidth(mColumn[TIME_TO_COLUMN]); if(timeTo && !w) { // Unhide the time-to-alarm column setColumnWidthMode(mColumn[TIME_TO_COLUMN], QListView::Maximum); updateTimeToAlarms(true); if(columnWidth(mColumn[TIME_TO_COLUMN]) < mTimeToColumnHeaderWidth) setColumnWidth(mColumn[TIME_TO_COLUMN], mTimeToColumnHeaderWidth); changed = true; } else if(!timeTo && w) { // Hide the time-to-alarm column setColumnWidthMode(mColumn[TIME_TO_COLUMN], QListView::Manual); setColumnWidth(mColumn[TIME_TO_COLUMN], 0); changed = true; } if(changed) { resizeLastColumn(); triggerUpdate(); // ensure scroll bar appears if needed } }