Пример #1
0
KCMRulesList::KCMRulesList(QWidget* parent)
    : QWidget(parent)
{
    setupUi(this);
    // connect both current/selected, so that current==selected (stupid QListBox :( )
    connect(rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
            SLOT(activeChanged()));
    connect(rules_listbox, SIGNAL(itemSelectionChanged()),
            SLOT(activeChanged()));
    connect(new_button, SIGNAL(clicked()),
            SLOT(newClicked()));
    connect(modify_button, SIGNAL(clicked()),
            SLOT(modifyClicked()));
    connect(delete_button, SIGNAL(clicked()),
            SLOT(deleteClicked()));
    connect(moveup_button, SIGNAL(clicked()),
            SLOT(moveupClicked()));
    connect(movedown_button, SIGNAL(clicked()),
            SLOT(movedownClicked()));
    connect(export_button, SIGNAL(clicked()),
            SLOT(exportClicked()));
    connect(import_button, SIGNAL(clicked()),
            SLOT(importClicked()));
    connect(rules_listbox, SIGNAL(itemDoubleClicked(QListWidgetItem*)),
            SLOT(modifyClicked()));
    load();
}
Пример #2
0
ReaderInfoDialog::ReaderInfoDialog(const QString &u, const QString &num, QWidget *parent) :
    QDialog(parent), str(num), user_name(u)
{
    IDLabel = new QLabel(tr("&ID:"));
    IDLineEdit = new QLineEdit;
    IDLabel->setBuddy(IDLineEdit);
    queryButton = new QPushButton(tr("Quer&y"));

    passwordLabel = new QLabel(tr("&Password:"******"&Affirm Password:"******"&Name:"));
    nameLineEdit = new QLineEdit;
    nameLabel->setBuddy(nameLineEdit);

    sexLabel = new QLabel(tr("&Sex:"));
    sexComboBox = new QComboBox;
    sexComboBox->addItems(QStringList() << tr("male") << tr("female"));
    sexLabel->setBuddy(sexComboBox);

    birthdayLabel = new QLabel(tr("&Birthday:"));
    birthdayDateEdit = new QDateEdit;
    birthdayLabel->setBuddy(birthdayDateEdit);

    cardDateLabel = new QLabel(tr("&Card Date:"));
    cardDateEdit = new QDateEdit;
    cardDateLabel->setBuddy(cardDateEdit);
    cardDateEdit->setDate(QDate::currentDate());

    validDateLabel = new QLabel(tr("&Valid Date:"));
    validDateEdit = new QDateEdit;
    validDateEdit->setDate(QDate::currentDate().addYears(1));
    validDateLabel->setBuddy(validDateEdit);

    IDCardLabel = new QLabel(tr("&ID Card:"));
    IDCardLineEdit = new QLineEdit;
    IDCardLabel->setBuddy(IDCardLineEdit);

    phoneLabel = new QLabel(tr("&Phone:"));
    phoneLineEdit = new QLineEdit;
    phoneLabel->setBuddy(phoneLineEdit);

    stateLabel = new QLabel(tr("&State:"));
    stateComboBox = new QComboBox;
    stateComboBox->addItems(QStringList() << tr("normal") << tr("logout"));
    stateLabel->setBuddy(stateComboBox);

    typeLabel = new QLabel(tr("&Type:"));
    typeComboBox = new QComboBox;
    typeComboBox->addItems(QStringList() << tr("normal") << tr("VIP"));
    typeLabel->setBuddy(typeComboBox);


    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(IDLabel, 0, 0);
    gridLayout->addWidget(IDLineEdit, 0, 1);
    gridLayout->addWidget(queryButton, 0, 2);
    gridLayout->addWidget(passwordLabel, 1, 0);
    gridLayout->addWidget(passwordLineEdit, 1, 1);
    gridLayout->addWidget(againPasswordLabel, 2, 0);
    gridLayout->addWidget(againPasswordLineEdit, 2, 1);
    gridLayout->addWidget(nameLabel, 3, 0);
    gridLayout->addWidget(nameLineEdit, 3, 1);
    gridLayout->addWidget(sexLabel, 4, 0);
    gridLayout->addWidget(sexComboBox, 4, 1);
    gridLayout->addWidget(birthdayLabel, 5, 0);
    gridLayout->addWidget(birthdayDateEdit, 5, 1);
    gridLayout->addWidget(cardDateLabel, 6, 0);
    gridLayout->addWidget(cardDateEdit, 6, 1);
    gridLayout->addWidget(validDateLabel, 7, 0);
    gridLayout->addWidget(validDateEdit, 7, 1);
    gridLayout->addWidget(IDCardLabel, 8, 0);
    gridLayout->addWidget(IDCardLineEdit, 8, 1);
    gridLayout->addWidget(phoneLabel, 9, 0);
    gridLayout->addWidget(phoneLineEdit, 9, 1);
    gridLayout->addWidget(stateLabel, 10, 0);
    gridLayout->addWidget(stateComboBox, 10, 1);
    gridLayout->addWidget(typeLabel, 11, 0);
    gridLayout->addWidget(typeComboBox, 11, 1);

    groupBox = new QGroupBox(tr("Reader Information"));
    groupBox->setLayout(gridLayout);

    okButton = new QPushButton(tr("&OK"));
    cancelButton = new QPushButton(tr("Cancel"));

    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addStretch();
    bottomLayout->addWidget(okButton);
    bottomLayout->addWidget(cancelButton);


    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(groupBox);
    mainLayout->addLayout(bottomLayout);

    setLayout(mainLayout);

    if (str.isEmpty())
    {
        connect(okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
    }
    else
    {
        init();
        connect(okButton, SIGNAL(clicked()), this, SLOT(modifyClicked()));
    }
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
    connect(queryButton, SIGNAL(clicked()), this, SLOT(queryClicked()));
}