Beispiel #1
0
CDlgForgotPwd::CDlgForgotPwd(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::CDlgForgotPwd)
{
    ui->setupUi(this);

    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(onOk()));
    connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(onCancel()));
    connect(ui->lineEditUserName, SIGNAL(returnPressed()), this, SLOT(onOk()));
}
Beispiel #2
0
void CDlgLogin::createLayout()
{
    QHBoxLayout* pMainLayout = new QHBoxLayout;
    setLayout(pMainLayout);
    QGroupBox* pGroupBox = new QGroupBox(this);
    pMainLayout->addWidget(pGroupBox);
    pGroupBox->setTitle(tr("Login"));

    // label edit
    QLabel* pLabelUserName = new QLabel(tr("User Name:"), this);
    QLabel* pLabelPassword = new QLabel(tr("Password:"******"Always login by the name"));

    // ok cancel
    m_pBtnOk = new QPushButton(this);
    m_pBtnOk->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    QIcon icon1;
    icon1.addFile(QString::fromUtf8(":/res/login.png"));
    m_pBtnOk->setIcon(icon1);
    m_pBtnOk->setIconSize(QSize(48,48));
    m_pBtnOk->setToolTip(tr("Login"));
    m_pBtnCancel = new QPushButton(this);
    QIcon icon2;
    icon2.addFile(QString::fromUtf8(":/res/cancel.png"));
    m_pBtnCancel->setIcon(icon2);
    m_pBtnCancel->setText(tr("Cancel"));
    m_pBtnCancel->setIconSize(QSize(16,16));
    m_pBtnCancel->setToolTip(tr("Cancel"));

    // connect
    connect(m_pBtnOk, SIGNAL(clicked()), this, SLOT(onOk()));
    connect(m_pBtnCancel, SIGNAL(clicked()), this, SLOT(onCancel()));

    // layout
    QGridLayout* pGridLayout = new QGridLayout(this);
    pGridLayout->addWidget(pLabelUserName, 0, 0);
    pGridLayout->addWidget(pLabelPassword, 1, 0);
    pGridLayout->addWidget(m_pEditUserName, 0, 1);
    pGridLayout->addWidget(m_pEditPassword, 1, 1);
    pGridLayout->addWidget(m_pBtnOk, 0, 2, 2, 1);
    pGridLayout->addWidget(m_pCheckBoxAlwaysLogin, 2, 0, 1, 2);
    pGridLayout->addWidget(m_pBtnCancel, 2, 2);
    pGroupBox->setLayout(pGridLayout);
    pGridLayout->setContentsMargins(20, 0, 20, 0);
}
SelectDatePopupWidget::SelectDatePopupWidget(QWidget *parent) :
    QWidget(parent)
{
    layout = new QGridLayout;
    auto calendar = new QCalendarWidget(this);
    auto ok = new QPushButton("ОК", this);
    auto cancel = new QPushButton("Cancel", this);

    QObject::connect(ok, &QPushButton::clicked, [&]()
        {
            close();
            emit onOk(selectedDate());
        });

    QObject::connect(cancel, &QPushButton::clicked, [&]()
        {
            close();
        });

    layout->addWidget(calendar, 0, 0, 1, 2);
    layout->addWidget(ok, 1, 0);
    layout->addWidget(cancel, 1, 1);

    setLayout(layout);
    setWindowFlags(Qt::Popup);
    setFocus(Qt::PopupFocusReason);
    resize(150, 150);
}
Beispiel #4
0
DlgAbout::DlgAbout(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DlgAbout)
{
    ui->setupUi(this);
    connect(ui->okButton, SIGNAL(clicked()), this, SLOT(onOk()));
}
Beispiel #5
0
/* \x41\x41\x41\x41\x41\x41\x41 */
TDialog::TDialog(QWidget *parent, Qt::WindowFlags flags, TempleLang *lang, int ctype)
    : QDialog(parent, flags) {
    setModal(true);

    dlang = lang;
    type = ctype;

    QGridLayout *grid = new QGridLayout(this);

    QLabel *nameLabel = new QLabel("Name:");
    nameIn = new QLineEdit();
    grid->addWidget(nameLabel, 0, 0);
    grid->addWidget(nameIn, 0, 1, 1, 2);

    QPushButton *ok = new QPushButton("Ok");
    ok->setDefault(true);
    connect(ok, SIGNAL(clicked()), this, SLOT(onOk()));

    QPushButton *cancel = new QPushButton("Cancel");
    connect(cancel, SIGNAL(clicked()), this, SLOT(onCancel()));

    grid->addWidget(ok, 1, 1);
    grid->addWidget(cancel, 1, 2);

}
INT_PTR CALLBACK dlgRen_msgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
    INT_PTR status = FALSE;

    if (uMessage == WM_COMMAND) {
        switch (LOWORD(wParam)) {

            case IDOK:
                if (onOk(hDlg)) {
                    ::EndDialog(hDlg, 1);
                    status = TRUE;
                }
                break;

            case IDCANCEL:
                ::EndDialog(hDlg, 0);
                status = TRUE;
                break;
        }
    }
    else if (uMessage == WM_INITDIALOG) {
        _dialogData = (ChildDialogData*)lParam;
        onInit(hDlg);
    }

    return status;
}
Beispiel #7
0
void FinPeriodReportPreferencesDlg::createWidgets()
{
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);

    m_leStartMonth = new QLineEdit;
    m_leStartMonth->setValidator(new QIntValidator(1, 12, m_leStartMonth));

    m_leStartYear = new QLineEdit;
    m_leStartYear->setValidator(new QIntValidator(1000, 9999, m_leStartYear));

    m_leFinishMonth = new QLineEdit;
    m_leFinishMonth->setValidator(new QIntValidator(1, 12, m_leFinishMonth));

    m_leFinishYear = new QLineEdit;
    m_leFinishYear->setValidator(new QIntValidator(1000, 9999, m_leFinishYear));

    mainLayout->addWidget(new QLabel(tr("from")), 0);
    QHBoxLayout *hbox;
    hbox = new QHBoxLayout;
    hbox->addWidget(new QLabel(tr("Month:")), 0);
    hbox->addWidget(m_leStartMonth, 1);
    mainLayout->addLayout(hbox, 0);

    hbox = new QHBoxLayout;
    hbox->addWidget(new QLabel(tr("Year:")), 0);
    hbox->addWidget(m_leStartYear, 1);
    mainLayout->addLayout(hbox, 0);

    mainLayout->addWidget(new QLabel(tr("to")), 0);
    hbox = new QHBoxLayout;
    hbox->addWidget(new QLabel(tr("Month:")), 0);
    hbox->addWidget(m_leFinishMonth, 1);
    mainLayout->addLayout(hbox, 0);

    hbox = new QHBoxLayout;
    hbox->addWidget(new QLabel(tr("Year:")), 0);
    hbox->addWidget(m_leFinishYear, 1);
    mainLayout->addLayout(hbox, 0);

    QPushButton *okButton = new QPushButton(tr("OK"));
    QPushButton *cancelButton = new QPushButton(tr("Cancel"));
    connect(okButton, SIGNAL(clicked()), this, SLOT(onOk()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

    hbox = new QHBoxLayout;
    hbox->addStretch(1);
    hbox->addWidget(okButton);
    hbox->addWidget(cancelButton);

    mainLayout->addStretch(1);
    mainLayout->addLayout(hbox, 0);

    setWindowTitle(tr("Month report preferences"));
    m_leStartMonth->setText(QVariant(QDate::currentDate().month()).toString());
    m_leStartYear->setText(QVariant(QDate::currentDate().year()).toString());    
    m_leFinishMonth->setText(QVariant(QDate::currentDate().month()).toString());
    m_leFinishYear->setText(QVariant(QDate::currentDate().year()).toString());    
}
Beispiel #8
0
CameraDlg::CameraDlg(QWidget *parent)
	: QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
	layoutWindow();
	setWindowTitle("Camera configuration");
	connect(m_buttons, SIGNAL(accepted()), this, SLOT(onOk()));
	connect(m_buttons, SIGNAL(rejected()), this, SLOT(reject()));
}
Beispiel #9
0
SelectFusionDlg::SelectFusionDlg(RTIMUSettings *settings, QWidget *parent)
	: QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
    m_settings = settings;
	layoutWindow();
    setWindowTitle("Select Fusion algorithm");
	connect(m_buttons, SIGNAL(accepted()), this, SLOT(onOk()));
    connect(m_buttons, SIGNAL(rejected()), this, SLOT(onCancel()));
 }
Beispiel #10
0
SelectPSDlg::SelectPSDlg(RTIMUSettings *settings, QWidget *parent)
    : QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
    m_settings = settings;
    layoutWindow();
    setWindowTitle("Select Pressure sensor");
    connect(m_buttons, SIGNAL(accepted()), this, SLOT(onOk()));
    connect(m_buttons, SIGNAL(rejected()), this, SLOT(onCancel()));
    connect(m_selectPS, SIGNAL(currentIndexChanged(int)), this, SLOT(setSelectAddress(int)));
    connect(m_selectBus, SIGNAL(currentIndexChanged(int)), this, SLOT(setSelectAddress(int)));
}
Beispiel #11
0
void RecordBox::stopRecording()
{
    int size = CommandStopRecording();

    // Security check
    if(size < RECORDBOX_CROP_SAMPLES_END + RECORDBOX_CROP_SAMPLES_START)
    {
        free(sound_data);
        sample = NULL;
        onOk();
#ifdef DEBUG
        printf("omfg\n");
#endif
        return;
    }

    // Get pointer to sound data and shrink it beautiful
    u32 newsize = size - RECORDBOX_CROP_SAMPLES_END*2; // Crop the end because it contains the clicking of the button
    sound_data = (u16*)realloc(sound_data, newsize);

    //Cut the first few samples
    if(RECORDBOX_CROP_SAMPLES_START < newsize)
    {
        memmove(sound_data, sound_data+RECORDBOX_CROP_SAMPLES_START*2,
                newsize-RECORDBOX_CROP_SAMPLES_START*2);
        newsize -= RECORDBOX_CROP_SAMPLES_START*2;
        sound_data = (u16*)realloc(sound_data, newsize);
    }

    sample = new Sample(sound_data, newsize/2, RECORDBOX_SAMPLING_FREQ);
    sample->setName("rec");

    //smp->cutSilence(); // Cut silence in the beginning (experiMENTAL!)

    recording = false;

    DC_FlushAll();

    onOk();
}
Beispiel #12
0
CompassCalDlg::CompassCalDlg(QWidget *parent)
	: QDialog(parent, Qt::WindowCloseButtonHint | Qt::WindowTitleHint)
{
	layoutWindow();
    setWindowTitle("Compass calibration");
	connect(m_buttons, SIGNAL(accepted()), this, SLOT(onOk()));
    connect(m_buttons, SIGNAL(rejected()), this, SLOT(onCancel()));

    m_timer = startTimer(100);

    m_compassMin = RTVector3(10000, 10000, 10000);
    m_compassMax = RTVector3(-10000, -10000, -10000);
}
void RequestDestroy::_exec(Game& game, unsigned int)
{
  if( !_alsoExec )
  {
    _alsoExec = true;
    std::string constrQuestion = _reqConstruction->errorDesc();
    std::string questionStr = constrQuestion.empty()
                                  ? "##destroy_this_building##"
                                  : constrQuestion;
    Dialog* dialog = Confirmation( game.gui(), _("##warning##"), _(questionStr) );
    CONNECT(dialog, onOk(), this, RequestDestroy::_applyDestroy );
    CONNECT(dialog, onCancel(), this, RequestDestroy::_declineDestroy );
  }
}
Beispiel #14
0
SettingsWidget::SettingsWidget(QWidget* parent)
    : QDialog(parent)
{
    setupUi(this);

    mainWindow = (MainWindow*) parent;

    settings = new QSettings(CONFIG_FILE, QSettings::IniFormat, this);
    settings->beginGroup("Windows");
        settings->beginGroup("Settings");
        restoreGeometry(settings->value("geometry").toByteArray());
        settings->endGroup();
    settings->endGroup();

    if (settings->value("pathToBinaries").toString().isEmpty()) {
        pathToSAEdit->setDisabled(true);
        pathToSAchBox->setChecked(true);
        pathToSAButton->setDisabled(true);
    }
    else {
        pathToSAEdit->setText(settings->value("pathToBinaries").toString());
    }

    if (settings->value("pathToDot").toString().isEmpty()) {
        pathDotEdit->setDisabled(true);
        pathDotChBox->setChecked(true);
        pathDotButton->setDisabled(true);
    }
    else {
        pathDotEdit->setText(settings->value("pathToDot").toString());
    }
    if (settings->value("checkBinaries").toBool()==true) {
        checkChBox->setChecked(true);
    }
    else {
        checkChBox->setChecked(false);
    }

    workDirEdit->setText(settings->value("workDir").toString());
    savingDirEdit->setText(settings->value("savingDir",
                                           PATH_TO_SETTINGS).toString());

    connect(pathToSAButton, SIGNAL(clicked()), this, SLOT(onBrowseSADir()));
    connect(pathDotButton, SIGNAL(clicked()), this, SLOT(onBrowseDotPath()));
    connect(workDirButton, SIGNAL(clicked()), this, SLOT(onBrowseWorkDir()));
    connect(savingDirButton, SIGNAL(clicked()), this,
            SLOT(onBrowseSavingDir()));
    connect(okButton, SIGNAL(clicked()), this, SLOT(onOk()));
}
Beispiel #15
0
int Options::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QDialog::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: onOk(); break;
        case 1: onCancel(); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
Beispiel #16
0
MidiBindingDialog::MidiBindingDialog(Context& ctx, QWidget *parent) :
	QDialog(parent), ui(new Ui::MidiBindingDialog), ctx(ctx), binding(nullptr), okClicked(false) {

	ui->setupUi(this);

	// register for midi events
	ctx.getMidi()->addListener(this);

	// buttons
	connect(ui->btnCancel, SIGNAL(clicked()), this, SLOT(onCancel()));
	connect(ui->btnOk, SIGNAL(clicked()), this, SLOT(onOk()));



}
Beispiel #17
0
void catEditWidget::on_btns_clicked(QAbstractButton* button)
{

    if ( ui->btns->standardButton(button) == QDialogButtonBox::Reset){
    onCancel();



    }else if ( ui->btns->standardButton(button) == QDialogButtonBox::Save){
    onOk();



    }
}
AddFilmstripFramesPopup::AddFilmstripFramesPopup()
    : Dialog(TApp::instance()->getMainWindow(), true, "AddFilmstripFrames") {
  setWindowTitle(tr("Add Frames"));

  m_startFld = new DVGui::IntLineEdit(this);
  m_endFld   = new DVGui::IntLineEdit(this);
  m_stepFld  = new DVGui::IntLineEdit(this);

  m_okBtn     = new QPushButton(tr("Add"), this);
  m_cancelBtn = new QPushButton(tr("Cancel"), this);

  QGridLayout *upperLay = new QGridLayout();
  upperLay->setMargin(0);
  upperLay->setSpacing(5);
  {
    upperLay->addWidget(new QLabel(tr("From Frame:"), this), 0, 0,
                        Qt::AlignRight | Qt::AlignVCenter);
    upperLay->addWidget(m_startFld, 0, 1);

    upperLay->addWidget(new QLabel(tr("To Frame:"), this), 1, 0,
                        Qt::AlignRight | Qt::AlignVCenter);
    upperLay->addWidget(m_endFld, 1, 1);

    upperLay->addWidget(new QLabel(tr("Step:"), this), 2, 0,
                        Qt::AlignRight | Qt::AlignVCenter);
    upperLay->addWidget(m_stepFld, 2, 1);
  }
  upperLay->setColumnStretch(0, 0);
  upperLay->setColumnStretch(1, 1);
  m_topLayout->addLayout(upperLay, 1);

  m_buttonLayout->setMargin(0);
  m_buttonLayout->setSpacing(10);
  {
    m_buttonLayout->addWidget(m_okBtn);
    m_buttonLayout->addWidget(m_cancelBtn);
  }

  connect(m_okBtn, SIGNAL(clicked()), this, SLOT(onOk()));
  connect(m_cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));

  update();
}
INT_PTR CALLBACK dlgNew_msgProc(HWND hDlg, UINT uMessage, WPARAM wParam, LPARAM lParam)
{
    INT_PTR status = FALSE;

    if (uMessage == WM_COMMAND) {
        switch (LOWORD(wParam)) {

            case IDOK:
                if (onOk(hDlg)) {
                    ::EndDialog(hDlg, 1);
                    status = TRUE;
                }
                break;

            case IDCANCEL:
                ::EndDialog(hDlg, 0);
                status = TRUE;
                break;

            case IDC_NEW_RAD_EMPTY:
            case IDC_NEW_RAD_OPEN:
            case IDC_NEW_RAD_COPY:
                if (HIWORD(wParam) == BN_CLICKED) {
                    WCHAR buf[SES_NAME_BUF_LEN];
                    buf[0] = 0;
                    dlg::getText(hDlg, IDC_NEW_ETX_NAME, buf, SES_NAME_BUF_LEN);
                    if (buf[0] == 0) {
                        dlg::setText(hDlg, IDC_NEW_ETX_NAME, app_getSessionName(_dialogData->selectedSessionIndex));
                    }
                    dlg::focus(hDlg, IDC_NEW_ETX_NAME, false);
                    status = TRUE;
                }
                break;
        }
    }
    else if (uMessage == WM_INITDIALOG) {
        _dialogData = (ChildDialogData*)lParam;
        onInit(hDlg);
    }

    return status;
}
Beispiel #20
0
//-----------------------------------------------
LoginDialog::LoginDialog():QDialog(0,Qt::MSWindowsFixedSizeDialogHint)
{
    name="Вход в систему";
    setWindowTitle(name);

    label_login=new QLabel("Логин:",this);
    label_password=new QLabel("Пароль:",this);

    edit_login=new QLineEdit(this);
    edit_password=new QLineEdit(this);
    edit_password->setEchoMode(QLineEdit::Password);

    button_ok=new QPushButton("ОК",this);
    button_settings=new QPushButton("Настройки",this);
    button_cancel=new QPushButton("Отмена",this);

    layout_login=new QHBoxLayout;
    layout_login->addWidget(label_login);
    layout_login->addWidget(edit_login);

    layout_password=new QHBoxLayout;
    layout_password->addWidget(label_password);
    layout_password->addWidget(edit_password);

    layout_button=new QHBoxLayout;
    layout_button->addWidget(button_ok);
    layout_button->addWidget(button_cancel);
    layout_button->addWidget(button_settings);

    layout_main=new QVBoxLayout;
    layout_main->addLayout(layout_login);
    layout_main->addLayout(layout_password);
    layout_main->addLayout(layout_button);

    setLayout(layout_main);

    connect(button_ok,SIGNAL(clicked()),this,SLOT(onOk()));
    connect(button_cancel,SIGNAL(clicked()),this,SLOT(onCancel()));
    connect(button_settings,SIGNAL(clicked()),this,SLOT(onSettings()));

}
Beispiel #21
0
EditDlg::EditDlg(QWidget *parent)
    : QDialog(parent)
{
    QVBoxLayout *mainLayout = new QVBoxLayout;
    setLayout(mainLayout);
   
    m_owOpr = new OperationWidget;
    mainLayout->addWidget(m_owOpr);

    QPushButton *okButton = new QPushButton(tr("OK"));
    QPushButton *cancelButton = new QPushButton(tr("Cancel"));
    connect(okButton, SIGNAL(clicked()), this, SLOT(onOk()));
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

    QHBoxLayout *buttonLayout = new QHBoxLayout;
    buttonLayout->addStretch(1);
    buttonLayout->addWidget(okButton);
    buttonLayout->addWidget(cancelButton);
    
    mainLayout->addLayout(buttonLayout);

    setWindowTitle(tr("Operation"));
}
Beispiel #22
0
CreateTrussDialog::CreateTrussDialog ( TrussUnitWindowManager& mng,
                                       QWidget* parent /* = 0 */ ) :
    QDialog( parent ),
    wndMng( mng )
{
    QVBoxLayout* parenLayout = new QVBoxLayout( this );

    QVBoxLayout* nameLayout = new QVBoxLayout;
    QLabel* nameLabel = new QLabel( tr( "Enter truss name:" ) );
    nameEdit = new QLineEdit;
    connect( nameEdit, SIGNAL(textEdited(const QString&)),
                          SLOT(checkDialogState()) );
    
    nameLayout->addWidget( nameLabel );
    nameLayout->addWidget( nameEdit );

    QHBoxLayout* sizeLayout = new QHBoxLayout;
    QGroupBox* sizeGroupBox = new QGroupBox( tr( "Area size" ), this );
    QLabel* xSizeLabel = new QLabel( tr( "Size by X:" ), sizeGroupBox );
    QLabel* ySizeLabel = new QLabel( tr( "Size by Y:" ), sizeGroupBox );
    xSizeEdit = new QDoubleSpinBox;
    xSizeEdit->setMaximum( Global::areaMaxDimension );
    xSizeEdit->setValue( 300.0 );
    connect( xSizeEdit, SIGNAL(valueChanged(double)),
                          SLOT(checkDialogState()) );

    ySizeEdit = new QDoubleSpinBox;
    ySizeEdit->setMaximum( Global::areaMaxDimension );
    ySizeEdit->setValue( 300.0 );
    connect( ySizeEdit, SIGNAL(valueChanged(double)),
                          SLOT(checkDialogState()) );

    sizeLayout->addWidget( sizeGroupBox );

    QGridLayout *grid = new QGridLayout( sizeGroupBox );
    grid->addWidget( xSizeLabel, 0, 0 );
    grid->addWidget( ySizeLabel, 1, 0 );
    grid->addWidget( xSizeEdit, 0, 1 );
    grid->addWidget( ySizeEdit, 1, 1 );
    grid->setSpacing( 5 );
    grid->setMargin( 15 );

    QHBoxLayout* buttonLayout = new QHBoxLayout;
    okButton = new QPushButton( tr( "OK" ) );
    connect( okButton, SIGNAL(clicked()),
                          SLOT(onOk()) );
    okButton->setEnabled( false );
    
    QPushButton* cancelButton = new QPushButton( tr( "Cancel" ) );
    connect( cancelButton, SIGNAL(clicked()),
                             SLOT(onCancel()) );
    buttonLayout->addStretch( 1 );
    buttonLayout->addWidget( okButton );
    buttonLayout->addWidget( cancelButton );

    parenLayout->addLayout( nameLayout );
    parenLayout->addWidget( sizeGroupBox );
    parenLayout->addLayout( buttonLayout );
    parenLayout->addStretch( 1 );
    parenLayout->setMargin( 10 );

    setWindowTitle( tr( "Create truss unit" ) );
    nameEdit->setFocus( Qt::OtherFocusReason );
}
Beispiel #23
0
void CDlgRegister::createLayout()
{
    QHBoxLayout* pMainLayout = new QHBoxLayout;
    setLayout(pMainLayout);
    QGroupBox* pGroupBox = new QGroupBox(this);
    pMainLayout->addWidget(pGroupBox);
    pGroupBox->setTitle(tr("Register"));

    // label edit
    QLabel* pLabelUserName = new QLabel(tr("User Name:"), this);
    QLabel* pLabelEmail = new QLabel(tr("Email:"), this);
    QLabel* pLabelPassword = new QLabel(tr("Password:"******"Confirm Password:"******"Get forgot password by the e-mail."));
    connect(m_pEditUserName, SIGNAL(returnPressed()), this, SLOT(onOk()));
    connect(m_pEditEmail, SIGNAL(returnPressed()), this, SLOT(onOk()));
    connect(m_pEditPassword, SIGNAL(returnPressed()), this, SLOT(onOk()));
    connect(m_pEditConfirmPwd, SIGNAL(returnPressed()), this, SLOT(onOk()));

    // ok cancel
    m_pBtnOk = new QPushButton(this);
    m_pBtnOk->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    QIcon icon1;
    icon1.addFile(QString::fromUtf8(":/res/register.png"));
    m_pBtnOk->setIcon(icon1);
    m_pBtnOk->setIconSize(QSize(48,48));
    m_pBtnOk->setToolTip(tr("Register"));
    m_pBtnCancel = new QPushButton(this);
    QIcon icon2;
    icon2.addFile(QString::fromUtf8(":/res/cancel.png"));
    m_pBtnCancel->setIcon(icon2);
    m_pBtnCancel->setText(tr("Cancel"));
    m_pBtnCancel->setIconSize(QSize(16,16));
    m_pBtnCancel->setToolTip(tr("Cancel"));

    // connect
    connect(m_pBtnOk, SIGNAL(clicked()), this, SLOT(onOk()));
    connect(m_pBtnCancel, SIGNAL(clicked()), this, SLOT(onCancel()));

    // layout
    QGridLayout* pGridLayout = new QGridLayout(this);
    pGridLayout->addWidget(pLabelUserName, 0, 0);
    pGridLayout->addWidget(pLabelEmail, 1, 0);
    pGridLayout->addWidget(pLabelPassword, 2, 0);
    pGridLayout->addWidget(pLabelConfirmPwd, 3, 0);
    pGridLayout->addWidget(m_pEditUserName, 0, 1);
    pGridLayout->addWidget(m_pEditEmail, 1, 1);
    pGridLayout->addWidget(m_pEditPassword, 2, 1);
    pGridLayout->addWidget(m_pEditConfirmPwd, 3, 1);
    pGridLayout->addWidget(m_pBtnOk, 0, 2, 4, 1);
    pGridLayout->addWidget(m_pBtnCancel, 4, 2);
    pGroupBox->setLayout(pGridLayout);
    pGridLayout->setContentsMargins(20, 0, 20, 0);
}
Beispiel #24
0
void PasswordsDlg::createWidgets()
{
    QVBoxLayout* mainLayout = new QVBoxLayout;
    QTabWidget* tab = new QTabWidget;

    QWidget* generalTab = new QWidget;
    QVBoxLayout* layout = new QVBoxLayout;
    QGridLayout* grid = new QGridLayout;
    QHBoxLayout* hbox = NULL;

    m_leService = new QLineEdit;
    grid->addWidget(new QLabel(tr("Service:")), 0, 0);
    grid->addWidget(m_leService, 0, 1);

    m_leLogin = new QLineEdit;
    grid->addWidget(new QLabel(tr("Login:"******":showHide"));
    btn->setCheckable(true);
    hbox = new QHBoxLayout;
    hbox->addWidget(m_lePassword, 1);
    hbox->addWidget(btn);
    grid->addWidget(new QLabel(tr("Password:"******"Mail:")), 3, 0);
    grid->addWidget(m_leMail, 3, 1);

    m_leUrl = new QLineEdit;
    grid->addWidget(new QLabel(tr("Url:")), 4, 0);
    grid->addWidget(m_leUrl, 4, 1);

    layout->addLayout(grid);
    layout->addStretch(1);

    generalTab->setLayout(layout);
    tab->addTab(generalTab, tr("General"));

    m_teNotes = new QTextEdit;

    tab->addTab(m_teNotes, tr("Notes"));

    mainLayout->addWidget(tab, 1);

    hbox = new QHBoxLayout;
    QPushButton *bOk = new QPushButton(tr("OK"));
    QPushButton *bCancel = new QPushButton(tr("Cancel"));
    hbox->addStretch(1);
    hbox->addWidget(bOk);
    hbox->addWidget(bCancel);
    connect(bOk, SIGNAL(clicked()), this, SLOT(onOk()));
    connect(bCancel, SIGNAL(clicked()), this, SLOT(reject()));
    mainLayout->addLayout(hbox);

    setLayout(mainLayout);

    showHidePassword();
    setSizeGripEnabled(true);
}