Пример #1
0
WinSettings::WinSettings(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::WinSettings)
{

    ui->setupUi(this);
    user_has_saved=true;
    ui->txt_test_time->setText(QString::number(test_sets.adv_settings.test_time));
    ui->txt_max_startup->setText(QString::number(test_sets.adv_settings.max_startup));

    ui->txt_max_rate->setText(QString::number(test_sets.adv_settings.max_rate));
    QString desc_rate = "Min value is:\t"+QString::number(MIN_rate)+"\nMax value is:\t"+QString::number(MAX_rate);
    ui->lbl_max_rate_desc->setText(desc_rate);

    ui->line_bench_dir->setText(dir_bench);
    ui->line_base_dir->setText(test_sets.adv_settings.dir_test);
    ui->chk_sync->setChecked(test_sets.adv_settings.sync);

    /*Connect all the browse's buttons*/
    connect(ui->btn_search_base_dir,SIGNAL(clicked()),this,SLOT(browse_button_clicked()));
    connect(ui->btn_search_bench_dir,SIGNAL(clicked()),this,SLOT(browse_button_clicked()));

}
Пример #2
0
QWidget* PathChooserDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
    Q_UNUSED(index)

    QTreeWidgetItem *item = tree_->currentItem();
    if (!item) {
        return NULL;
    }
    path_item_ = item;

    path_editor_ = new QWidget(parent);
    QHBoxLayout *hbox = new QHBoxLayout(path_editor_);
    path_editor_->setLayout(hbox);
    path_le_ = new QLineEdit(path_editor_);
    QPushButton *pb = new QPushButton(path_editor_);

    path_le_->setText(item->text(col_p_pipe_));
    pb->setText(QString(tr("Browse...")));

    hbox->setContentsMargins(0, 0, 0, 0);
    hbox->addWidget(path_le_);
    hbox->addWidget(pb);
    hbox->setSizeConstraint(QLayout::SetMinimumSize);

    // Grow the item to match the editor. According to the QAbstractItemDelegate
    // documenation we're supposed to reimplement sizeHint but this seems to work.
    QSize size = option.rect.size();
    size.setHeight(qMax(option.rect.height(), hbox->sizeHint().height()));
    item->setData(col_p_pipe_, Qt::SizeHintRole, size);

    path_le_->selectAll();
    path_editor_->setFocusProxy(path_le_);
    path_editor_->setFocusPolicy(path_le_->focusPolicy());

    connect(path_le_, SIGNAL(destroyed()), this, SLOT(stopEditor()));
    connect(pb, SIGNAL(pressed()), this, SLOT(browse_button_clicked()));
    return path_editor_;
}