TilesetView::TilesetView(MapDocument *mapDocument, QWidget *parent) : QTableView(parent) , mZoomable(new Zoomable(this)) , mMapDocument(mapDocument) { setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setItemDelegate(new TileDelegate(this, this)); setShowGrid(false); QHeaderView *header = horizontalHeader(); header->hide(); header->setResizeMode(QHeaderView::ResizeToContents); header->setMinimumSectionSize(1); header = verticalHeader(); header->hide(); header->setResizeMode(QHeaderView::ResizeToContents); header->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(); connect(mZoomable, SIGNAL(scaleChanged(qreal)), SLOT(adjustScale())); connect(prefs, SIGNAL(showTilesetGridChanged(bool)), SLOT(setDrawGrid(bool))); }
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); }
BodyStateViewImpl::BodyStateViewImpl(BodyStateView* self) : self(self) { self->setDefaultLayoutArea(View::BOTTOM); QVBoxLayout* vbox = new QVBoxLayout(); stateTreeWidget.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); stateTreeWidget.setSelectionMode(QAbstractItemView::NoSelection); stateTreeWidget.setAlternatingRowColors(true); stateTreeWidget.setVerticalGridLineShown(true); stateTreeWidget.setAllColumnsShowFocus(true); stateTreeWidget.setHeaderHidden(true); stateTreeWidget.setRootIsDecorated(false); QHeaderView* header = stateTreeWidget.header(); header->setStretchLastSection(false); header->setMinimumSectionSize(0); stateTreeWidget.setColumnCount(1); vbox->addWidget(&stateTreeWidget); self->setLayout(vbox); self->sigActivated().connect(boost::bind(&BodyStateViewImpl::onActivated, this, true)); self->sigDeactivated().connect(boost::bind(&BodyStateViewImpl::onActivated, this ,false)); //self->enableFontSizeZoomKeys(true); }
PropertiesView::PropertiesView(Type type, QWidget *parent) : QTableView(parent), m_molecule(NULL), m_widget(NULL) { m_type = type; QString title; switch(type){ case AtomType: title = tr("Atom Properties"); break; case BondType: title = tr("Bond Properties"); break; case AngleType: title = tr("Angle Properties"); break; case TorsionType: title = tr("Torsion Properties"); break; /*case CartesianType: title = tr("Cartesian Properties"); break;*/ case ConformerType: title = tr("Conformer Properties"); break; default: break; } this->setWindowTitle(title); QHeaderView *horizontal = this->horizontalHeader(); horizontal->setResizeMode(QHeaderView::Interactive); horizontal->setMinimumSectionSize(75); QHeaderView *vertical = this->verticalHeader(); vertical->setResizeMode(QHeaderView::Interactive); vertical->setMinimumSectionSize(30); vertical->setDefaultAlignment(Qt::AlignCenter); // Don't allow selecting everything setCornerButtonEnabled(false); // Alternating row colors setAlternatingRowColors(true); // Allow sorting the table setSortingEnabled(true); }
KickViewHeaderedWidget::KickViewHeaderedWidget(KickView& kickView) { kickViewWidget = new KickViewWidget(kickView, parameters, this); fileName = QString("noName.kmc"); setWidget(kickViewWidget); QHeaderView* headerView = getHeaderView(); headerView->setMinimumSectionSize(30); headerView->resizeSection(0, 100); headerView->resizeSection(1, 100); }
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))); }
SensorHeaderedWidget::SensorHeaderedWidget(SensorView& sensorView, RobotConsole& console) { QStringList headerLabels; headerLabels << "Sensor" << "Value"; setHeaderLabels(headerLabels, "lr"); QHeaderView* headerView = getHeaderView(); headerView->setMinimumSectionSize(50); headerView->resizeSection(0, 80); headerView->resizeSection(1, 50); sensorWidget = new SensorWidget(sensorView, headerView, this); setWidget(sensorWidget); }
StatisticRobotHeaderedWidget::StatisticRobotHeaderedWidget(StatisticRobotView& statisticRobotView) { QStringList headerLabels; headerLabels << "Property" << "Value"; setHeaderLabels(headerLabels, "ll"); QHeaderView* headerView = getHeaderView(); headerView->setMinimumSectionSize(70); headerView->resizeSection(0, 130); headerView->resizeSection(1, 70); statisticRobotWidget = new StatisticRobotWidget(statisticRobotView, headerView, this); setWidget(statisticRobotWidget); connect(getHeaderView(), SIGNAL(sectionResized(int, int, int)), statisticRobotWidget, SLOT(forceUpdate())); }
TilesetView::TilesetView(MapDocument *mapDocument, QWidget *parent) : QTableView(parent) , mZoomable(new Zoomable(this)) , mMapDocument(mapDocument) { setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); setItemDelegate(new TileDelegate(this)); setShowGrid(false); QHeaderView *header = horizontalHeader(); header->hide(); header->setResizeMode(QHeaderView::ResizeToContents); header->setMinimumSectionSize(1); header = verticalHeader(); header->hide(); header->setResizeMode(QHeaderView::ResizeToContents); header->setMinimumSectionSize(1); connect(mZoomable, SIGNAL(scaleChanged(qreal)), SLOT(adjustScale())); }
/*! Sets up the size of the headers. Does not work in the constructor because there is not any data or model */ void AnalysesTableView::resizeHeaders(){ QHeaderView* hHeader = horizontalHeader(); hHeader->setMinimumSectionSize(10); hHeader->resizeSection(hHeader->logicalIndex(0), 30);//Check box hHeader->resizeSection(hHeader->logicalIndex(1), 50);//ID hHeader->resizeSection(hHeader->logicalIndex(2), 50);//Network id hHeader->resizeSection(hHeader->logicalIndex(3), 50);//Archive ID hHeader->resizeSection(hHeader->logicalIndex(4), 80);//Time hHeader->resizeSection(hHeader->logicalIndex(5), 200);//Description hHeader->resizeSection(hHeader->logicalIndex(6), 50);//Parameters hHeader->resizeSection(hHeader->logicalIndex(7), 50);//type hHeader->setDefaultAlignment(Qt::AlignLeft); }
QWidget* SensorView::createWidget() { HeaderedWidget* widget = new HeaderedWidget(); QStringList headerLabels; headerLabels << "Sensor" << "Value" << "Filtered"; widget->setHeaderLabels(headerLabels, "lrr"); QHeaderView* headerView = widget->getHeaderView(); sensorWidget = new SensorWidget(*this, console, headerView, widget); widget->setWidget(sensorWidget); headerView->setMinimumSectionSize(30); headerView->resizeSection(0, 60); headerView->resizeSection(1, 50); headerView->resizeSection(2, 50); return widget; }
/*! Sets up the size of the headers. Does not work in the constructor because there is not any data or model */ void NeuronParametersView::resizeHeaders(){ QHeaderView* hHeader = horizontalHeader(); hHeader->setMinimumSectionSize(10); hHeader->resizeSection(hHeader->logicalIndex(0), 100);//Description QList<ParameterInfo> neuronParams = model->getParameterInfoList(); for(int i=0; i<neuronParams.size(); ++i){ int tmpParamLength = 10+neuronParams.at(i).getName().length() * 10; if(tmpParamLength < 40) tmpParamLength = 40; hHeader->resizeSection(hHeader->logicalIndex(i+1), tmpParamLength);//Parameter name } //Icon hHeader->resizeSection(hHeader->logicalIndex(neuronParams.size() + 1), 50);//Edit button hHeader->setDefaultAlignment(Qt::AlignLeft); }
QWidget* TimeView::createWidget() { HeaderedWidget* widget = new HeaderedWidget(); QStringList headerLabels; headerLabels << "Module" << "Min" << "Max" << "Avg" << "MinDelta" << "MaxDelta" << "AvgFreq"; widget->setHeaderLabels(headerLabels, "lrrrrrr"); QHeaderView* headerView = widget->getHeaderView(); timeWidget = new TimeWidget(console, info, headerView, widget); widget->setWidget(timeWidget); headerView->setMinimumSectionSize(30); headerView->resizeSection(0, 100); headerView->resizeSection(1, 50); headerView->resizeSection(2, 50); headerView->resizeSection(3, 50); headerView->resizeSection(4, 50); headerView->resizeSection(5, 50); headerView->resizeSection(6, 50); return widget; }
GraphViewBaseImpl::GraphViewBaseImpl(GraphViewBase* self) : self(self), graph(self) { treeWidget.setColumnCount(1); treeWidget.setHeaderHidden(true); treeWidget.setRootIsDecorated(false); treeWidget.setSelectionBehavior(QAbstractItemView::SelectRows); QHeaderView* header = treeWidget.header(); header->setMinimumSectionSize(0); header->setStretchLastSection(false); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) header->setResizeMode(0, QHeaderView::ResizeToContents); #else header->setSectionResizeMode(0, QHeaderView::ResizeToContents); #endif treeWidget.setSelectionMode(QAbstractItemView::ExtendedSelection); treeWidget.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); treeWidget.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); treeWidget.setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); leftvbox = new QVBoxLayout(); leftvbox->setSpacing(0); leftvbox->addWidget(&treeWidget); QHBoxLayout* hbox = new QHBoxLayout(); hbox->setSpacing(0); hbox->addLayout(leftvbox, 1); hbox->addWidget(&graph, 9999); self->setLayout(hbox); itemSelectionChangedConnection = ItemTreeView::mainInstance()->sigSelectionChanged().connect( boost::bind(&GraphViewBaseImpl::onItemSelectionChanged, this, _1)); partSelectionChangedConnection = treeWidget.sigItemSelectionChanged().connect( boost::bind(&GraphViewBaseImpl::updateSelections, this)); }
SalesOrderManager::SalesOrderManager(QWidget* parent) : QSplitter(parent) { model = new SalesOrderModel(this); proxyModel = new SalesOrderProxyModel(this); proxyModel->setSourceModel(model); QWidget* container = new QWidget(this); QBoxLayout* containerLayout = new QVBoxLayout(container); containerLayout->setMargin(0); QString actionTooltip("%1<br><b>%2</b>"); QToolBar* toolBar = new QToolBar(container); toolBar->setIconSize(QSize(16, 16)); QAction* refreshAction = toolBar->addAction(QIcon(":/resources/icons/refresh.png"), "&Muat Ulang", this, SLOT(refresh())); refreshAction->setShortcut(QKeySequence("F5")); refreshAction->setToolTip(actionTooltip.arg("Muat ulang daftar pesanan").arg(refreshAction->shortcut().toString())); QAction* newAction = toolBar->addAction(QIcon(":/resources/icons/plus.png"), "&Baru", this, SLOT(openEditor())); newAction->setShortcut(QKeySequence("Ctrl+N")); newAction->setToolTip(actionTooltip.arg("Pesanan baru").arg(newAction->shortcut().toString())); QAction* closeTabAction = new QAction(this); closeTabAction->setShortcuts(QList<QKeySequence>({QKeySequence("Esc"), QKeySequence("Ctrl+W")})); addAction(closeTabAction); QAction* closeAllTabsAction = new QAction(this); closeAllTabsAction->setShortcut(QKeySequence("Ctrl+Shift+W")); addAction(closeAllTabsAction); containerLayout->addWidget(toolBar); QLabel* spacer = new QLabel(toolBar); spacer->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); toolBar->addWidget(spacer); stateComboBox = new QComboBox(toolBar); stateComboBox->setToolTip("Saring daftar pesanan berdasarkan status"); stateComboBox->addItem("Semua"); stateComboBox->addItem("Aktif"); stateComboBox->addItem("Selesai"); stateComboBox->addItem("Dibatalkan"); stateComboBox->setCurrentIndex(1); toolBar->addWidget(stateComboBox); searchEdit = new QLineEdit(toolBar); searchEdit->setToolTip("Cari di daftar pesanan"); searchEdit->setPlaceholderText("Cari"); searchEdit->setClearButtonEnabled(true); searchEdit->setMaxLength(100); searchEdit->setMaximumWidth(150); toolBar->addWidget(searchEdit); view = new QTableView(container); view->setToolTip("Klik ganda atau ketuk Enter untuk membuka pesanan"); view->setModel(proxyModel); view->setAlternatingRowColors(true); view->setSortingEnabled(true); view->setSelectionMode(QAbstractItemView::SingleSelection); view->setSelectionBehavior(QAbstractItemView::SelectRows); view->setTabKeyNavigation(false); QHeaderView* header = view->verticalHeader(); header->setVisible(false); header->setMinimumSectionSize(20); header->setMaximumSectionSize(20); header->setDefaultSectionSize(20); header = view->horizontalHeader(); header->setToolTip("Klik pada header kolom untuk mengurutkan"); header->setHighlightSections(false); containerLayout->addWidget(view); infoLabel = new QLabel(container); infoLabel->setStyleSheet("font-style:italic;padding-bottom:1px;"); infoLabel->setTextInteractionFlags(Qt::TextBrowserInteraction); containerLayout->addWidget(infoLabel); tabWidget = new QTabWidget(this); tabWidget->setDocumentMode(true); tabWidget->setTabsClosable(true); tabWidget->setMovable(true); tabWidget->hide(); setCollapsible(0, false); setCollapsible(1, false); connect(closeTabAction, SIGNAL(triggered(bool)), SLOT(closeCurrentTab())); connect(closeAllTabsAction, SIGNAL(triggered(bool)), SLOT(closeAllTabs())); connect(tabWidget, SIGNAL(tabCloseRequested(int)), SLOT(closeTab(int))); connect(stateComboBox, SIGNAL(currentIndexChanged(int)), SLOT(refresh())); connect(searchEdit, SIGNAL(textChanged(QString)), SLOT(applyFilter())); connect(view, SIGNAL(activated(QModelIndex)), SLOT(edit())); QTimer::singleShot(0, this, SLOT(init())); }
//-------------------------------------------------------------------------------------- //! Defines the work for constructor //-------------------------------------------------------------------------------------- void tDataSourcesDialog::Init( const QList<tDataFilter*>& filters, tDataType selDataType /* = DATA_TYPE_INVALID*/, int selInstance /* = 0*/, tDataCategory selCategory /* = DATA_CATEGORY_INVALID*/, const QString& title /* = QString()*/ ) { setWindowTitle( title ); // grab the screen size so we can adapt to it QSize screenResolution = tProductSettings::Instance().ScreenResolution(); m_pDataModel = new tDataSourceTreeModel( *m_pSourceSelection->GetSourceSettings(), filters ); m_pTreeView = new tTreeView( this ); m_pTreeView->setModel( m_pDataModel ); m_pTreeView->setHeaderHidden( true ); m_pTreeView->setTextElideMode( Qt::ElideMiddle ); if ( tProductSettings::Instance().ProductSupportsTouch() ) { int largeIconSize = style()->pixelMetric( QStyle::PM_LargeIconSize ); m_pTreeView->setIconSize( QSize(largeIconSize, largeIconSize) ); QHeaderView* pHeaderView = m_pTreeView->header(); if ( m_pDataModel->columnCount() == tDataSourceTreeItem::Columns_Count ) { pHeaderView->setResizeMode( tDataSourceTreeItem::Columns_Icon, QHeaderView::ResizeToContents ); } pHeaderView->setResizeMode( tDataSourceTreeItem::Columns_Name, QHeaderView::Stretch ); pHeaderView->setStretchLastSection( false ); // This is creating the padding about the menu icon. // Remove it if it's too much. pHeaderView->setMinimumSectionSize(largeIconSize); } m_pTreeView->show(); if( tUiSettings::Instance()->ShowTouchToolTips() ) { m_pTreeView->setToolTip( tr("Tap-and-hold for more options.") ); } else { if( tProductSettings::Instance().ProductSupportsMenuKey() == false ) { // Kiwi m_pTreeView->setToolTip( tr("Press and hold pages for more options.") ); } else { m_pTreeView->setToolTip( tr("Press %1 for more options.").arg(BUTTON_HTML(tNOSStyle::FP_ButtonImageMENU, "MENU")) ); } } if( tProductSettings::Instance().ProductSupportsMenuKey() == false ) { // only KIWI at the moment m_pTreeView->setProperty( "RemapLongPressPagesToMenuKey", true ); } m_SelectedSource = tDataId(); // invalid data m_SelectedData = DATA_TYPE_INVALID; m_SelectedInstance = -1; // Status bar m_pValue = new QLabel(""); m_pWidgetLayout = new QGridLayout(); m_pWidgetLayout->addWidget( m_pValue ); m_pDialogLayout = new QVBoxLayout(); m_pDialogLayout->addWidget( m_pTreeView ); if (screenResolution.height() > 240) { //Group box m_pGroupBox1 = new QGroupBox( "" ); m_pGroupBox1->setLayout( m_pWidgetLayout ); m_pDialogLayout->addWidget( m_pGroupBox1 ); } else { m_pDialogLayout->setContentsMargins( 0, 0, 0, 3 ); m_pDialogLayout->addLayout( m_pWidgetLayout ); } setLayout( m_pDialogLayout ); // if we have a SKB keys don't have focus, else hide keys m_NumKeys = 0; SoftKeyBar()->ExplicitHide(); CreateActions(); //todo - check whether we can call this directly instead of signals/slots Connect( this, SIGNAL( CloseRequested() ), this, SLOT( accept() ) ); Connect( this, SIGNAL(ShowSimnetAutoSelectionConfirmation( QWidget* )), m_pDataSourceMonitor, SLOT(ShowSimnetAutoSelectionConfirmation( QWidget* )), Qt::QueuedConnection ); Connect( m_pTreeView, SIGNAL( ItemSelectionChanged( const QModelIndex & ) ), this, SLOT( OnItemSelectionChanged( const QModelIndex & ) ) ); Connect( m_pTreeView, SIGNAL( activated( const QModelIndex& ) ), this, SLOT( OnItemClicked( const QModelIndex& ) ) ); Connect( m_pDataModel, SIGNAL( ModelAboutToBeRefreshed() ), this, SLOT( OnModelAboutToBeRefreshed() ) ); Connect( m_pDataModel, SIGNAL( ModelRefreshed() ), this, SLOT( OnModelRefreshed() ) ); QModelIndex selIndex; if( selDataType != DATA_TYPE_INVALID ) { selIndex = m_pDataModel->FindSelectedData( selDataType, selInstance ); } else if( selCategory != DATA_CATEGORY_INVALID ) { selIndex = m_pDataModel->FindCategory( selCategory ); } else { selIndex = m_pDataModel->index( 0, 0 ); } m_pTreeView->setCurrentIndex( selIndex ); //m_pTreeView->addAction( m_pEngineNumSetAct ); OnItemSelectionChanged( selIndex ); m_TimerId = startTimer( 1000 ); }
void PlotSettingsDialog::setupSourceTable(const QStringList &dataSeriesNames, const PlotSettings &preset, bool offsetsEditable) { ui->sourceTable->setColumnCount(COLCOUNT); QTableWidgetItem *sourceNameColHeader = new QTableWidgetItem(tr("Data Series Name")); sourceNameColHeader->setToolTip(tr("The name of the data series.")); ui->sourceTable->setHorizontalHeaderItem(SOURCENAMECOL, sourceNameColHeader); QTableWidgetItem *offsetColHeader = new QTableWidgetItem(tr("Offset")); offsetColHeader->setToolTip(tr("The offset in milliseconds.\n\n" "This value is added to each timestamp\n" "of the respective data series.\n" "You can use this for example to adjust for\n" "time lags in the transmission of signals.")); ui->sourceTable->setHorizontalHeaderItem(OFFSETCOL, offsetColHeader); QTableWidgetItem *scaleColHeader = new QTableWidgetItem(tr("Scale Type")); if (offsetsEditable) { scaleColHeader->setToolTip(tr("The <i>default</i> type of scale to be used for the data series.")); } else { scaleColHeader->setToolTip(tr("The type of scale to be used for the data series.")); } ui->sourceTable->setHorizontalHeaderItem(SCALECOL, scaleColHeader); QHeaderView *hHeader = ui->sourceTable->horizontalHeader(); hHeader->setDefaultAlignment(Qt::AlignLeft); hHeader->setResizeMode(SOURCENAMECOL, QHeaderView::Stretch); hHeader->setResizeMode(OFFSETCOL, QHeaderView::ResizeToContents); hHeader->setResizeMode(SCALECOL, QHeaderView::ResizeToContents); hHeader->setMinimumSectionSize(120); QHeaderView *vHeader = ui->sourceTable->verticalHeader(); vHeader->setVisible(false); foreach (QString sourceName, dataSeriesNames) { int row = ui->sourceTable->rowCount(); ui->sourceTable->setRowCount(row + 1); QTableWidgetItem *sourceItem = new QTableWidgetItem(sourceName); // the item showing the data series name should not be editable sourceItem->setFlags(sourceItem->flags() & ~Qt::ItemIsEditable); ui->sourceTable->setItem(row, SOURCENAMECOL, sourceItem); QDoubleSpinBox *offsetSpinner = new QDoubleSpinBox(ui->sourceTable); offsetSpinner->setAlignment(Qt::AlignRight); // helps to set the min/max before you set the value ;) offsetSpinner->setMinimum(0.0); offsetSpinner->setMaximum(std::numeric_limits<double>::max()); offsetSpinner->setDecimals(qRound(qLn(OFFSETDIVISOR)/qLn(10))); offsetSpinner->setValue(preset.offset(sourceName)/OFFSETDIVISOR); offsetSpinner->setEnabled(offsetsEditable); ui->sourceTable->setCellWidget(row, OFFSETCOL, offsetSpinner); if (preset.scaleType(sourceName) == PlotSettings::NOT_SCALABLE) { QTableWidgetItem *scaleItem = new QTableWidgetItem(tr("n/a")); scaleItem->setFlags(scaleItem->flags() & ~Qt::ItemIsEditable); ui->sourceTable->setItem(row, SCALECOL, scaleItem); } else { QComboBox *scaleCombo = new QComboBox(); scaleCombo->addItems(PlotSettings::scaleTypeNames); scaleCombo->setCurrentIndex(preset.scaleType(sourceName)); ui->sourceTable->setCellWidget(row, SCALECOL, scaleCombo); } }