コード例 #1
0
void AddHostDialog::buttonBoxSelect(QAbstractButton *button)
{
    if(button == ui->buttonBox->buttons().at(0))
    {
        if(ui->txtHost->text().length()<=0)
        {
         ui->txtHost->focusWidget();
         QMessageBox::critical(NULL,"Please Supply a Host Name","Please enter the host name you wish to add to the DNS redirection.");
         return;
        }
        else if(ui->txtIP->text().length()<=0)
        {
         ui->txtIP->focusWidget();
         QMessageBox::critical(this,"Please Supply an IP Address","Please enter an IP address that the host name will forward to.");
         return;
        }
        else
        {
        emit requestAdd(ui->txtHost->text(), ui->txtIP->text());
        hide();
    }
    }
    else
    {
        emit cancelAdd();
        hide();
    }
}
コード例 #2
0
NewClassDialog::NewClassDialog(int row, int column, QString name, \
                               QString grade, QString section, QString notes, QWidget *parent) :
    QDialog(parent)
{
    nRow = row;
    nColumn = column;

    QFormLayout *formLayout = new QFormLayout;

    this->classNameInput = new QLineEdit;
    this->classNameInput->setMaxLength(7);
    if(name != "=======")
        this->classNameInput->setText(name);

    this->classSectionInput = new QLineEdit;
    this->classSectionInput->setValidator( new QIntValidator(1, 9, this) );
    this->classSectionInput->setText(section);

    this->classAdditionalNotes = new QTextEdit;
    this->classAdditionalNotes->setMinimumHeight(200);
    this->classAdditionalNotes->setMinimumWidth(100);
    this->classAdditionalNotes->setText(notes);

    QHBoxLayout *gradeInputButtons = createGradeInput(grade);

    formLayout->addRow( new QLabel(QString("Subject: ")), this->classNameInput );
    formLayout->addRow( new QLabel(QString("Grade: ")), gradeInputButtons );
    formLayout->addRow( new QLabel(QString("Section: ")), this->classSectionInput );
    formLayout->addRow( new QLabel(QString("Notes: ")), this->classAdditionalNotes);

    QPushButton *addClassButton = new QPushButton( QString("Done") );
    QPushButton *cancelButton = new QPushButton( QString("Cancel") );
    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addWidget(cancelButton);
    buttonLayout->addWidget(addClassButton);

    formLayout->addRow( buttonLayout );

    setLayout(formLayout);

    classNameInput->setFocus();

    connect( addClassButton, SIGNAL(clicked()), this, SLOT(getInput()) );
    connect( cancelButton, SIGNAL(clicked()), this, SLOT(cancelAdd()) );
}
コード例 #3
0
ファイル: CourseEditUI.cpp プロジェクト: ExoltenOne/Recondo
CourseEditUI::CourseEditUI(RecondoModel* model, QWidget *parent, Qt::WFlags flags)
	: QDialog(parent, flags)
{
	setupUi(this);

	_addingNewItem = false;
	_presenter = new CourseEditPresenter(this, model);
	_presenter->SetCourseInfoOnView();
	_items = _presenter->GetItemsToEdit();
	FillTable();

	QItemSelectionModel *sm = tableView->selectionModel();
	QObject::connect(sm, SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
				this, SLOT(tableViewCurrentRowChanged(QModelIndex,QModelIndex)));
	QObject::connect(sm, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
				this, SLOT(tableViewSelectionChanged(QItemSelection,QItemSelection)));
	QObject::connect(btnSave, SIGNAL(clicked()), this, SLOT(changeItem()));
	QObject::connect(okButton, SIGNAL(clicked()), this, SLOT(saveItemToFile()));
	QObject::connect(btnNew, SIGNAL(clicked()), this, SLOT(addNewItem()));
	QObject::connect(btnCancel, SIGNAL(clicked()), this, SLOT(cancelAdd()));
}