FormPrefEmail::FormPrefEmail(QWidget* parent, Qt::WFlags fl) : EVentana( parent, fl ), Ui::FormPrefEmailBase() { setupUi(this); servidores = new EServidorEmail( LVServidores ); LVServidores->setModel( servidores ); LVServidores->setModelColumn( servidores->fieldIndex( "nombre" ) ); mapeador = new QDataWidgetMapper( this ); mapeador->setModel( servidores ); mapeador->addMapping( LENombre, servidores->fieldIndex( "nombre" ) ); mapeador->addMapping( LEDireccion, servidores->fieldIndex( "direccion" ) ); mapeador->addMapping( SBPuerto, servidores->fieldIndex( "puerto" ) ); mapeador->addMapping( LEUsuario, servidores->fieldIndex( "usuario" ) ); mapeador->addMapping( LEPass, servidores->fieldIndex( "pass" ) ); mapeador->addMapping( CkBPredeterminado, servidores->fieldIndex( "predeterminado" ) ); mapeador->addMapping( LEFrom, servidores->fieldIndex( "de" ) ); mapeador->setSubmitPolicy( QDataWidgetMapper::ManualSubmit ); connect(LVServidores->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapeador, SLOT(setCurrentModelIndex(QModelIndex))); mapeador->toFirst(); connect( PBAgregar, SIGNAL( clicked() ), this, SLOT( agregar() ) ); connect( PBEliminar, SIGNAL( clicked() ), this, SLOT( eliminar() ) ); PBAgregar->setIcon( QIcon( ":/imagenes/add.png" ) ); PBEliminar->setIcon( QIcon( ":/imagenes/stop.png" ) ); this->setWindowTitle( "Servidor Em@il" ); this->setWindowIcon( QIcon( ":/imagenes/servidor_email.png" ) ); }
FindArticeDialog::FindArticeDialog(QWidget *parent) : QDialog(parent), ui(new Ui::FindArticeDialog) { ui->setupUi(this); db = QSqlDatabase::database("CheckGenerator"); quArticle = new QSqlQuery(db); if(!quArticle->exec("select ArticleName,ArticleNo " "from Article " "/*where exists(select * from BarCode where BarCode.ArticleNo=Article.ArticleNo) */" "order by ArticleName")) { qDebug()<<quArticle->lastError().text(); } moArticle = new QSqlQueryModel(); moArticle->setQuery(*quArticle); moArticle->setHeaderData(0, Qt::Horizontal, tr("Наименование")); moArticle->setHeaderData(1, Qt::Horizontal, tr("Код")); ui->tvArticle->setModel(moArticle); ui->tvArticle->resizeColumnsToContents(); ui->tvArticle->setSelectionMode(QAbstractItemView::SingleSelection); ui->tvArticle->setSelectionBehavior(QAbstractItemView::SelectRows); ui->tvArticle->setTabKeyNavigation(false); mapper = new QDataWidgetMapper(this); mapper->setModel(moArticle); //mapper->addMapping(ui->lineEdit, 0); connect(ui->tvArticle->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); // mapper->setCurrentModelIndex(ui->tvArticle->selectionModel()->currentIndex()); /*centered*/ this->move(QApplication::desktop()->screen()->rect().center() - this->rect().center()); setWindowState(this->windowState()^Qt::WindowMaximized); setWindowFlags(Qt::WindowMaximizeButtonHint); /*hooking kew down*/ ui->leSearchString->installEventFilter(this); connect(ui->leSearchString,SIGNAL(textChanged(QString)),this,SLOT(StringToFindChanged(QString))); ui->groupBox_2->setTitle(""); CreateVirtualKeyboard(); ui->pbOK->setFocusPolicy(Qt::NoFocus); ui->pbCancel->setFocusPolicy(Qt::NoFocus); ui->leSearchString->setFocusPolicy(Qt::NoFocus); }
void TreeComboBox::initialize() { _treeView->setModel(const_cast<TaskModel*>(_model)); _treeView->setColumnHidden(1, true); _treeView->setColumnHidden(2, true); _treeView->setColumnHidden(3, true); _treeView->setColumnHidden(4, true); setCurrentModelIndex(QModelIndex()); // populate(root); }
InfoDialog::InfoDialog(QWidget *parent, int user_id, int num) : QDialog(parent), ui(new Ui::InfoDialog) { ui->setupUi(this); setWindowTitle("我的借阅信息"); currentUserId = user_id; num_can_borrow = num; model = new QSqlRelationalTableModel(ui->tableView); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->setTable("borrowed_books"); model->setRelation(model->fieldIndex("book_id"), QSqlRelation("books", "id", "title")); model->setHeaderData(model->fieldIndex("book_id"), Qt::Horizontal, tr("名称")); model->setHeaderData(model->fieldIndex("start_time"), Qt::Horizontal, tr("借阅起始时间")); model->setHeaderData(model->fieldIndex("end_time"), Qt::Horizontal, tr("借阅到期时间")); ui->tableView->setModel(model); ui->tableView->setColumnHidden(model->fieldIndex("id"), true); ui->tableView->setColumnHidden(model->fieldIndex("user_id"), true); ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection); ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); idHiddenWidget = new QLineEdit(this); idHiddenWidget->setVisible(false); QDataWidgetMapper *mapper = new QDataWidgetMapper(this); mapper->setModel(model); mapper->addMapping(idHiddenWidget, model->fieldIndex("id")); connect(ui->tableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); model->setFilter("user_id='" + QString::number(currentUserId) + "'"); model->select(); connect(ui->getbackButton, SIGNAL(clicked()), this, SLOT(getback())); connect(ui->confirmButton, SIGNAL(clicked()), this, SLOT(confirm())); }
HAlarm::HAlarm(QWidget *parent, QSqlDatabase pdb, HUser *puser) : QWidget(parent), ui(new Ui::HAlarm) { ui->setupUi(this); updateButtons(true,true,true,false,false); db=pdb; action="n"; user=puser; if (!db.isOpen()) { QMessageBox::warning(this,QApplication::applicationName(),"Attenzione: connessioe chiusa, riloggare",QMessageBox::Ok); } mod= new QSqlTableModel(0,db); mod->setTable("notifiche"); mod->setSort(1,Qt::DescendingOrder); mod->select(); usermod=new QSqlTableModel(0,db); usermod->setTable("utenti"); usermod->setFilter("attivo > 0"); usermod->setSort(4,Qt::AscendingOrder); usermod->select(); groupmod=new QSqlTableModel(0,db); groupmod->setTable("gruppi"); groupmod->setSort(1,Qt::AscendingOrder); groupmod->select(); getTypes(); ui->lvTarget->setModel(groupmod); ui->lvTarget->setModelColumn(1); ui->lvTarget->selectionModel()->setCurrentIndex(ui->lvTarget->model()->index(0,0),QItemSelectionModel::SelectCurrent); ui->tvMain->setModel(mod); ui->tvMain->setCurrentIndex(mod->index(0,0)); ui->tvMain->setColumnHidden(0,true); ui->tvMain->setColumnHidden(3,true); ui->tvMain->setColumnHidden(4,true); ui->tvMain->setColumnHidden(6,true); ui->tvMain->setColumnHidden(7,true); ui->tvMain->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); toggleUIInteractivity(false); QDataWidgetMapper *wmap=new QDataWidgetMapper(); wmap->setModel(mod); wmap->addMapping(ui->deData,1); wmap->addMapping(ui->cbTipo,2,"currentText"); wmap->addMapping(ui->ptDescrizione,5); wmap->addMapping(ui->cbAttiva,7); wmap->addMapping(ui->leCreator,8); wmap->toFirst(); ui->tvMain->setCurrentIndex(ui->tvMain->model()->index(-1,0)); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),wmap,SLOT(setCurrentModelIndex(QModelIndex))); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(setUI())); connect(ui->tvMain->selectionModel(),SIGNAL(currentChanged(QModelIndex,QModelIndex)),this,SLOT(filterTargets())); ui->tvMain->setCurrentIndex(ui->tvMain->model()->index(0,0)); // setUI(); // filterTargets(); }
BookWindow::BookWindow() { ui.setupUi(this); if (!QSqlDatabase::drivers().contains("QSQLITE")) QMessageBox::critical(this, "Unable to load database", "This demo needs the SQLITE driver"); // initialize the database QSqlError err = initDb(); if (err.type() != QSqlError::NoError) { showError(err); return; } // Create the data model model = new QSqlRelationalTableModel(ui.bookTable); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->setTable("books"); // Remember the indexes of the columns authorIdx = model->fieldIndex("author"); genreIdx = model->fieldIndex("genre"); // Set the relations to the other database tables model->setRelation(authorIdx, QSqlRelation("authors", "id", "name")); model->setRelation(genreIdx, QSqlRelation("genres", "id", "name")); // Set the localized header captions model->setHeaderData(authorIdx, Qt::Horizontal, tr("Author Name")); model->setHeaderData(genreIdx, Qt::Horizontal, tr("Genre")); model->setHeaderData(model->fieldIndex("title"), Qt::Horizontal, tr("Title")); model->setHeaderData(model->fieldIndex("year"), Qt::Horizontal, tr("Year")); model->setHeaderData(model->fieldIndex("rating"), Qt::Horizontal, tr("Rating")); // Populate the model if (!model->select()) { showError(model->lastError()); return; } // Set the model and hide the ID column ui.bookTable->setModel(model); ui.bookTable->setItemDelegate(new BookDelegate(ui.bookTable)); ui.bookTable->setColumnHidden(model->fieldIndex("id"), true); ui.bookTable->setSelectionMode(QAbstractItemView::SingleSelection); // Initialize the Author combo box ui.authorEdit->setModel(model->relationModel(authorIdx)); ui.authorEdit->setModelColumn(model->relationModel(authorIdx)->fieldIndex("name")); ui.genreEdit->setModel(model->relationModel(genreIdx)); ui.genreEdit->setModelColumn(model->relationModel(genreIdx)->fieldIndex("name")); QDataWidgetMapper *mapper = new QDataWidgetMapper(this); mapper->setModel(model); mapper->setItemDelegate(new BookDelegate(this)); mapper->addMapping(ui.titleEdit, model->fieldIndex("title")); mapper->addMapping(ui.yearEdit, model->fieldIndex("year")); mapper->addMapping(ui.authorEdit, authorIdx); mapper->addMapping(ui.genreEdit, genreIdx); mapper->addMapping(ui.ratingEdit, model->fieldIndex("rating")); connect(ui.bookTable->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); ui.bookTable->setCurrentIndex(model->index(0, 0)); }
** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ //! [0] QDataWidgetMapper *mapper = new QDataWidgetMapper; mapper->setModel(model); mapper->addMapping(mySpinBox, 0); mapper->addMapping(myLineEdit, 1); mapper->addMapping(myCountryChooser, 2); mapper->toFirst(); //! [0] //! [1] QDataWidgetMapper *mapper = new QDataWidgetMapper(); mapper->setModel(myModel); mapper->addMapping(nameLineEdit, 0); mapper->addMapping(ageSpinBox, 1); //! [1] //! [2] QDataWidgetMapper *mapper = new QDataWidgetMapper(); connect(myTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); //! [2]
bool MainWindow::CreateConnection(QString dbDir){ //The sql database is created, and defined as SQLite qDebug()<<"Connection initiated"; db=QSqlDatabase::addDatabase("QSQLITE"); //db.setDatabaseName(QString("%1/%1").arg(dbDir)); QFileInfo *dbFile = new QFileInfo(dbDir); QDir::setCurrent(dbFile->absolutePath()); qDebug()<<"Set current directory to: "<<dbFile->absolutePath(); db.setDatabaseName(dbFile->fileName()); qDebug()<<db.databaseName(); if (!db.open()){ qDebug()<<"No Connection made to file"; return false; } qDebug()<<"DB Created"; dbmodel= new MySqlTableModel(this,db); //dbmodel->setEditStrategy(QSqlTableModel::OnManualSubmit); dbmodel->select(); //The main table is loaded. It contains all the main data. //The table view is prepared by setting the model and other options dbTableView->setModel(dbmodel); dbTableView->setSelectionBehavior(QAbstractItemView::SelectRows); //dbTableView->resizeColumnsToContents(); //The fields array is iterated and each data column in the model is named, while the ones which should not //be previewd in the table are hidden. mapper->setModel(dbmodel); for(int n=0;n<dbmodel->getFields().size();n++){ //dbmodel->setHeaderData(n,Qt::Horizontal,Fields[n][0]); if(!dbmodel->getField(n).getVisTable()){ dbTableView->hideColumn(n); } //Each field is checked to see whether it should appear in the preview frame. if (dbmodel->getField(n).getVisPreview()){ prwItems.push_back(new DisplayWidget(dbmodel->getField(n),false, frmPreview)); mapper->addMapping(prwItems.last(),n,"Value"); } } connect(dbTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); dbTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch); //Sets alternating Colors dbTableView->setAlternatingRowColors(true); dbTableView->setStyleSheet("alternate-background-color:#99DDFF;background-color:white;"); //sets no triggers to edit the information dbTableView->setEditTriggers(QAbstractItemView::NoEditTriggers); //qDebug()<<"EDIT StRATEGY "<<dbmodel->editStrategy(); return true; }
/* ********************************************************************* */ void OcularDialog::createDialogContent() { ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); ui->ccdListView->setModel(ccdTableModel); ui->ocularListView->setModel(ocularTableModel); ui->telescopeListView->setModel(telescopeTableModel); //Now the rest of the actions. connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(scaleImageCircleStateChanged(int))); connect(ui->requireSelectionCheckBox, SIGNAL(stateChanged(int)), this, SLOT(requireSelectionStateChanged(int))); connect(ui->checkBoxControlPanel, SIGNAL(clicked(bool)), plugin, SLOT(enableGuiPanel(bool))); connect(ui->checkBoxDecimalDegrees, SIGNAL(clicked(bool)), plugin, SLOT(setFlagDecimalDegrees(bool))); // The add & delete buttons connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD())); connect(ui->deleteCCD, SIGNAL(clicked()), this, SLOT(deleteSelectedCCD())); connect(ui->addOcular, SIGNAL(clicked()), this, SLOT(insertNewOcular())); connect(ui->deleteOcular, SIGNAL(clicked()), this, SLOT(deleteSelectedOcular())); connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTelescope())); connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSelectedTelescope())); // Validators ui->ccdName->setValidator(validatorName); ui->ccdResX->setValidator(validatorPositiveInt); ui->ccdResY->setValidator(validatorPositiveInt); ui->ccdChipX->setValidator(validatorPositiveDouble); ui->ccdChipY->setValidator(validatorPositiveDouble); ui->ccdPixelX->setValidator(validatorPositiveDouble); ui->ccdPixelY->setValidator(validatorPositiveDouble); ui->ocularAFov->setValidator(validatorOcularAFOV); ui->ocularFL->setValidator(validatorOcularEFL); ui->ocularFieldStop->setValidator(validatorOcularEFL); ui->telescopeFL->setValidator(validatorTelescopeFL); ui->telescopeDiameter->setValidator(validatorTelescopeDiameter); ui->ocularName->setValidator(validatorName); ui->telescopeName->setValidator(validatorName); // The key bindings QString bindingString = Oculars::appSettings()->value("bindings/toggle_oculars", "Ctrl+O").toString(); ui->togglePluginLineEdit->setText(bindingString); bindingString = Oculars::appSettings()->value("bindings/popup_navigator", "Alt+O").toString(); ui->togglePopupNavigatorWindowLineEdit->setText(bindingString); connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(keyBindingTogglePluginChanged(const QString&))); connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(keyBindingPopupNavigatorConfigChanged(const QString&))); initAboutText(); connect(ui->togglePluginLineEdit, SIGNAL(textEdited(QString)), this, SLOT(initAboutText())); connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(QString)), this, SLOT(initAboutText())); connect(ui->pushButtonMoveOcularUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedOcular())); connect(ui->pushButtonMoveOcularDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedOcular())); connect(ui->pushButtonMoveSensorUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedSensor())); connect(ui->pushButtonMoveSensorDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedSensor())); connect(ui->pushButtonMoveTelescopeUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedTelescope())); connect(ui->pushButtonMoveTelescopeDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedTelescope())); // The CCD mapper ccdMapper = new QDataWidgetMapper(); ccdMapper->setModel(ccdTableModel); ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ccdMapper->addMapping(ui->ccdName, 0); ccdMapper->addMapping(ui->ccdChipY, 1); ccdMapper->addMapping(ui->ccdChipX, 2); ccdMapper->addMapping(ui->ccdPixelY, 3); ccdMapper->addMapping(ui->ccdPixelX, 4); ccdMapper->addMapping(ui->ccdResX, 5); ccdMapper->addMapping(ui->ccdResY, 6); ccdMapper->toFirst(); connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ccdMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1)); // The ocular mapper ocularMapper = new QDataWidgetMapper(); ocularMapper->setModel(ocularTableModel); ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ocularMapper->addMapping(ui->ocularName, 0); ocularMapper->addMapping(ui->ocularAFov, 1); ocularMapper->addMapping(ui->ocularFL, 2); ocularMapper->addMapping(ui->ocularFieldStop, 3); ocularMapper->addMapping(ui->binocularsCheckBox, 4, "checked"); ocularMapper->toFirst(); connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ocularMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); // The telescope mapper telescopeMapper = new QDataWidgetMapper(); telescopeMapper->setModel(telescopeTableModel); telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); telescopeMapper->addMapping(ui->telescopeName, 0); telescopeMapper->addMapping(ui->telescopeDiameter, 1); telescopeMapper->addMapping(ui->telescopeFL, 2); telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked"); telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked"); ocularMapper->toFirst(); connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), telescopeMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1)); // set the initial state if (Oculars::appSettings()->value("require_selection_to_zoom", 1.0).toBool()) { ui->requireSelectionCheckBox->setCheckState(Qt::Checked); } if (Oculars::appSettings()->value("use_max_exit_circle", 0.0).toBool()) { ui->scaleImageCircleCheckBox->setCheckState(Qt::Checked); } if (Oculars::appSettings()->value("enable_control_panel", false).toBool()) { ui->checkBoxControlPanel->setChecked(true); } if (Oculars::appSettings()->value("use_decimal_degrees", false).toBool()) { ui->checkBoxDecimalDegrees->setChecked(true); } //Initialize the style updateStyle(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QString data_path = QStandardPaths::standardLocations(QStandardPaths::DataLocation).first(); QDir data_dir; data_dir.mkpath(data_path); QString db_path = data_path + QDir::separator() + QString("assets.db"); qDebug() << "DB path : " << db_path; db_helper = new DBHelper(db_path); QSqlError err = db_helper->initDb(); if (err.type() != QSqlError::NoError) { showError(err); throw err; } market = new CryptocoinChartsMDP(); updateCurrencies(); model = new QSqlRelationalTableModel(ui->assetsTable); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->setTable("assets"); currency_column_index = model->fieldIndex("currency_id"); quantity_index = model->fieldIndex("quantity"); price_btc_index = model->fieldIndex("price_btc"); mv_btc_index = model->fieldIndex("market_value_btc"); price_usd_index = model->fieldIndex("price_usd"); mv_usd_index = model->fieldIndex("market_value_usd"); model->setRelation(currency_column_index, QSqlRelation("currencies", "id", "code")); model->setHeaderData(currency_column_index, Qt::Horizontal, tr("Currency")); model->setHeaderData(model->fieldIndex("quantity"), Qt::Horizontal, tr("Quantity")); model->setHeaderData(model->fieldIndex("price_btc"), Qt::Horizontal, tr("Price (BTC)")); model->setHeaderData(model->fieldIndex("market_value_btc"), Qt::Horizontal, tr("Market Value (BTC)")); model->setHeaderData(model->fieldIndex("price_usd"), Qt::Horizontal, tr("Price (USD)")); model->setHeaderData(model->fieldIndex("market_value_usd"), Qt::Horizontal, tr("Market Value (USD)")); if (!model->select()) { showError(model->lastError()); return; } ui->assetsTable->setModel(model); ui->assetsTable->setItemDelegate(new QSqlRelationalDelegate(ui->assetsTable)); ui->assetsTable->setColumnHidden(model->fieldIndex("id"), true); ui->assetsTable->setSelectionBehavior(QAbstractItemView::SelectRows); mapper = new QDataWidgetMapper(this); mapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); AssetEditDelegate *delegate = new AssetEditDelegate(this); mapper->setItemDelegate(delegate); mapper->setModel(model); mapper->addMapping(ui->quantityEdit, model->fieldIndex("quantity")); QSqlTableModel *relationModel = model->relationModel(currency_column_index); relationModel->sort(relationModel->fieldIndex("code"), Qt::AscendingOrder); ui->currencyComboBox->setModel(relationModel); ui->currencyComboBox->setModelColumn(relationModel->fieldIndex("code")); ui->currencyComboBox->installEventFilter(delegate); mapper->addMapping(ui->currencyComboBox, currency_column_index); connect(ui->assetsTable->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), mapper, SLOT(setCurrentModelIndex(QModelIndex))); connect(delegate, SIGNAL(dataChanged (const QModelIndex&)), this, SLOT(data_changed(QModelIndex))); ui->assetsTable->setCurrentIndex(model->index(0, 0)); refreshMarketData(false); for (int c = 0; c < ui->assetsTable->horizontalHeader()->count(); ++c) ui->assetsTable->horizontalHeader()->setSectionResizeMode(c, QHeaderView::Stretch); }
void TreeComboBox::clicked(const QModelIndex &index) { setCurrentModelIndex(index); emit currentIndexChanged(index); }
/* ********************************************************************* */ void OcularDialog::createDialogContent() { ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); ui->ccdListView->setModel(ccdTableModel); ui->ocularListView->setModel(ocularTableModel); ui->telescopeListView->setModel(telescopeTableModel); ui->lensListView->setModel(lensTableModel); #ifdef Q_OS_WIN //Kinetic scrolling for tablet pc and pc QList<QWidget *> addscroll; addscroll << ui->textBrowser << ui->telescopeListView << ui->ccdListView << ui->ocularListView << ui->lensListView; installKineticScrolling(addscroll); #endif //Now the rest of the actions. connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(scaleImageCircleStateChanged(int))); connect(ui->requireSelectionCheckBox, SIGNAL(stateChanged(int)), this, SLOT(requireSelectionStateChanged(int))); connect(ui->limitStellarMagnitudeCheckBox, SIGNAL(clicked(bool)), plugin, SLOT(setFlagLimitMagnitude(bool))); connect(ui->checkBoxControlPanel, SIGNAL(clicked(bool)), plugin, SLOT(enableGuiPanel(bool))); connect(ui->checkBoxDecimalDegrees, SIGNAL(clicked(bool)), plugin, SLOT(setFlagDecimalDegrees(bool))); connect(ui->checkBoxInitialFOV, SIGNAL(clicked(bool)), plugin, SLOT(setFlagInitFovUsage(bool))); connect(ui->checkBoxUseFlipForCCD, SIGNAL(clicked(bool)), plugin, SLOT(setFlagUseFlipForCCD(bool))); // The add & delete buttons connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD())); connect(ui->deleteCCD, SIGNAL(clicked()), this, SLOT(deleteSelectedCCD())); connect(ui->addOcular, SIGNAL(clicked()), this, SLOT(insertNewOcular())); connect(ui->deleteOcular, SIGNAL(clicked()), this, SLOT(deleteSelectedOcular())); connect(ui->addLens, SIGNAL(clicked()), this, SLOT(insertNewLens())); connect(ui->deleteLens, SIGNAL(clicked()), this, SLOT(deleteSelectedLens())); connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTelescope())); connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSelectedTelescope())); // Validators ui->ccdName->setValidator(validatorName); ui->ocularName->setValidator(validatorName); ui->telescopeName->setValidator(validatorName); ui->lensName->setValidator(validatorName); // The key bindings QString bindingString = Oculars::appSettings()->value("bindings/toggle_oculars", "Ctrl+O").toString(); ui->togglePluginLineEdit->setText(bindingString); bindingString = Oculars::appSettings()->value("bindings/popup_navigator", "Alt+O").toString(); ui->togglePopupNavigatorWindowLineEdit->setText(bindingString); connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(keyBindingTogglePluginChanged(const QString&))); connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(const QString&)), this, SLOT(keyBindingPopupNavigatorConfigChanged(const QString&))); initAboutText(); connect(ui->togglePluginLineEdit, SIGNAL(textEdited(QString)), this, SLOT(initAboutText())); connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(QString)), this, SLOT(initAboutText())); connect(ui->pushButtonMoveOcularUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedOcular())); connect(ui->pushButtonMoveOcularDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedOcular())); connect(ui->pushButtonMoveSensorUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedSensor())); connect(ui->pushButtonMoveSensorDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedSensor())); connect(ui->pushButtonMoveTelescopeUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedTelescope())); connect(ui->pushButtonMoveTelescopeDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedTelescope())); connect(ui->pushButtonMoveLensUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedLens())); connect(ui->pushButtonMoveLensDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedLens())); // The CCD mapper ccdMapper = new QDataWidgetMapper(); ccdMapper->setModel(ccdTableModel); ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ccdMapper->addMapping(ui->ccdName, 0); ccdMapper->addMapping(ui->ccdChipY, 1); ccdMapper->addMapping(ui->ccdChipX, 2); ccdMapper->addMapping(ui->ccdPixelY, 3); ccdMapper->addMapping(ui->ccdPixelX, 4); ccdMapper->addMapping(ui->ccdResX, 5); ccdMapper->addMapping(ui->ccdResY, 6); ccdMapper->toFirst(); connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ccdMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1)); // The ocular mapper ocularMapper = new QDataWidgetMapper(); ocularMapper->setModel(ocularTableModel); ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ocularMapper->addMapping(ui->ocularName, 0); ocularMapper->addMapping(ui->ocularAFov, 1); ocularMapper->addMapping(ui->ocularFL, 2); ocularMapper->addMapping(ui->ocularFieldStop, 3); ocularMapper->addMapping(ui->binocularsCheckBox, 4, "checked"); ocularMapper->addMapping(ui->permanentCrosshairCheckBox, 5, "checked"); ocularMapper->toFirst(); connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ocularMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); // The lens mapper lensMapper = new QDataWidgetMapper(); lensMapper->setModel(lensTableModel); lensMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); lensMapper->addMapping(ui->lensName, 0); lensMapper->addMapping(ui->lensMultipler, 1); lensMapper->toFirst(); connect(ui->lensListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), lensMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->lensListView->setCurrentIndex(lensTableModel->index(0, 1)); // The telescope mapper telescopeMapper = new QDataWidgetMapper(); telescopeMapper->setModel(telescopeTableModel); telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); telescopeMapper->addMapping(ui->telescopeName, 0); telescopeMapper->addMapping(ui->telescopeDiameter, 1); telescopeMapper->addMapping(ui->telescopeFL, 2); telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked"); telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked"); ocularMapper->toFirst(); connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), telescopeMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1)); connect(ui->binocularsCheckBox, SIGNAL(toggled(bool)), this, SLOT(setLabelsDescriptionText(bool))); // set the initial state QSettings *settings = Oculars::appSettings(); if (settings->value("require_selection_to_zoom", 1.0).toBool()) { ui->requireSelectionCheckBox->setCheckState(Qt::Checked); } if (settings->value("use_max_exit_circle", 0.0).toBool()) { ui->scaleImageCircleCheckBox->setCheckState(Qt::Checked); } if (settings->value("limit_stellar_magnitude", true).toBool()) { ui->limitStellarMagnitudeCheckBox->setCheckState(Qt::Checked); } if (settings->value("enable_control_panel", false).toBool()) { ui->checkBoxControlPanel->setChecked(true); } if (settings->value("use_decimal_degrees", false).toBool()) { ui->checkBoxDecimalDegrees->setChecked(true); } if (settings->value("use_initial_fov", false).toBool()) { ui->checkBoxInitialFOV->setChecked(true); } if (settings->value("use_ccd_flip", true).toBool()) { ui->checkBoxUseFlipForCCD->setChecked(true); } //Initialize the style updateStyle(); }
EditCustumerDialog::EditCustumerDialog(QWidget *parent) : QDialog(parent), ui(new Ui::EditCustumerDialog) { ui->setupUi(this); //Removes "What's it?" button this->setWindowFlags(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); //Make Connections QObject::connect(this->ui->edit_pushButton,SIGNAL(clicked()),this,SLOT(beginEditing())); QObject::connect(this->ui->save_pushButton_3,SIGNAL(clicked()),this,SLOT(endEditing())); QObject::connect(this->ui->cancel_pushButton_2,SIGNAL(clicked()),this,SLOT(endEditing())); //Sets Items for State Combobox this->ui->state_comboBox->addItems(global_config.usa_states); //Disables Edit, Cancel and Save Buttons this->ui->edit_pushButton->setEnabled(false); this->ui->cancel_pushButton_2->setEnabled(false); this->ui->save_pushButton_3->setEnabled(false); //Disables all LineEdits this->ui->personal_info_groupBox->setEnabled(false); this->ui->address_info_groupBox_2->setEnabled(false); //Defines Model Headers this->customer_model = new QSqlTableModel(); customer_model->setTable("customer"); //Define Headers customer_model->setHeaderData(customer_model->fieldIndex("id"), Qt::Horizontal, tr("#")); customer_model->setHeaderData(customer_model->fieldIndex("name"), Qt::Horizontal, tr("Name")); customer_model->setHeaderData(customer_model->fieldIndex("email"), Qt::Horizontal, tr("Email")); customer_model->setHeaderData(customer_model->fieldIndex("phone1"), Qt::Horizontal, tr("Phone 1")); customer_model->setHeaderData(customer_model->fieldIndex("phone2"), Qt::Horizontal, tr("Phone 2")); customer_model->setHeaderData(customer_model->fieldIndex("birthday"), Qt::Horizontal, tr("Birthday Date")); customer_model->setHeaderData(customer_model->fieldIndex("zip_code"), Qt::Horizontal, tr("Zip-Code")); customer_model->setHeaderData(customer_model->fieldIndex("address"), Qt::Horizontal, tr("Address")); customer_model->setHeaderData(customer_model->fieldIndex("state"), Qt::Horizontal, tr("State")); customer_model->setHeaderData(customer_model->fieldIndex("city"), Qt::Horizontal, tr("City")); //customer_model->setEditStrategy(QSqlTableModel::OnManualSubmit); customer_model->select(); //Sets Model on the Table View this->ui->customer_tableView->setModel(this->customer_model); //Disables Edit on Table this->ui->customer_tableView->setEditTriggers(QAbstractItemView::NoEditTriggers); //Hides some columns on Table View this->ui->customer_tableView->hideColumn(customer_model->fieldIndex("points")); //Resizes the column according to its content this->ui->customer_tableView->resizeColumnsToContents(); //Defines params for selection this->ui->customer_tableView->setSelectionBehavior(QAbstractItemView::SelectRows); this->ui->customer_tableView->setSelectionMode(QAbstractItemView::SingleSelection); //Hides Vertical Header this->ui->customer_tableView->verticalHeader()->setVisible(false); //Fills the search ComboBox QStringList list = QString("#,Name,Email,Phone,Birthday,Address,Zip-Code,State,City").split(","); this->ui->comboBox->addItems(list); //Connect Selection Changed Signal connect(this->ui->customer_tableView->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this,SLOT(selectionChanged(QItemSelection,QItemSelection))); connect(this->ui->search_lineEdit_2,SIGNAL(textEdited(QString)),this,SLOT(searchTextChanged(QString))); connect(this->ui->comboBox,SIGNAL(currentTextChanged(QString)),this,SLOT(combobox_text_changed(QString))); //Creates Data Mapper customer_mapper = new QDataWidgetMapper; customer_mapper->setModel(this->customer_model); customer_mapper->addMapping(this->ui->id_lineEdit, this->customer_model->fieldIndex("id")); customer_mapper->addMapping(this->ui->name_lineEdit_2, this->customer_model->fieldIndex("name")); customer_mapper->addMapping(this->ui->email_lineEdit_4, this->customer_model->fieldIndex("email")); customer_mapper->addMapping(this->ui->phone1_lineEdit_2, this->customer_model->fieldIndex("phone1")); customer_mapper->addMapping(this->ui->phone2_lineEdit_3, this->customer_model->fieldIndex("phone2")); customer_mapper->addMapping(this->ui->birthday_dateEdit, this->customer_model->fieldIndex("birthday")); customer_mapper->addMapping(this->ui->address_lineEdit_5, this->customer_model->fieldIndex("address")); customer_mapper->addMapping(this->ui->zip_code_lineEdit_6, this->customer_model->fieldIndex("zip_code")); customer_mapper->addMapping(this->ui->state_comboBox, this->customer_model->fieldIndex("state")); customer_mapper->addMapping(this->ui->city_lineEdit_7, this->customer_model->fieldIndex("city")); customer_mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit); //customer_mapper->toFirst(); //Creates connection for selection of Row on Table connect(this->ui->customer_tableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), customer_mapper, SLOT(setCurrentModelIndex(QModelIndex))); //Update ComboBox Text this->combobox_text_changed(this->ui->comboBox->currentText()); connect(this->ui->search_dateEdit,SIGNAL(dateChanged(QDate)),this,SLOT(searchDateChanged(QDate))); }
/* ********************************************************************* */ void OcularDialog::createDialogContent() { ui->setupUi(dialog); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate())); ui->ccdListView->setModel(ccdTableModel); ui->ocularListView->setModel(ocularTableModel); ui->telescopeListView->setModel(telescopeTableModel); ui->lensListView->setModel(lensTableModel); // Kinetic scrolling kineticScrollingList << ui->textBrowser << ui->telescopeListView << ui->ccdListView << ui->ocularListView << ui->lensListView; StelGui* gui= dynamic_cast<StelGui*>(StelApp::getInstance().getGui()); if (gui) { enableKineticScrolling(gui->getFlagUseKineticScrolling()); connect(gui, SIGNAL(flagUseKineticScrollingChanged(bool)), this, SLOT(enableKineticScrolling(bool))); } //Now the rest of the actions. connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())); connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint))); connectBoolProperty(ui->checkBoxControlPanel, "Oculars.flagGuiPanelEnabled"); connectIntProperty(ui->guiFontSizeSpinBox, "Oculars.guiPanelFontSize"); connectBoolProperty(ui->checkBoxInitialFOV, "Oculars.flagInitFOVUsage"); connectBoolProperty(ui->checkBoxInitialDirection, "Oculars.flagInitDirectionUsage"); connectBoolProperty(ui->checkBoxResolutionCriterion, "Oculars.flagShowResolutionCriterions"); connectBoolProperty(ui->requireSelectionCheckBox, "Oculars.flagRequireSelection"); connectBoolProperty(ui->limitStellarMagnitudeCheckBox, "Oculars.flagLimitMagnitude"); connectBoolProperty(ui->hideGridsLinesCheckBox, "Oculars.flagHideGridsLines"); connectBoolProperty(ui->scaleImageCircleCheckBox, "Oculars.flagScaleImageCircle"); connectBoolProperty(ui->semiTransparencyCheckBox, "Oculars.flagSemiTransparency"); connectBoolProperty(ui->checkBoxDMSDegrees, "Oculars.flagDMSDegrees"); connectBoolProperty(ui->checkBoxTypeOfMount, "Oculars.flagAutosetMountForCCD"); connectBoolProperty(ui->checkBoxTelradFOVScaling, "Oculars.flagScalingFOVForTelrad"); connectBoolProperty(ui->checkBoxToolbarButton, "Oculars.flagShowOcularsButton"); connectDoubleProperty(ui->arrowButtonScaleDoubleSpinBox, "Oculars.arrowButtonScale"); connectBoolProperty(ui->checkBoxShowCcdCropOverlay, "Oculars.flagShowCcdCropOverlay"); connectIntProperty(ui->guiCcdCropOverlaySizeSpinBox, "Oculars.ccdCropOverlaySize"); // The add & delete buttons connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD())); connect(ui->deleteCCD, SIGNAL(clicked()), this, SLOT(deleteSelectedCCD())); connect(ui->addOcular, SIGNAL(clicked()), this, SLOT(insertNewOcular())); connect(ui->deleteOcular, SIGNAL(clicked()), this, SLOT(deleteSelectedOcular())); connect(ui->addLens, SIGNAL(clicked()), this, SLOT(insertNewLens())); connect(ui->deleteLens, SIGNAL(clicked()), this, SLOT(deleteSelectedLens())); connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTelescope())); connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSelectedTelescope())); // Validators ui->ccdName->setValidator(validatorName); ui->ocularName->setValidator(validatorName); ui->telescopeName->setValidator(validatorName); ui->lensName->setValidator(validatorName); initAboutText(); connect(ui->pushButtonMoveOcularUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedOcular())); connect(ui->pushButtonMoveOcularDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedOcular())); connect(ui->pushButtonMoveSensorUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedSensor())); connect(ui->pushButtonMoveSensorDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedSensor())); connect(ui->pushButtonMoveTelescopeUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedTelescope())); connect(ui->pushButtonMoveTelescopeDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedTelescope())); connect(ui->pushButtonMoveLensUp, SIGNAL(pressed()), this, SLOT(moveUpSelectedLens())); connect(ui->pushButtonMoveLensDown, SIGNAL(pressed()), this, SLOT(moveDownSelectedLens())); // The CCD mapper ccdMapper = new QDataWidgetMapper(); ccdMapper->setModel(ccdTableModel); ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ccdMapper->addMapping(ui->ccdName, 0); ccdMapper->addMapping(ui->ccdChipY, 1); ccdMapper->addMapping(ui->ccdChipX, 2); ccdMapper->addMapping(ui->ccdPixelY, 3); ccdMapper->addMapping(ui->ccdPixelX, 4); ccdMapper->addMapping(ui->ccdResX, 5); ccdMapper->addMapping(ui->ccdResY, 6); ccdMapper->addMapping(ui->ccdRotAngle, 7); ccdMapper->addMapping(ui->ccdBinningX, 8); ccdMapper->addMapping(ui->ccdBinningY, 9); ccdMapper->addMapping(ui->OAG_checkBox, 10); ccdMapper->addMapping(ui->OAGPrismH, 11); ccdMapper->addMapping(ui->OAGPrismW, 12); ccdMapper->addMapping(ui->OAGDist, 13); ccdMapper->addMapping(ui->OAGPrismPA, 14); ccdMapper->toFirst(); connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ccdMapper, SLOT(setCurrentModelIndex(QModelIndex))); connectDoubleProperty(ui->ccdRotAngle, "Oculars.selectedCCDRotationAngle"); ui->ccdListView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1)); connect(ui->ccdChipY, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdChipX, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdPixelY, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdPixelX, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdResX, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdResY, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdRotAngle, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdBinningX, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->ccdBinningY, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->OAG_checkBox,SIGNAL(stateChanged(int)), ccdMapper, SLOT(submit())); connect(ui->OAGPrismH, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->OAGPrismW, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->OAGDist, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); connect(ui->OAGPrismPA, SIGNAL(editingFinished()), ccdMapper, SLOT(submit())); // The ocular mapper ocularMapper = new QDataWidgetMapper(); ocularMapper->setModel(ocularTableModel); ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ocularMapper->addMapping(ui->ocularName, 0); ocularMapper->addMapping(ui->ocularAFov, 1); ocularMapper->addMapping(ui->ocularFL, 2); ocularMapper->addMapping(ui->ocularFieldStop, 3); ocularMapper->addMapping(ui->binocularsCheckBox, 4, "checked"); ocularMapper->addMapping(ui->permanentCrosshairCheckBox, 5, "checked"); ocularMapper->toFirst(); connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), ocularMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->ocularListView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); // We need particular refresh methods to see immediate feedback. connect(ui->ocularAFov, SIGNAL(editingFinished()), this, SLOT(updateOcular())); connect(ui->ocularFL, SIGNAL(editingFinished()), this, SLOT(updateOcular())); connect(ui->ocularFieldStop, SIGNAL(editingFinished()), this, SLOT(updateOcular())); connect(ui->binocularsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateOcular())); connect(ui->permanentCrosshairCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updateOcular())); // The lens mapper lensMapper = new QDataWidgetMapper(); lensMapper->setModel(lensTableModel); lensMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); lensMapper->addMapping(ui->lensName, 0); lensMapper->addMapping(ui->lensMultiplier, 1); lensMapper->toFirst(); connect(ui->lensListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), lensMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->lensListView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->lensListView->setCurrentIndex(lensTableModel->index(0, 1)); connect(ui->lensMultiplier, SIGNAL(editingFinished()), this, SLOT(updateLens())); // The telescope mapper telescopeMapper = new QDataWidgetMapper(); telescopeMapper->setModel(telescopeTableModel); telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); telescopeMapper->addMapping(ui->telescopeName, 0); telescopeMapper->addMapping(ui->telescopeDiameter, 1); telescopeMapper->addMapping(ui->telescopeFL, 2); telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked"); telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked"); telescopeMapper->addMapping(ui->telescopeEQ, 5, "checked"); telescopeMapper->toFirst(); connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowChanged(QModelIndex, QModelIndex)), telescopeMapper, SLOT(setCurrentModelIndex(QModelIndex))); ui->telescopeListView->setSelectionBehavior(QAbstractItemView::SelectRows); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1)); connect(ui->telescopeDiameter, SIGNAL(editingFinished()), this, SLOT(updateTelescope())); connect(ui->telescopeFL, SIGNAL(editingFinished()), this, SLOT(updateTelescope())); connect(ui->telescopeHFlip, SIGNAL(stateChanged(int)), this, SLOT(updateTelescope())); connect(ui->telescopeVFlip, SIGNAL(stateChanged(int)), this, SLOT(updateTelescope())); connect(ui->telescopeEQ, SIGNAL(stateChanged(int)), this, SLOT(updateTelescope())); connect(ui->binocularsCheckBox, SIGNAL(toggled(bool)), this, SLOT(setLabelsDescriptionText(bool))); }
void SampleView::setupMainConnections(){ // Pop-up add sample dialog when add sample button clicked. connect(addSampleButton_, SIGNAL(clicked()), this, SLOT(addNewSampleDialog())); // Remove selected sample. Slot function will determine which sample is selected. connect(removeSampleButton_, SIGNAL(clicked()), this, SLOT(removeSample())); // When the user selects a different sample from the list (and thus the model), the QDataWidgetMapper will need to know the new index. connect(sampleListView_->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), modelToWidgetMapper_, SLOT(setCurrentModelIndex(QModelIndex))); // Updates the sample name within the model as the user changes the name within the widget. connect(nameEdit_, SIGNAL(textEdited(QString)), this, SLOT(updateSampleName(QString))); // Updates the sample chemical symbol within the model as the user changes the symbol within the widget. connect(chemEdit_, SIGNAL(textEdited(QString)), this, SLOT(updateSampleChemSymbol(QString))); }