bool TreeWidgetColumnStretcher::eventFilter(QObject *obj, QEvent *ev) { if (obj == parent()) { if (ev->type() == QEvent::Show) { QHeaderView *hv = qobject_cast<QHeaderView*>(obj); for (int i = 0; i < hv->count(); ++i) hv->setSectionResizeMode(i, QHeaderView::Interactive); } else if (ev->type() == QEvent::Hide) { QHeaderView *hv = qobject_cast<QHeaderView*>(obj); for (int i = 0; i < hv->count(); ++i) hv->setSectionResizeMode(i, i == m_columnToStretch ? QHeaderView::Stretch : QHeaderView::ResizeToContents); } else if (ev->type() == QEvent::Resize) { QHeaderView *hv = qobject_cast<QHeaderView*>(obj); if (hv->sectionResizeMode(m_columnToStretch) == QHeaderView::Interactive) { QResizeEvent *re = static_cast<QResizeEvent*>(ev); int diff = re->size().width() - re->oldSize().width() ; hv->resizeSection(m_columnToStretch, qMax(32, hv->sectionSize(1) + diff)); } } } return false; }
LinkPropertyViewImpl::LinkPropertyViewImpl(LinkPropertyView* self) : self(self) { linkSelectionView = LinkSelectionView::mainInstance(); setFrameShape(QFrame::NoFrame); setColumnCount(2); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::NoSelection); QHeaderView* hh = horizontalHeader(); QHeaderView* vh = verticalHeader(); hh->hide(); vh->hide(); hh->setSectionResizeMode(QHeaderView::Stretch); vh->setSectionResizeMode(QHeaderView::ResizeToContents); hh->setStretchLastSection(true); fontPointSizeDiff = 0; MappingPtr config = AppConfig::archive()->openMapping("LinkPropertyView"); int storedFontPointSizeDiff; if(config->read("fontZoom", storedFontPointSizeDiff)){ zoomFontSize(storedFontPointSizeDiff); } connections.add( BodyBar::instance()->sigCurrentBodyItemChanged().connect( std::bind(&LinkPropertyViewImpl::onCurrentBodyItemChanged, this, _1))); connections.add( linkSelectionView->sigSelectionChanged().connect( std::bind(&LinkPropertyViewImpl::updateProperties, this))); }
ActivateModsDialog::ActivateModsDialog(const std::map<QString, std::vector<QString> > &missingPlugins, QWidget *parent) : TutorableDialog("ActivateMods", parent), ui(new Ui::ActivateModsDialog) { ui->setupUi(this); QTableWidget *modsTable = findChild<QTableWidget*>("modsTable"); QHeaderView *headerView = modsTable->horizontalHeader(); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) headerView->setSectionResizeMode(0, QHeaderView::Stretch); headerView->setSectionResizeMode(1, QHeaderView::Interactive); #else headerView->setResizeMode(0, QHeaderView::Stretch); headerView->setResizeMode(1, QHeaderView::Interactive); #endif int row = 0; modsTable->setRowCount(missingPlugins.size()); for (std::map<QString, std::vector<QString> >::const_iterator espIter = missingPlugins.begin(); espIter != missingPlugins.end(); ++espIter, ++row) { modsTable->setCellWidget(row, 0, new QLabel(espIter->first)); if (espIter->second.size() == 0) { modsTable->setCellWidget(row, 1, new QLabel(tr("not found"))); } else { QComboBox* combo = new QComboBox(); for (std::vector<QString>::const_iterator modIter = espIter->second.begin(); modIter != espIter->second.end(); ++modIter) { combo->addItem(*modIter); } modsTable->setCellWidget(row, 1, combo); } } }
void ListView::setupGeometry() { QPalette pl = palette(); pl.setColor(QPalette::Base, ODD_LINE_COL); pl.setColor(QPalette::AlternateBase, EVEN_LINE_COL); setPalette(pl); // does not seem to inherit application paletteAnnotate QHeaderView* hv = header(); hv->setStretchLastSection(true); #if QT_VERSION < 0x050000 hv->setResizeMode(LOG_COL, QHeaderView::Interactive); hv->setResizeMode(TIME_COL, QHeaderView::Interactive); hv->setResizeMode(ANN_ID_COL, QHeaderView::ResizeToContents); #else hv->setSectionResizeMode(LOG_COL, QHeaderView::Interactive); hv->setSectionResizeMode(TIME_COL, QHeaderView::Interactive); hv->setSectionResizeMode(ANN_ID_COL, QHeaderView::ResizeToContents); #endif hv->resizeSection(GRAPH_COL, DEF_GRAPH_COL_WIDTH); hv->resizeSection(LOG_COL, DEF_LOG_COL_WIDTH); hv->resizeSection(AUTH_COL, DEF_AUTH_COL_WIDTH); hv->resizeSection(TIME_COL, DEF_TIME_COL_WIDTH); if (git->isMainHistory(fh)) hideColumn(ANN_ID_COL); }
VcsEventWidget::VcsEventWidget( const QUrl& url, const VcsRevision& rev, KDevelop::IBasicVersionControl* iface, QWidget* parent ) : QWidget(parent), d(new VcsEventWidgetPrivate(this) ) { d->m_iface = iface; d->m_url = url; d->m_ui = new Ui::VcsEventWidget(); d->m_ui->setupUi(this); d->m_logModel= new VcsEventModel(iface, rev, url, this); d->m_ui->eventView->setModel( d->m_logModel ); d->m_ui->eventView->sortByColumn(0, Qt::DescendingOrder); d->m_ui->eventView->setContextMenuPolicy( Qt::CustomContextMenu ); QHeaderView* header = d->m_ui->eventView->header(); header->setSectionResizeMode( 0, QHeaderView::ResizeToContents ); header->setSectionResizeMode( 1, QHeaderView::Stretch ); header->setSectionResizeMode( 2, QHeaderView::ResizeToContents ); header->setSectionResizeMode( 3, QHeaderView::ResizeToContents ); d->m_detailModel = new VcsItemEventModel(this); d->m_ui->itemEventView->setModel( d->m_detailModel ); connect( d->m_ui->eventView, &QTreeView::clicked, this, [&] (const QModelIndex& index) { d->eventViewClicked(index); } ); connect( d->m_ui->eventView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, [&] (const QModelIndex& start, const QModelIndex& end) { d->currentRowChanged(start, end); }); connect( d->m_ui->eventView, &QTreeView::customContextMenuRequested, this, [&] (const QPoint& point) { d->eventViewCustomContextMenuRequested(point); } ); }
void ReplaceWidget::updateFromCurrentDevice( QComboBox* devicesComboBox ) { QModelIndex index = m_core->deviceModel()->index( devicesComboBox->currentIndex(), 0 ); if ( !index.isValid() ) return; Device* device = m_core->deviceModel()->deviceForIndex( index ); QAbstractItemModel* oldModel = m_ui->partitionTreeView->model(); if ( oldModel ) disconnect( oldModel, 0, this, 0 ); PartitionModel* model = m_core->partitionModelForDevice( device ); m_ui->partitionTreeView->setModel( model ); m_ui->partitionTreeView->expandAll(); // Must be done here because we need to have a model set to define // individual column resize mode QHeaderView* header = m_ui->partitionTreeView->header(); header->setSectionResizeMode( QHeaderView::ResizeToContents ); header->setSectionResizeMode( 0, QHeaderView::Stretch ); //updateButtons(); // Establish connection here because selection model is destroyed when // model changes connect( m_ui->partitionTreeView->selectionModel(), &QItemSelectionModel::currentRowChanged, this, &ReplaceWidget::onPartitionViewActivated ); connect( model, &QAbstractItemModel::modelReset, this, &ReplaceWidget::onPartitionModelReset ); }
EditBookmarksDialog::EditBookmarksDialog(IBookmarks *ABookmarks, const Jid &AStreamJid, const QList<IBookmark> &AList, QWidget *AParent) : QDialog(AParent) { REPORT_VIEW; ui.setupUi(this); setAttribute(Qt::WA_DeleteOnClose,true); setWindowTitle(tr("Edit bookmarks - %1").arg(AStreamJid.uBare())); IconStorage::staticStorage(RSR_STORAGE_MENUICONS)->insertAutoIcon(this,MNI_BOOKMARKS_EDIT,0,0,"windowIcon"); FBookmarks = ABookmarks; FStreamJid = AStreamJid; ui.tbwBookmarks->setRowCount(AList.count()); for (int row=0; row<AList.count(); ++row) { IBookmark bookmark = AList.at(row); setBookmarkToRow(row,bookmark); } QHeaderView *header = ui.tbwBookmarks->horizontalHeader(); header->setSectionsClickable(true); header->setSectionResizeMode(COL_NAME,QHeaderView::ResizeToContents); header->setSectionResizeMode(COL_VALUE,QHeaderView::Stretch); header->setSectionResizeMode(COL_NICK,QHeaderView::ResizeToContents); header->hideSection(COL_SORT); connect(header,SIGNAL(sectionClicked(int)),SLOT(onSortingStateChange(int))); connect(ui.pbtAdd,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtEdit,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtDelete,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtMoveUp,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.pbtMoveDown,SIGNAL(clicked()),SLOT(onEditButtonClicked())); connect(ui.bbxButtons,SIGNAL(accepted()),SLOT(onDialogAccepted())); connect(ui.tbwBookmarks,SIGNAL(itemDoubleClicked(QTableWidgetItem *)),SLOT(onTableItemDoubleClicked(QTableWidgetItem *))); }
QWidget *DebuggerOptionsPage::widget() { if (!m_configWidget) { m_configWidget = new QWidget; m_addButton = new QPushButton(tr("Add"), m_configWidget); m_cloneButton = new QPushButton(tr("Clone"), m_configWidget); m_delButton = new QPushButton(tr("Remove"), m_configWidget); m_container = new DetailsWidget(m_configWidget); m_container->setState(DetailsWidget::NoSummary); m_container->setVisible(false); m_debuggerView = new QTreeView(m_configWidget); m_model = new DebuggerItemModel(m_debuggerView); m_debuggerView->setModel(m_model); m_debuggerView->setUniformRowHeights(true); m_debuggerView->setSelectionMode(QAbstractItemView::SingleSelection); m_debuggerView->setSelectionBehavior(QAbstractItemView::SelectRows); m_debuggerView->expandAll(); QHeaderView *header = m_debuggerView->header(); header->setStretchLastSection(false); header->setSectionResizeMode(0, QHeaderView::ResizeToContents); header->setSectionResizeMode(1, QHeaderView::ResizeToContents); header->setSectionResizeMode(2, QHeaderView::Stretch); QVBoxLayout *buttonLayout = new QVBoxLayout(); buttonLayout->setSpacing(6); buttonLayout->setContentsMargins(0, 0, 0, 0); buttonLayout->addWidget(m_addButton); buttonLayout->addWidget(m_cloneButton); buttonLayout->addWidget(m_delButton); buttonLayout->addItem(new QSpacerItem(10, 40, QSizePolicy::Minimum, QSizePolicy::Expanding)); QVBoxLayout *verticalLayout = new QVBoxLayout(); verticalLayout->addWidget(m_debuggerView); verticalLayout->addWidget(m_container); QHBoxLayout *horizontalLayout = new QHBoxLayout(m_configWidget); horizontalLayout->addLayout(verticalLayout); horizontalLayout->addLayout(buttonLayout); connect(m_debuggerView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(debuggerSelectionChanged())); connect(m_addButton, SIGNAL(clicked()), this, SLOT(addDebugger()), Qt::QueuedConnection); connect(m_cloneButton, SIGNAL(clicked()), this, SLOT(cloneDebugger()), Qt::QueuedConnection); connect(m_delButton, SIGNAL(clicked()), this, SLOT(removeDebugger()), Qt::QueuedConnection); m_itemConfigWidget = new DebuggerItemConfigWidget(m_model); m_container->setWidget(m_itemConfigWidget); updateState(); } return m_configWidget; }
void FilesViewer::init() { m_filesTable->setModel(m_model); m_filesTable->horizontalHeader()->setSectionsMovable(true); QHeaderView* h = m_filesTable->horizontalHeader(); h->setSectionResizeMode(QHeaderView::Stretch); h->setSectionResizeMode(TrackModelFields::Position, QHeaderView::ResizeToContents); h->setSectionResizeMode(TrackModelFields::Year, QHeaderView::ResizeToContents); m_filesTable->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed); }
/** * @brief EditEntityDialog::EditEntityDialog * @param parent */ EditEntityDialog::EditEntityDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::EditEntityDialog) , m_EditMethodDialog(new EditMethodDialog(this)) , m_CommandsStack(new QUndoStack(this)) , m_ComponentsModel(std::make_shared<models::ComponentsModel>(nullptr)) { ui->setupUi(this); for(auto &&pair : names) ui->cbType->addItem(pair.first, QVariant::fromValue(pair.second)); for (auto &&p : componentsNames) itemByName(p.first, ui->lstMembers)->setData(int(ComponentCustomRoles::Single), p.second); for (auto &&p : display) itemByName(p.first, ui->lstMembers)->setData(int(ComponentCustomRoles::Display), QVariant::fromValue(p.second)); ui->lstMembers->setCurrentRow(0); ui->viewMembers->setModel(m_ComponentsModel.get()); auto componentsEditDelegat = new ComponentsEditDelegate(this); connect(componentsEditDelegat, &ComponentsEditDelegate::editButtonClicked, this, &EditEntityDialog::onEditComponentClicked); connect(componentsEditDelegat, &ComponentsEditDelegate::deleteButtonClicked, this, &EditEntityDialog::onDeleteComponentClicked); ui->viewMembers->setItemDelegateForColumn(models::ComponentsModel::Buttons, componentsEditDelegat); connect(m_ComponentsModel.get(), &models::ComponentsModel::showButtons, [view = ui->viewMembers](auto &&indexes) { for (auto &&index: indexes) { Q_ASSERT(index.isValid()); view->openPersistentEditor(index); } }); m_SignatureEditDelegate = std::make_unique<SignatureEditDelegate>(); ui->viewMembers->setItemDelegateForColumn(models::ComponentsModel::ShortSignature, m_SignatureEditDelegate.get()); QHeaderView * header = ui->viewMembers->horizontalHeader(); header->setSectionResizeMode(models::ComponentsModel::ShortSignature, QHeaderView::Stretch); header->setSectionResizeMode(models::ComponentsModel::Buttons, QHeaderView::Fixed); ui->viewMembers->setColumnWidth(models::ComponentsModel::Buttons, componentsEditDelegat->size().width()); connect(ui->pbAccept, &QPushButton::clicked, this, &EditEntityDialog::onAccepted); connect(ui->pbReject, &QPushButton::clicked, this, &EditEntityDialog::onRejected); connect(ui->pbCreateScope, &QPushButton::clicked, this, &EditEntityDialog::needNewScope); connect(ui->pbNewComponent, &QPushButton::clicked, this, &EditEntityDialog::onNewComponentClicked); connect(ui->lstMembers, &QListWidget::currentItemChanged, this, &EditEntityDialog::onCurrentItemChange); connect(m_CommandsStack.data(), &QUndoStack::canRedoChanged, ui->tbRedo, &QToolButton::setEnabled); connect(m_CommandsStack.data(), &QUndoStack::canUndoChanged, ui->tbUndo, &QToolButton::setEnabled); connect(ui->tbRedo, &QToolButton::clicked, m_CommandsStack.data(), &QUndoStack::redo); connect(ui->tbUndo, &QToolButton::clicked, m_CommandsStack.data(), &QUndoStack::undo); }
void DirectoryView::setModel(DirectoryModel* model) { GenericTreeView<DirectoryModel>::setModel(model); if(model) { QHeaderView* header = this->header(); header->setStretchLastSection(false); header->setSectionResizeMode(0, QHeaderView::Stretch); header->setSectionResizeMode(1, QHeaderView::Interactive); header->setSectionResizeMode(2, QHeaderView::Interactive); } }
TilesetView::TilesetView(QWidget *parent) : QTableView(parent) , mZoomable(new Zoomable(this)) , mTilesetDocument(nullptr) , mMarkAnimatedTiles(true) , mEditTerrain(false) , mEditWangSet(false) , mWangBehavior(WholeId) , mEraseTerrain(false) , mTerrain(nullptr) , mWangSet(nullptr) , mWangId(0) , mWangColorIndex(0) , mHoveredCorner(0) , mTerrainChanged(false) , mWangIdChanged(false) , mHandScrolling(false) , mImageMissingIcon(QStringLiteral("://images/32x32/image-missing.png")) { setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setItemDelegate(new TileDelegate(this, this)); setShowGrid(false); setTabKeyNavigation(false); QHeaderView *hHeader = horizontalHeader(); QHeaderView *vHeader = verticalHeader(); hHeader->hide(); vHeader->hide(); hHeader->setSectionResizeMode(QHeaderView::ResizeToContents); vHeader->setSectionResizeMode(QHeaderView::ResizeToContents); hHeader->setMinimumSectionSize(1); vHeader->setMinimumSectionSize(1); // Hardcode this view on 'left to right' since it doesn't work properly // for 'right to left' languages. setLayoutDirection(Qt::LeftToRight); Preferences *prefs = Preferences::instance(); mDrawGrid = prefs->showTilesetGrid(); grabGesture(Qt::PinchGesture); connect(prefs, &Preferences::showTilesetGridChanged, this, &TilesetView::setDrawGrid); connect(StyleHelper::instance(), &StyleHelper::styleApplied, this, &TilesetView::updateBackgroundColor); connect(mZoomable, &Zoomable::scaleChanged, this, &TilesetView::adjustScale); }
void batchWindow::updateColumns() { QHeaderView *headerView = ui->tableWidget->horizontalHeader(); headerView->setSectionResizeMode(QHeaderView::Interactive); headerView->resizeSection(0, 60); headerView->resizeSection(1, 40); headerView->resizeSection(2, 80); headerView->setSectionResizeMode(2, QHeaderView::Stretch); headerView->resizeSection(3, 80); headerView->resizeSection(4, 80); headerView->resizeSection(5, 80); ui->tableWidget->resizeColumnToContents(0); ui->tableWidget->repaint(); }
void GameList::MakeTableView() { m_table = new QTableView(this); m_table->setModel(m_table_proxy); m_table->setSelectionMode(QAbstractItemView::SingleSelection); m_table->setSelectionBehavior(QAbstractItemView::SelectRows); m_table->setAlternatingRowColors(true); m_table->setShowGrid(false); m_table->setSortingEnabled(true); m_table->setCurrentIndex(QModelIndex()); // TODO load from config m_table->setColumnHidden(GameListModel::COL_PLATFORM, false); m_table->setColumnHidden(GameListModel::COL_ID, true); m_table->setColumnHidden(GameListModel::COL_BANNER, false); m_table->setColumnHidden(GameListModel::COL_TITLE, false); m_table->setColumnHidden(GameListModel::COL_DESCRIPTION, true); m_table->setColumnHidden(GameListModel::COL_MAKER, false); m_table->setColumnHidden(GameListModel::COL_SIZE, false); m_table->setColumnHidden(GameListModel::COL_COUNTRY, false); m_table->setColumnHidden(GameListModel::COL_RATING, false); QHeaderView* header = m_table->horizontalHeader(); header->setSectionResizeMode(GameListModel::COL_PLATFORM, QHeaderView::Fixed); header->setSectionResizeMode(GameListModel::COL_COUNTRY, QHeaderView::Fixed); header->setSectionResizeMode(GameListModel::COL_ID, QHeaderView::ResizeToContents); header->setSectionResizeMode(GameListModel::COL_BANNER, QHeaderView::ResizeToContents); header->setSectionResizeMode(GameListModel::COL_TITLE, QHeaderView::Stretch); header->setSectionResizeMode(GameListModel::COL_MAKER, QHeaderView::Stretch); header->setSectionResizeMode(GameListModel::COL_SIZE, QHeaderView::ResizeToContents); header->setSectionResizeMode(GameListModel::COL_DESCRIPTION, QHeaderView::Stretch); header->setSectionResizeMode(GameListModel::COL_RATING, QHeaderView::Fixed); }
void LoginDialog::onSessionChoiceNeeded(net::LoginSessionModel *sessions) { sessions->setHideNsfm(parentalcontrols::level() >= parentalcontrols::Level::NoList); m_ui->sessionlist->setModel(sessions); QHeaderView *header = m_ui->sessionlist->horizontalHeader(); header->setSectionResizeMode(1, QHeaderView::Stretch); header->setSectionResizeMode(0, QHeaderView::Fixed); header->resizeSection(0, 24); auto updateNsfmLabel = [this, sessions]() { const int filtered = sessions->filteredCount(); if(filtered>0) { QString label = tr("%n age restricted session(s) hidden.", "", filtered); if(!parentalcontrols::isLocked()) label = "<a href=\"#\">" + label + "</a>"; m_ui->nsfmSessionsLabel->setText(label); } m_ui->nsfmSessionsLabel->setVisible(filtered>0); }; updateNsfmLabel(); connect(sessions, &net::LoginSessionModel::filteredCountChanged, this, updateNsfmLabel); if(!parentalcontrols::isLocked()) { connect(m_ui->nsfmSessionsLabel, &QLabel::linkActivated, this, [this, sessions]() { QMessageBox::StandardButton btn = QMessageBox::question(this, QString(), tr("Show age restricted sessions?")); if(btn == QMessageBox::Yes) { sessions->setHideNsfm(false); m_ui->nsfmSessionsLabel->setVisible(false); QSettings().setValue("pc/level", int(parentalcontrols::Level::Unrestricted)); } }); } connect(m_ui->sessionlist->selectionModel(), &QItemSelectionModel::selectionChanged, [this](const QItemSelection &sel) { // Enable/disable OK button depending on the selection bool ok; if(sel.indexes().isEmpty()) ok = false; else ok = sel.indexes().at(0).data(net::LoginSessionModel::JoinableRole).toBool(); m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok); }); resetMode(SESSION); }
//--------------------------------- PluginKateXMLCheckView::PluginKateXMLCheckView( KTextEditor::Plugin *plugin, KTextEditor::MainWindow *mainwin) : QObject(mainwin) , KXMLGUIClient() , m_mainWindow(mainwin) { KXMLGUIClient::setComponentName(QLatin1String("katexmlcheck"), i18n ("Kate XML check")); // where i18n resources? setXMLFile(QLatin1String("ui.rc")); dock = m_mainWindow->createToolView(plugin, "kate_plugin_xmlcheck_ouputview", KTextEditor::MainWindow::Bottom, QIcon::fromTheme("misc"), i18n("XML Checker Output")); listview = new QTreeWidget( dock ); m_tmp_file=0; QAction *a = actionCollection()->addAction("xml_check"); a->setText(i18n("Validate XML")); connect(a, SIGNAL(triggered()), this, SLOT(slotValidate())); // TODO?: //(void) new KAction ( i18n("Indent XML"), KShortcut(), this, // SLOT(slotIndent()), actionCollection(), "xml_indent" ); listview->setFocusPolicy(Qt::NoFocus); QStringList headers; headers << i18n("#"); headers << i18n("Line"); headers << i18n("Column"); headers << i18n("Message"); listview->setHeaderLabels(headers); listview->setRootIsDecorated(false); connect(listview, SIGNAL(itemClicked(QTreeWidgetItem*,int)), SLOT(slotClicked(QTreeWidgetItem*,int))); QHeaderView *header = listview->header(); header->setSectionResizeMode(0, QHeaderView::ResizeToContents); header->setSectionResizeMode(1, QHeaderView::ResizeToContents); header->setSectionResizeMode(2, QHeaderView::ResizeToContents); /* TODO?: invalidate the listview when document has changed Kate::View *kv = application()->activeMainWindow()->activeView(); if( ! kv ) { qDebug() << "Warning: no Kate::View"; return; } connect(kv, SIGNAL(modifiedChanged()), this, SLOT(slotUpdate())); */ connect(&m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotProcExited(int,QProcess::ExitStatus))); // we currently only want errors: m_proc.setProcessChannelMode(QProcess::SeparateChannels); // m_proc.setProcessChannelMode(QProcess::ForwardedChannels); // For Debugging. Do not use this. mainwin->guiFactory()->addClient(this); }
XMLInfoDialog::XMLInfoDialog(QWidget *parent) : QDialog(parent), ui(new Ui::XMLInfoDialog) { ui->setupUi(this); setWindowTitle(tr("选择订阅")); setMinimumWidth(400); setMinimumHeight(450); setMaximumWidth(400); setMaximumHeight(450); QAbstractButton *okBtn = ui->buttonBox->button(QDialogButtonBox::Ok); QAbstractButton *cancelBtn = ui->buttonBox->button(QDialogButtonBox::Cancel); okBtn->setText(tr("确定")); cancelBtn->setText(tr("取消")); connect(cancelBtn, SIGNAL(clicked(bool)), this, SLOT(close())); connect(okBtn, SIGNAL(clicked(bool)), this, SLOT(subscriptionSelectedFinished())); QHeaderView *header = new QHeaderView(Qt::Horizontal, ui->treeWidget); header->setSectionResizeMode(QHeaderView::Stretch); header->setDefaultAlignment(Qt::AlignCenter); ui->treeWidget->setHeader(header); connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(treeItemChanged(QTreeWidgetItem*,int))); }
Sesion::Sesion(QWidget *parent) : QMainWindow(parent), ui(new Ui::Sesion) { ui->setupUi(this); ui->tableWidget->setEnabled(false); ui->tableWidget->setColumnCount(1); QHeaderView* header = ui->tableWidget->horizontalHeader(); header->setSectionResizeMode(0,QHeaderView::Stretch); header->setVisible(true); QStringList nameLabels; nameLabels<<"Aplicaciones"; ui->tableWidget->setHorizontalHeaderLabels(nameLabels); this->windowsAnhadir = new dNewApp(); ui->btnEditar->setEnabled(false); ui->btnEliminar->setEnabled(false); //ui->btnUp->setEnabled(false); //ui->btnDown->setEnabled(false); connect(this->windowsAnhadir,SIGNAL(getData(QString,QString,int,bool)),this,SLOT(newItem(QString,QString,int,bool))); connect(ui->btnAnhadir,SIGNAL(clicked()),this,SLOT(anhadirItem())); connect(ui->btnEditar,SIGNAL(clicked()),this,SLOT(editarItem())); connect(ui->btnEliminar,SIGNAL(clicked()),this,SLOT(eliminarItem())); connect(ui->tableWidget,SIGNAL(cellClicked(int,int)),this,SLOT(activarEditarBtn(int,int))); connect(ui->tableWidget,SIGNAL(cellPressed(int,int)),this,SLOT(activarEditarBtn(int,int))); connect(ui->tableWidget,SIGNAL(cellActivated(int,int)),this,SLOT(activarEditarBtn(int,int))); }
EditIndexDialog::EditIndexDialog(DBBrowserDB& db, const QString& indexName, bool createIndex, QWidget* parent) : QDialog(parent), pdb(db), curIndex(indexName), index(indexName), newIndex(createIndex), ui(new Ui::EditIndexDialog), m_sRestorePointName(pdb.generateSavepointName("editindex")) { // Create UI ui->setupUi(this); // Get list of tables, sort it alphabetically and fill the combobox objectMap dbobjs; QList<sqlb::ObjectPtr> tables = pdb.objMap.values("table"); for(auto it=tables.constBegin();it!=tables.constEnd();++it) dbobjs.insert((*it)->name(), (*it)); ui->comboTableName->blockSignals(true); for(auto it=dbobjs.constBegin();it!=dbobjs.constEnd();++it) ui->comboTableName->addItem(QIcon(QString(":icons/table")), (*it)->name()); ui->comboTableName->blockSignals(false); QHeaderView *tableHeaderView = ui->tableIndexColumns->horizontalHeader(); tableHeaderView->setSectionResizeMode(0, QHeaderView::Stretch); // Editing an existing index? if(!newIndex) { // Load the current layout and fill in the dialog fields index = *(pdb.getObjectByName(curIndex).dynamicCast<sqlb::Index>()); ui->editIndexName->blockSignals(true); ui->editIndexName->setText(index.name()); ui->editIndexName->blockSignals(false); ui->checkIndexUnique->blockSignals(true); ui->checkIndexUnique->setChecked(index.unique()); ui->checkIndexUnique->blockSignals(false); ui->comboTableName->blockSignals(true); ui->comboTableName->setCurrentText(index.table()); ui->comboTableName->blockSignals(false); ui->editPartialClause->blockSignals(true); ui->editPartialClause->setText(index.whereExpr()); ui->editPartialClause->blockSignals(false); tableChanged(index.table(), true); } else { tableChanged(ui->comboTableName->currentText(), false); } // Add event handler for index column name changes. These are only allowed for expression columns, though. connect(ui->tableIndexColumns, static_cast<void(QTableWidget::*)(QTableWidgetItem*)>(&QTableWidget::itemChanged), [=](QTableWidgetItem* item) { index.columns().at(item->row())->setName(item->text()); updateSqlText(); }); // Create a savepoint to revert back to pdb.setSavepoint(m_sRestorePointName); }
void MainWindow:: InitializeUi() { EnableToolbar(false); QHeaderView *header = ui->tableWidget->horizontalHeader(); header->setSectionResizeMode(QHeaderView::ResizeToContents); header->setResizeContentsPrecision(QHeaderView::Stretch); connect(ui->actionStep_Run, SIGNAL(triggered(bool)), this, SLOT(StepRun())); connect(ui->actionPause, SIGNAL(triggered(bool)), this, SLOT(Stop())); connect(ui->actionPlay, SIGNAL(triggered(bool)), this, SLOT(Run())); connect(ui->actionConnect, SIGNAL(triggered(bool)), this, SLOT(managePortConnection())); connect(ui->pushButton, SIGNAL(pressed()), this, SLOT(SendGroupCommand())); connect(ui->actionReset_Script_Table, SIGNAL(triggered(bool)), this, SLOT(ClearTable())); connect(ui->tableWidget, SIGNAL(cellPressed(int,int)), this, SLOT(SetRowCol(int,int))); connect(ui->actionTimer_Reset, SIGNAL(triggered(bool)), this, SLOT(ResetTimer())); connect(ui->actionSave, SIGNAL(triggered(bool)), this, SLOT(SaveScript())); connect(ui->actionOpen, SIGNAL(triggered(bool)), this, SLOT(LoadScript())); connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(Exit())); //////////// RIGHT MOUSE BUTTON MENU ///////////////////////////// ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tableWidget, SIGNAL(customContextMenuRequested(const QPoint &)),this, SLOT(ShowContextMenu(const QPoint &))); ////////////////////////////////////////////////////////////////// }
// ctor. synthv1widget_controls::synthv1widget_controls ( QWidget *pParent ) : QTreeWidget(pParent) { QTreeWidget::setColumnCount(4); QTreeWidget::setRootIsDecorated(false); QTreeWidget::setAlternatingRowColors(true); QTreeWidget::setUniformRowHeights(true); QTreeWidget::setAllColumnsShowFocus(false); QTreeWidget::setSelectionBehavior(QAbstractItemView::SelectRows); QTreeWidget::setSelectionMode(QAbstractItemView::SingleSelection); QHeaderView *pHeaderView = QTreeWidget::header(); #if QT_VERSION < 0x050000 pHeaderView->setResizeMode(QHeaderView::ResizeToContents); #else pHeaderView->setSectionResizeMode(QHeaderView::ResizeToContents); #endif // pHeaderView->hide(); QTreeWidget::setItemDelegate(new synthv1widget_controls_item_delegate(this)); QObject::connect(this, SIGNAL(itemChanged(QTreeWidgetItem *, int)), SLOT(itemChangedSlot(QTreeWidgetItem *, int))); }
AppWindow::AppWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::AppWindow) { main_all_groups_window = new AllGroups(); group_info_window = new GroupInfo(this); main_login_window = new LoginWindow(this); myAppWindow = new AppWindowData(); this->setFixedSize(900, 600); connect(this, SIGNAL(sendGroupID(QString)), group_info_window, SLOT(setLabelText(QString))); ui->setupUi(this); addItemsToCourseNameComboBox(); resetRowCount(); setColumnsOfTable(); main_login_window->show(); QHeaderView* header = ui->listOfAllGroups->horizontalHeader(); header->setSectionResizeMode(QHeaderView::Stretch); web_interface = HTTPInterface::getInstance(); ui->deleteButton->hide(); ui->userdeleteButton_2->hide(); ui->adminprivButton->hide(); ui->userlistbox->hide(); }
SyncOverwriteDialog::SyncOverwriteDialog(const QString &path, DirectoryEntry *directoryStructure, QWidget *parent) : TutorableDialog("SyncOverwrite", parent), ui(new Ui::SyncOverwriteDialog), m_SourcePath(path), m_DirectoryStructure(directoryStructure) { ui->setupUi(this); refresh(path); QHeaderView *headerView = ui->syncTree->header(); #if QT_VERSION >= QT_VERSION_CHECK(5,0,0) headerView->setSectionResizeMode(0, QHeaderView::Stretch); headerView->setSectionResizeMode(1, QHeaderView::Interactive); #else headerView->setResizeMode(0, QHeaderView::Stretch); headerView->setResizeMode(1, QHeaderView::Interactive); #endif }
TransitionEditorWindow::TransitionEditorWindow(QWidget* parent) : QWidget(parent) , ui_(new Ui::TransitionEditorWindow) , special_(false) , model_(nullptr) , transition_(nullptr) , transitionType_(TRMControlModel::Transition::TYPE_INVALID) { ui_->setupUi(this); ui_->transitionTypeComboBox->addItem(typeNames[2], 2); ui_->transitionTypeComboBox->addItem(typeNames[3], 3); ui_->transitionTypeComboBox->addItem(typeNames[4], 4); ui_->equationsTree->setColumnCount(NUM_EQUATIONS_TREE_COLUMNS); ui_->equationsTree->setHeaderLabels(QStringList() << tr("Equation")); QFontMetrics fm = fontMetrics(); int rowHeight = fm.height() + fm.ascent(); QHeaderView* vHeader = ui_->pointsTable->verticalHeader(); #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) vHeader->setSectionResizeMode(QHeaderView::Fixed); #else vHeader->setResizeMode(QHeaderView::Fixed); #endif vHeader->setDefaultSectionSize(rowHeight); ui_->pointsTable->setColumnCount(NUM_POINTS_TABLE_COLUMNS); ui_->pointsTable->setHorizontalHeaderLabels(QStringList() << tr("Type") << tr("Value") << tr("Is phantom?") << tr("Has slope?") << tr("Slope") << tr("Time")); //ui_->pointsTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch); // QDoubleValidator* validator = new QDoubleValidator(0.0, 1000.0, 1, this); // validator->setNotation(QDoubleValidator::StandardNotation); // ui_->ruleDurationLineEdit->setValidator(validator); // ui_->beatLineEdit->setValidator(validator); // ui_->mark1LineEdit->setValidator(validator); // ui_->mark2LineEdit->setValidator(validator); // ui_->mark3LineEdit->setValidator(validator); ui_->ruleDurationSpinBox->setRange(PARAMETERS_MIN, PARAMETERS_MAX); ui_->ruleDurationSpinBox->setDecimals(PARAMETERS_DECIMALS); ui_->beatSpinBox->setRange(PARAMETERS_MIN, PARAMETERS_MAX); ui_->beatSpinBox->setDecimals(PARAMETERS_DECIMALS); ui_->mark1SpinBox->setRange(PARAMETERS_MIN, PARAMETERS_MAX); ui_->mark1SpinBox->setDecimals(PARAMETERS_DECIMALS); ui_->mark2SpinBox->setRange(PARAMETERS_MIN, PARAMETERS_MAX); ui_->mark2SpinBox->setDecimals(PARAMETERS_DECIMALS); ui_->mark3SpinBox->setRange(PARAMETERS_MIN, PARAMETERS_MAX); ui_->mark3SpinBox->setDecimals(PARAMETERS_DECIMALS); connect(ui_->transitionWidget, SIGNAL(pointCreationRequested(unsigned int, float, float)), this, SLOT(createPoint(unsigned int, float, float))); }
RemoteMachineMonitorDialogImpl::RemoteMachineMonitorDialogImpl( QWidget * p, RemoteMachineMonitor* monitor, bool runTaskMode ) : QDialog( p ), PING_YES( ":core/images/remote_machine_ping_yes.png" ), PING_NO( ":core/images/remote_machine_ping_no.png" ), PING_WAIT_FOR_RESPONSE( ":core/images/remote_machine_ping_waiting_response.png" ), PING_QUESTION(":core/images/question.png"), rmm(monitor), getPublicMachinesTask( NULL ) { setupUi( this ); // add log-view widget QVBoxLayout* logLayout = new QVBoxLayout(); logViewHolder->setLayout(logLayout); LogViewWidget* logView = new LogViewWidget(prepareLogFilter()); logView->setSearchBoxMode(LogViewSearchBox_Hidden); logLayout->addWidget(logView); currentlySelectedItemIndex = -1; assert(rmm != NULL); QList< RemoteMachineSettingsPtr > monitorItems = rmm->getRemoteMachineMonitorItems(); int sz = monitorItems.size(); for( int i = 0; i < sz; ++i ) { const RemoteMachineSettingsPtr& item = monitorItems.at( i ); addMachineSettings( item, false ); } rsLog.details(tr("Found %1 remote machine records").arg(sz)); connect( okPushButton, SIGNAL( clicked() ), SLOT( sl_okPushButtonClicked() ) ); connect( cancelPushButton, SIGNAL( clicked() ), SLOT( sl_cancelPushButtonClicked() ) ); connect( addPushButton, SIGNAL( clicked() ), SLOT( sl_addPushButtonClicked() ) ); connect( removePushButton, SIGNAL( clicked() ), SLOT( sl_removePushButtonClicked() ) ); connect( modifyPushButton, SIGNAL( clicked() ), SLOT( sl_modifyPushButtonClicked() ) ); connect( showTasksButton, SIGNAL(clicked()), SLOT(sl_showUserTasksButtonClicked()) ); connect( machinesTreeWidget, SIGNAL( itemSelectionChanged() ), SLOT( sl_selectionChanged() ) ); connect( pingPushButton, SIGNAL( clicked() ), SLOT( sl_pingPushButtonClicked() ) ); connect( getPublicMachinesButton, SIGNAL( clicked() ), SLOT( sl_getPublicMachinesButtonClicked() ) ); okPushButton->setDefault( true ); QHeaderView * header = machinesTreeWidget->header(); header->setStretchLastSection( false ); #if (QT_VERSION < 0x050000) //Qt 5 header->setClickable( false ); header->setResizeMode( 1, QHeaderView::Stretch ); #else header->setSectionsClickable( false ); header->setSectionResizeMode( 1, QHeaderView::Stretch ); #endif if( runTaskMode ) { okPushButton->setText( OK_BUTTON_RUN ); } initMachineActionsMenu(); updateState(); }
UpdateCenterImpl::UpdateCenterImpl(Updates *updates, bool autoDownloadAndInstall, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); // resize for macosx #ifndef Q_OS_WIN32 resize(630, 366); #endif closedByButton = false; // version lblxVSTVersion->setText(QString(lblxVSTVersion->text()).arg(PROGRAM_VERSION)); // set update class this->updates = updates; // configure updates list QStringList headers; headers << tr(" File ") << tr(" Version ") << tr(" Size ") << tr(" Progress "); // add the headers lsvUpdates->setHeaderLabels(headers); // change headers sizes QFontMetrics fm = fontMetrics(); QHeaderView *header = lsvUpdates->header(); // resize header->resizeSection(1, fm.width(headers.at(0) + "9.99.999 alpha")); header->resizeSection(2, fm.width(headers.at(1) + " 1024,99Mb ")); // configure resize mode header->setHighlightSections(false); header->setStretchLastSection(false); header->setSectionResizeMode(0, QHeaderView::Stretch); // set header text aligment QTreeWidgetItem * headerItem = lsvUpdates->headerItem(); headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter); headerItem->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter); // fill data fillUpdates(); // signals connect(lsvUpdates, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*, int))); connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked())); connect(btnUpdate, SIGNAL(clicked()), this, SLOT(btnUpdateClicked())); // updater connect(updates, SIGNAL(downloadingUpdate(int, int, int)), this, SLOT(downloadingUpdate(int, int, int))); connect(updates, SIGNAL(downloadUpdateFinished(int)), this, SLOT(downloadUpdateFinished(int))); connect(updates, SIGNAL(downloadUpdateError(int)), this, SLOT(downloadUpdateError(int))); connect(updates, SIGNAL(downloadsFinished()), this, SLOT(downloadsFinished())); connect(updates, SIGNAL(readyToInstallUpdates()), this, SLOT(readyToInstallUpdates())); connect(updates, SIGNAL(failedToInstallUpdates()), this, SLOT(failedToInstallUpdates())); // if auto download & install updates, then... if (autoDownloadAndInstall) { // disable update button lsvUpdates->setEnabled(false); btnUpdate->setEnabled(false); // start automatically to download updates (in 500ms) QTimer::singleShot(500, this, SLOT(btnUpdateClicked())); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->tableView->setModel(new MultiplicationTableModel(10, 10, this)); QHeaderView *horizontalHeader = ui->tableView->horizontalHeader(); if(horizontalHeader) { horizontalHeader->setSectionResizeMode(QHeaderView::Stretch); } QHeaderView *verticalHeader = ui->tableView->verticalHeader(); if(verticalHeader) { verticalHeader->setSectionResizeMode(QHeaderView::Stretch); } }
TilesetView::TilesetView(QWidget *parent) : QTableView(parent) , mZoomable(0) , mMapDocument(0) , mEditTerrain(false) , mEraseTerrain(false) , mTerrainId(-1) , mHoveredCorner(0) , mTerrainChanged(false) { setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setItemDelegate(new TileDelegate(this, this)); setShowGrid(false); QHeaderView *hHeader = horizontalHeader(); QHeaderView *vHeader = verticalHeader(); hHeader->hide(); vHeader->hide(); #if QT_VERSION >= 0x050000 hHeader->setSectionResizeMode(QHeaderView::ResizeToContents); vHeader->setSectionResizeMode(QHeaderView::ResizeToContents); #else hHeader->setResizeMode(QHeaderView::ResizeToContents); vHeader->setResizeMode(QHeaderView::ResizeToContents); #endif hHeader->setMinimumSectionSize(1); vHeader->setMinimumSectionSize(1); // Hardcode this view on 'left to right' since it doesn't work properly // for 'right to left' languages. setLayoutDirection(Qt::LeftToRight); Preferences *prefs = Preferences::instance(); mDrawGrid = prefs->showTilesetGrid(); grabGesture(Qt::PinchGesture); connect(prefs, SIGNAL(showTilesetGridChanged(bool)), SLOT(setDrawGrid(bool))); }
void DischargeItemTable::setVariable(const Quantity * s) { if (_variable != s) { _variable = s; QStringList headers; headers << tr("Radionuclides") << s->displayTextWithUnit(); setHorizontalHeaderLabels(headers); //modify resize mode QHeaderView * header = this->horizontalHeader(); if (header != 0) { #if QT_VERSION >= 0x050000 header->setSectionResizeMode(0, QHeaderView::Interactive); header->setSectionResizeMode(1, QHeaderView::ResizeToContents); #else header->setResizeMode(0, QHeaderView::Interactive); header->setResizeMode(1, QHeaderView::ResizeToContents); #endif } } }
void FormStudents::Init() { ui->tableView->setModel(model); ui->tableView->setColumnHidden(0, true); ui->tableView->show(); model->setHeaderData(1, Qt::Horizontal, "ФИО Студента"); QHeaderView *pHW = ui->tableView->horizontalHeader(); //Нрмальный размер колонок int count = pHW->count(); for (int i = 0; i < count; i++) pHW->setSectionResizeMode(i,QHeaderView::ResizeToContents); }