PIVariantEditors::FileBase allow user to select relative/absolute mode
This commit is contained in:
@@ -571,7 +571,6 @@ PIVariantEditors::FileBase::FileBase() {
|
||||
edit_widget->layout()->addWidget(b);
|
||||
layout()->setSpacing(0);
|
||||
layout()->addWidget(edit_widget);
|
||||
setFullEditMode(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -606,7 +605,8 @@ void PIVariantEditors::FileBase::applyAttributes(const PIVariantMap & a) {
|
||||
|
||||
|
||||
void PIVariantEditors::FileBase::setFullEditMode(bool on) {
|
||||
edit_widget->setVisible(on);
|
||||
act_save->setVisible(on);
|
||||
act_filter->setVisible(on);
|
||||
}
|
||||
|
||||
|
||||
@@ -618,7 +618,7 @@ void PIVariantEditors::FileBase::createMenu() {
|
||||
act_save = edit_menu.addAction(tr("Existing only"), this, [this](bool on) { is_save = !on; });
|
||||
act_save->setCheckable(true);
|
||||
act_save->setChecked(!is_save);
|
||||
edit_menu.addAction(tr("Set filter ..."), this, [this]() {
|
||||
act_filter = edit_menu.addAction(tr("Set filter ..."), this, [this]() {
|
||||
bool ok = false;
|
||||
QString nf = QInputDialog::getText(nullptr, tr("Select filter"), tr("Input filter:"), QLineEdit::Normal, PI2QString(filter), &ok);
|
||||
if (!ok) return;
|
||||
|
||||
@@ -273,7 +273,7 @@ protected:
|
||||
QWidget * sel_widget;
|
||||
QWidget * edit_widget;
|
||||
QMenu edit_menu;
|
||||
QAction *act_abs = nullptr, *act_save = nullptr;
|
||||
QAction *act_abs = nullptr, *act_save = nullptr, *act_filter = nullptr;
|
||||
bool is_dir = false, is_abs = false, is_save = false;
|
||||
PIString filter;
|
||||
};
|
||||
@@ -286,6 +286,7 @@ public:
|
||||
File(): FileBase() {
|
||||
is_dir = false;
|
||||
createMenu();
|
||||
setFullEditMode(false);
|
||||
}
|
||||
void setValue(const PIVariant & v) override;
|
||||
PIVariant value() const override;
|
||||
@@ -299,6 +300,7 @@ public:
|
||||
Dir(): FileBase() {
|
||||
is_dir = true;
|
||||
createMenu();
|
||||
setFullEditMode(false);
|
||||
}
|
||||
void setValue(const PIVariant & v) override;
|
||||
PIVariant value() const override;
|
||||
|
||||
Reference in New Issue
Block a user