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>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set>
<set>QDialogButtonBox::Save|QDialogButtonBox::Ok|QDialogButtonBox::Cancel</set>
</property>
</widget>
</item>

View File

@ -16,10 +16,12 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) :
ui(new Ui::KevaBookmarksDialog)
{
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Apply)->setText(tr("Show"));
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
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::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)
@ -48,7 +50,8 @@ void KevaBookmarksDialog::setModel(WalletModel *_model)
void KevaBookmarksDialog::namespaceView_selectionChanged()
{
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) {
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
@ -73,6 +76,10 @@ void KevaBookmarksDialog::apply()
QDialog::close();
}
void KevaBookmarksDialog::rename()
{
}
void KevaBookmarksDialog::reject()
{
QDialog::reject();

View File

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

View File

@ -75,8 +75,13 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const
{
if (index.column() == Block)
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);
#endif
}
}
return QVariant();
}