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