Implement custom widgets for edit delegate, always show edit delegate
Signed-off-by: Tayou <tayou@gmx.net>
This commit is contained in:
@ -37,8 +37,9 @@
|
||||
|
||||
#include "GameOptionsPage.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/gameoptions/GameOptions.h"
|
||||
#include "minecraft/gameoptions/GameOptionDelegate.h"
|
||||
#include "minecraft/gameoptions/GameOptions.h"
|
||||
#include "ui_GameOptionsPage.h"
|
||||
|
||||
GameOptionsPage::GameOptionsPage(MinecraftInstance* inst, QWidget* parent) : QWidget(parent), ui(new Ui::GameOptionsPage)
|
||||
{
|
||||
@ -48,13 +49,16 @@ GameOptionsPage::GameOptionsPage(MinecraftInstance* inst, QWidget* parent) : QWi
|
||||
ui->optionsView->setModel(m_model.get());
|
||||
ui->optionsView->setItemDelegateForColumn(2, new GameOptionDelegate(ui->optionsView, m_model->getContents()));
|
||||
ui->optionsView->setEditTriggers(QAbstractItemView::AllEditTriggers);
|
||||
for (int i = 0; i < m_model->getContents()->size(); ++i) {
|
||||
ui->optionsView->openPersistentEditor(m_model->index(i, 2));
|
||||
}
|
||||
auto head = ui->optionsView->header();
|
||||
head->setDefaultSectionSize(250);
|
||||
head->setDefaultSectionSize(350);
|
||||
if (head->count()) {
|
||||
for (int i = 1; i < head->count(); i++) {
|
||||
head->setSectionResizeMode(i, QHeaderView::Stretch);
|
||||
head->setSectionResizeMode(i, QHeaderView::Interactive);
|
||||
}
|
||||
head->setSectionResizeMode(head->count() -1, QHeaderView::Stretch);
|
||||
head->setSectionResizeMode(head->count() - 1, QHeaderView::Stretch);
|
||||
}
|
||||
connect(ui->optionsView, &QTreeView::doubleClicked, this, &GameOptionsPage::OptionDoubleClicked);
|
||||
}
|
||||
|
Reference in New Issue
Block a user