Example #1
0
WidgetMooPlot::WidgetMooPlot(OptimResult* result,QWidget *parent) :
    QWidget(parent),
    _ui(new Ui::WidgetMooPlotClass)
{
    _ui->setupUi(this);

    _result = result;

    //***********
    //PLOT
    //***********
    _plot1 = new MOOptPlot();
    _plot1->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
    _ui->layoutInsidePlot->addWidget(_plot1);
    _ui->layoutInsidePlot->setContentsMargins(10,10,10,10);

    // connect signals for selection changed
    connect(_plot1,SIGNAL(selectionChanged(QList<int>&)),
            this,SIGNAL(selectionChanged(QList<int>&)));


    // Connecting signals and slot
    connect(_ui->comboAbscissa,SIGNAL(activated(int)),
            this,SLOT(varSelectionChanged()));
    connect(_ui->comboOrdinate,SIGNAL(activated(int)),
            this,SLOT(varSelectionChanged()));

    // update combos and plot
    updateCombos();
    varSelectionChanged();
}
Example #2
0
void
CQFontChooser::
updateWidgets()
{
  cedit_  ->setVisible(style_ == FontEdit  );
  cbutton_->setVisible(style_ == FontButton);
  clabel_ ->setVisible(style_ == FontLabel || style_ == FontDetailLabel);
  button_ ->setVisible(style_ != FontCombo );
  ncombo_ ->setVisible(style_ == FontCombo );
  scombo_ ->setVisible(style_ == FontCombo );
  zcombo_ ->setVisible(style_ == FontCombo );

  if (fixedWidth_)
    ncombo_->setFontFilters(QFontComboBox::MonospacedFonts);
  else
    ncombo_->setFontFilters(QFontComboBox::AllFonts);

  ncombo_->setWritingSystem(QFontDatabase::Latin);
//ncombo_->setCurrentIndex(1);

  cedit_->setText(fontName_);

  cbutton_->setFont(font_);
  cbutton_->setText(exampleText());

  clabel_->setFont(font_);

  if (style_ == FontDetailLabel) {
    QFontDatabase database;

    QString style = database.styleString(font_);

    clabel_->setText(QString("%1, %2, %3").
      arg(font_.substitute(font_.family())).arg(style).arg(font_.pointSize()));
  }
  else
    clabel_->setText(exampleText());

  int nind = ncombo_->findText(font_.family());

  if (nind >= 0)
    ncombo_->setCurrentIndex(nind);

  updateStyles();
  updateSizes ();

  updateCombos();

  layout()->invalidate();
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
        QMainWindow(parent), dtFormat("MMM dd | hh:mm"),
	ui(new Ui::MainWindow)
{
	ui->setupUi(this);
	
	QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
    
	abbrevs << "AK" << "AL" << "AR" << "AZ" << "CA" << "CO" << "CT" << "DE" << "FL" << 
	           "GA" << "HI" << "IA" << "ID" << "IL" << "IN" << "KS" << "KY" << "LA" <<
	           "MA" << "MD" << "ME" << "MI" << "MN" << "MO" << "MS" << "MT" << "NC" <<
	           "ND" << "NE" << "NH" << "NJ" << "NM" << "NV" << "NY" << "OH" << "OK" <<
	           "OR" << "PA" << "RI" << "SC" << "SD" << "TN" << "TX" << "UT" << "VA" <<
	           "VT" << "WA" << "WI" << "WV" << "WY";
	names << "Alaska" << "Alabama" << "Arkansas" << "Arizona" <<
	         "California" << "Colorado" << "Connecticut" << "Delaware" <<
	         "Florida" << "Georgia" << "Hawaii" << "Iowa" << "Idaho" <<
	         "Illinois" << "Indiana" << "Kansas" << "Kentucky" << "Louisiana" <<
	         "Massachusetts" << "Maryland" << "Maine" << "Michigan" << "Minnesota" <<
	         "Missouri" << "Mississippi" << "Montana" << "North Carolina" <<
	         "North Dakota" << "Nebraska" << "New Hampshire" << "New Jersey" <<
	         "New Mexico" << "Nevada" << "New York" << "Ohio" << "Oklahoma" <<
	         "Oregon" << "Pennsylvania" << "Rhode Island" << "South Carolina" <<
	         "South Dakota" << "Tennessee" << "Texas" << "Utah" << "Virginia" <<
	         "Vermont" << "Washington" << "Wisconsin" << "West Virginia" << "Wyoming";
	
	// open the database for use
	QString e;
	e = validateDatabase();
	if( !e.isEmpty() ){
		QMessageBox::critical(this, "Critical Error",
			QString("Error %1")
			.arg(e)
		);
		db.close();
		this->deleteLater();
	}
	
	// set up the table model to pass the sql data through
	model = new QSqlTableModel(this,db);
	model->setTable("States");
	model->setEditStrategy(QSqlTableModel::OnManualSubmit);
	model->setFilter("Mileage<>0 OR GasAmt<>0");
	model->setHeaderData(0, Qt::Horizontal, "Name");
	model->setHeaderData(1, Qt::Horizontal, "");
	model->setHeaderData(2, Qt::Horizontal, "Mileage");
	model->setHeaderData(3, Qt::Horizontal, "Fuel\nPurchased");
	model->setHeaderData(4, Qt::Horizontal, "Fuel\nVolume");
	model->setHeaderData(5, Qt::Horizontal, "Refuel\nCount");
	model->setHeaderData(6, Qt::Horizontal, "Visit\nCount");
	
	// set up the table view
	ui->tableView->setModel( model );
	ui->tableView->setItemDelegateForColumn(2,
		new FormatDelegate(0, FormatDelegate::TSeparator));
	ui->tableView->setItemDelegateForColumn(3,
		new FormatDelegate(0, FormatDelegate::Currency));
	ui->tableView->setItemDelegateForColumn(4,
		new FormatDelegate(0, FormatDelegate::FixedFloat));
	ui->tableView->setItemDelegateForColumn(5,
		new FormatDelegate(0));
	ui->tableView->setItemDelegateForColumn(6,
		new FormatDelegate(0));
	ui->tableView->setColumnWidth(0, 125);
	ui->tableView->setColumnWidth(1,  50);
	ui->tableView->sortByColumn(2);
	
	// set the widgets
	updateCombos();
	updateStatistics();
	setInitialValues();

	connect(ui->pushAddCrossing, SIGNAL(clicked()),
			this,                SLOT(addCrossing())
	);
	connect(ui->pushAddFillup, SIGNAL(clicked()),
			this,              SLOT(addRefuel())
	);
	connect(ui->action_Reset_Statistics, SIGNAL(triggered()),
			this,                        SLOT(resetDatabase())
	);
	
	connect(this, SIGNAL(dataUpdated()),
	        this, SLOT(updateStatistics())
	);
	
	connect(ui->actionBugReport, SIGNAL(triggered()),
	        this,                SLOT(bugReport())
	);
	connect(ui->actionAbout_MileStat, SIGNAL(triggered()),
	        this,                      SLOT(aboutMileStat())
	);
	connect(ui->actionAbout_Qt, SIGNAL(triggered()),
	        qApp,                SLOT(aboutQt())
	);
	connect(ui->action_Undo, SIGNAL(triggered()),
	        this,            SLOT(undoLastCommand())
	);
	connect(ui->action_Hide_Unvisited_States, SIGNAL(toggled(bool)),
	        this, SLOT(hideUnvisited(bool))
	);
	
}