WIP: rename bookmark UI.

This commit is contained in:
Just Wonder 2020-05-09 21:39:53 -07:00
parent 59e064effc
commit bdcee37f49
4 changed files with 19 additions and 6 deletions

View File

@ -33,7 +33,7 @@
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set> <set>QDialogButtonBox::Save|QDialogButtonBox::Ok|QDialogButtonBox::Cancel</set>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -16,10 +16,12 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) :
ui(new Ui::KevaBookmarksDialog) ui(new Ui::KevaBookmarksDialog)
{ {
ui->setupUi(this); ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Apply)->setText(tr("Show")); ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("Edit"));
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject())); connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply())); connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()));
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(rename()));
} }
void KevaBookmarksDialog::setModel(WalletModel *_model) void KevaBookmarksDialog::setModel(WalletModel *_model)
@ -48,7 +50,8 @@ void KevaBookmarksDialog::setModel(WalletModel *_model)
void KevaBookmarksDialog::namespaceView_selectionChanged() void KevaBookmarksDialog::namespaceView_selectionChanged()
{ {
bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty(); bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty();
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enable);
if (enable) { if (enable) {
selectedIndex = ui->namespaceView->selectionModel()->currentIndex(); selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
@ -73,6 +76,10 @@ void KevaBookmarksDialog::apply()
QDialog::close(); QDialog::close();
} }
void KevaBookmarksDialog::rename()
{
}
void KevaBookmarksDialog::reject() void KevaBookmarksDialog::reject()
{ {
QDialog::reject(); QDialog::reject();

View File

@ -38,6 +38,7 @@ public:
public Q_SLOTS: public Q_SLOTS:
void apply(); void apply();
void reject(); void reject();
void rename();
private Q_SLOTS: private Q_SLOTS:
void namespaceView_selectionChanged(); void namespaceView_selectionChanged();

View File

@ -75,8 +75,13 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const
{ {
if (index.column() == Block) if (index.column() == Block)
return (int)(Qt::AlignRight|Qt::AlignVCenter); return (int)(Qt::AlignRight|Qt::AlignVCenter);
else if (index.column() == Value) else if (index.column() == Value) {
#if (QT_VERSION <= QT_VERSION_CHECK(5, 9, 5))
return (int)(Qt::AlignLeft|Qt::AlignVCenter);
#else
return (int)(Qt::AlignLeft|Qt::AlignTop); return (int)(Qt::AlignLeft|Qt::AlignTop);
#endif
}
} }
return QVariant(); return QVariant();
} }