EditTeacherDialog::EditTeacherDialog(QString teacherName, int clickedColumn, QWidget *parent) :
    QDialog(parent)
{
    QFormLayout *formLayout = new QFormLayout;

    this->teacherNameInput = new QLineEdit;
    this->teacherNameInput->setText(teacherName);

    this->column = clickedColumn;

    formLayout->addRow( new QLabel(QString("Name: ")), this->teacherNameInput );

    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 );

    connect( addClassButton, SIGNAL(clicked()), this, SLOT(getName()) );

    connect( cancelButton, SIGNAL(clicked()), this, SLOT(cancelEdit()) );

    setLayout(formLayout);
}
Esempio n. 2
0
void SpinnerDefaultEditor::handleEditorTextFieldKeyPressed(KeyEventDetails* const e)
{
	if(e->getKey() == KeyEventDetails::KEY_ESCAPE)
	{
		cancelEdit();
	}
}
Esempio n. 3
0
EditServer::EditServer(QWidget *parent, Qt::WFlags f) :
    QWidget(parent, f)
{
    setupUi(this);
    qRegisterMetaType<IcalServer>("IcalServer");

    // Construct context menu, available to the user via Qtopia's soft menu bar.
    QMenu *menu = QSoftMenuBar::menuFor(this);
    QSoftMenuBar::setHelpEnabled(this,true);
    QSoftMenuBar::setInputMethodEnabled (this, true);

    menu->addAction("Cancel", this, SLOT(cancelEdit()));
}
Esempio n. 4
0
void RendererWidget::mousePressEvent(QMouseEvent * event)
{
    if(event->button() == Qt::LeftButton && _stateReady == NO_INTERACTION)
    {
        _leftMouse = true;

        if(_renderer->getCurSceneIndex() > 0)
        {
            float x_rel = event->localPos().x() / this->size().width();
            float y_rel = event->localPos().y() / this->size().height();

            vec2 ss = vec2(x_rel, y_rel) * 2 - vec2(1,1);
            ss.y() *= -1;

            Camera camera = _renderer->getSceneView(_renderer->getCurSceneIndex()).camera;
            mat4 proj = mat4::Projection(camera.fov, camera.ratio, camera.clipDist.x(), camera.clipDist.y());
            mat4 view = mat4::View(camera.pos, camera.dir, camera.up);
            mat4 invProjView = (proj*view).inverted();

            vec4 v = invProjView*vec4(ss.x(), ss.y(), 0, 1);
            vec3 dir = v.to<3>() / v.w();
            dir = (dir-camera.pos).normalized();

            emit clickInEditor(camera.pos, dir, _shiftPressed);
        }

        event->accept();
    }
    else if(_stateReady >= TRANSLATE_MODE)
    {
        _stateReady = NO_INTERACTION;
        emit stateChanged(_stateReady);
        if(event->button() == Qt::RightButton)
            emit cancelEdit();
    }
    else if(event->button() == Qt::RightButton && _stateReady == NO_INTERACTION){
        _rightMouse = true;
        _lastMousePos = event->pos();
        event->accept();
        this->grabKeyboard();

        _renderer->setEnableDirection(true);
    }
}
Esempio n. 5
0
void CSVSortList::createOperate()
{
    int nRow = numRows();
    WPushButton *pSave = new WPushButton(SVResString::getResString("IDS_OK"), elementAt(nRow, 0));
    if(pSave)
    {
        WObject::connect(pSave, SIGNAL(clicked()) , "showbar();", this, SLOT(saveList()), WObject::ConnectionType::JAVASCRIPTDYNAMIC);
        pSave->setToolTip(SVResString::getResString("IDS_Save_Sort_Tip"));
    }

    new WText("&nbsp;", elementAt(nRow, 0));

    WPushButton *pCancel = new WPushButton(SVResString::getResString("IDS_Cancel"), elementAt(nRow,0));
    if(pCancel)
    {
        pCancel->setToolTip(SVResString::getResString("IDS_Cancel_Sort_Tip"));
        WObject::connect(pCancel, SIGNAL(clicked()), "showbar();", this, SLOT(cancelEdit()), WObject::ConnectionType::JAVASCRIPTDYNAMIC);
    }

    elementAt(nRow, 0)->setContentAlignment(AlignCenter);
}
Esempio n. 6
0
Area::Area(QWidget *parent, QString path) :
    QWidget(parent)
{
    this->path = path;

    // call the constructors of all the areas
    this->textArea = new TextArea(this);
    this->textArea->setReadOnly(false);
    this->myArea = new MyArea(this, this->path);
    this->treeArea = new TreeArea(this);
    this->indicatorEdit = new TextArea(this);
    this->listOldText = new QStringList();

    //Add text coloration (lie le TextArea)
    colorerSequences = new ColorerSequences(textArea->document());

    // treeArea: create widgets containing the buttons
    this->treeButtonArea = new QWidget(this);
    this->treeButtonArea->setMinimumWidth(12);
    this->treeButtonArea->setMaximumWidth(12);
    this->textButtonArea = new QWidget(this);
    this->textButtonArea->setMinimumWidth(12);
    this->textButtonArea->setMaximumWidth(12);

    // create the buttons
    this->leftButton = new QPushButton("<", this->treeButtonArea);
    this->leftButton->setMaximumWidth(12);
    this->leftButton->setMinimumHeight(70);
    QVBoxLayout *layoutLeft = new QVBoxLayout;
    layoutLeft->addWidget(leftButton);
    layoutLeft->setContentsMargins(0,0,0,0);
    this->treeButtonArea->setLayout(layoutLeft);

    this->rightButton = new QPushButton(">", this->textButtonArea);
    this->rightButton->setMaximumWidth(12);
    this->rightButton->setMinimumHeight(70);
    this->rightExpandButton = new QPushButton("<", this->textButtonArea);
    this->rightExpandButton->setMaximumWidth(12);
    this->rightExpandButton->setMinimumHeight(70);
    QVBoxLayout *layoutRight = new QVBoxLayout;
    layoutRight->addWidget(this->rightButton);
    layoutRight->addWidget(this->rightExpandButton);
    layoutRight->setContentsMargins(0,0,0,0);
    this->textButtonArea->setLayout(layoutRight);

    this->saveTextEdit = new QPushButton("Update",this);
    this->saveTextEdit->setFixedSize(QSize(80,30));
    this->saveTextEdit->setVisible(false);
    this->saveTextEdit->setEnabled(false);
    this->saveTextEdit->setShortcut(QKeySequence((Qt::CTRL + Qt::Key_E)));

    this->cancelTextEdit = new QPushButton("Cancel",this);
    this->cancelTextEdit->setFixedSize(QSize(80,30));
    this->cancelTextEdit->setVisible(false);
    this->cancelTextEdit->setEnabled(false);

    //indicatorEdit preferences

    this->indicatorEdit->setReadOnly(true);
    this->indicatorEdit->changeBackgroundColor(QColor("#F1F1F1"));
    this->indicatorEdit->setFixedSize(QSize(200,27));
    this->indicatorEdit->setTextColor(QColor(228,26,4));
    this->indicatorEdit->setCurrentFont(QFont("TypeWriter",10));
    this->indicatorEdit->setFontWeight(5);
    this->indicatorEdit->setFrameShape(QTextEdit::NoFrame);
    this->indicatorEdit->setFrameShadow(QTextEdit::Plain);
    this->indicatorEdit->setPlainText("Edition...");
    this->indicatorEdit->setVisible(false);
    //Press CTRL+E to save or CTRL+ESC to cancel

    // set the global layout
    QHBoxLayout *layout = new QHBoxLayout;
    layout->addWidget(this->treeArea);
    layout->addWidget(this->treeButtonArea);
    layout->addWidget(this->myArea);
    layout->addWidget(this->textButtonArea);

    QVBoxLayout *VLayout = new QVBoxLayout;
    VLayout->addWidget(this->indicatorEdit);
    VLayout->addWidget(this->textArea);

    QHBoxLayout *options = new QHBoxLayout;
    options->addWidget(this->saveTextEdit);
    options->addWidget(this->cancelTextEdit);

    VLayout->addLayout(options);

    QHBoxLayout *global = new QHBoxLayout;
    global->addLayout(layout);
    global->addLayout(VLayout);

    this->setLayout(global);

    // connect
    QObject::connect(this->leftButton, SIGNAL(clicked()), this, SLOT(hideOrShowTree()));
    QObject::connect(this->rightButton, SIGNAL(clicked()), this, SLOT(hideOrShowText()));
    QObject::connect(this->rightExpandButton, SIGNAL(clicked()), this, SLOT(expandOrReduceText()));
    QObject::connect(this->cancelTextEdit, SIGNAL(clicked()), this, SLOT(cancelEdit()));
    QObject::connect(this->textArea, SIGNAL(textChanged()), this->textArea, SLOT(onTextEdit()));
    QObject::connect(this->saveTextEdit, SIGNAL(clicked()), this, SLOT(saveEdit()));
    QObject::connect(this->textArea, SIGNAL(textChanged()), this, SLOT(onTextEdit()));    
    QObject::connect(this, SIGNAL(edition()), this, SLOT(showToolTip()));
    QObject::connect(this, SIGNAL(makeTempXML()), this, SLOT(tempXMLfile()));

    // initialization
    this->textArea->setHidden(true);
    this->rightButton->setText("<");
    this->rightExpandButton->hide();
    this->saveTextEdit->setDefault(false);
    this->cancelTextEdit->setDefault(false);
}