EComboBox and StringListEdit improvments
This commit is contained in:
BIN
icons/list-edit-apply.png
Normal file
BIN
icons/list-edit-apply.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 36 KiB |
@@ -231,11 +231,11 @@ void Delegate::changedFlag() {
|
||||
int row = 0;
|
||||
qulonglong val = 0;
|
||||
QList<QModelIndex> chldr;
|
||||
mi = p.child(row, 1);
|
||||
mi = model->index(row, 1, p);
|
||||
while (mi.isValid()) {
|
||||
chldr << mi;
|
||||
model->setData(mi, !mi.data(Qt::UserRole + 4).toBool(), Qt::UserRole + 4);
|
||||
mi = p.child(++row, 1);
|
||||
mi =model->index(++row, 1, p);
|
||||
}
|
||||
bool cc = cmi.data(Qt::UserRole + 3).toBool();
|
||||
qulonglong cv = cmi.data(Qt::UserRole).toULongLong();
|
||||
@@ -358,8 +358,8 @@ void PropertyEditor::rebuild() {
|
||||
tli->setFont(0, font_b);
|
||||
setItemBackColor(tli, Qt::darkGray);
|
||||
setItemForeColor(tli, Qt::white);
|
||||
tli->setFirstColumnSpanned(true);
|
||||
addTopLevelItem(tli);
|
||||
setFirstItemColumnSpanned(tli, true);
|
||||
tli->setExpanded(true);
|
||||
for (int i = ps; i < pe; ++i) {
|
||||
props << o->property(i);
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
#include <QStandardItemModel>
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QHeaderView>
|
||||
#include <QStandardItemModel>
|
||||
#include "ecombobox.h"
|
||||
#include "qad_types.h"
|
||||
|
||||
|
||||
class EModel: public QStandardItemModel {
|
||||
class QAD_WIDGETS_EXPORT EModel: public QStandardItemModel {
|
||||
public:
|
||||
EModel(QObject * parent = 0): QStandardItemModel(parent) {
|
||||
#if QT_VERSION < 0x050000
|
||||
@@ -21,10 +20,12 @@ protected:
|
||||
}
|
||||
#if QT_VERSION >= 0x050000
|
||||
Qt::DropActions supportedDragActions() const {return Qt::MoveAction;}
|
||||
Qt::DropActions supportedDropActions() const {return Qt::MoveAction;}
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
||||
EComboBox::EComboBox(QWidget * parent): QComboBox(parent) {
|
||||
setView(&iv);
|
||||
setModel(new EModel());
|
||||
@@ -52,6 +53,7 @@ EComboBox::EComboBox(QWidget * parent): QComboBox(parent) {
|
||||
header.layout()->addWidget(&filter);
|
||||
header.setParent(iv.header());
|
||||
connect(&filter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
|
||||
connect(model(), &EModel::layoutChanged, this, &EComboBox::rowsChanged);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ private slots:
|
||||
void filterChanged(const QString & text, bool first = false);
|
||||
|
||||
signals:
|
||||
|
||||
void rowsChanged();
|
||||
};
|
||||
|
||||
#endif // ECOMBOBOX_H
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<name>CLineEdit</name>
|
||||
<message>
|
||||
<location filename="../clineedit.cpp" line="9"/>
|
||||
<location filename="../clineedit.cpp" line="45"/>
|
||||
<location filename="../clineedit.cpp" line="44"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -233,8 +233,8 @@
|
||||
<context>
|
||||
<name>EComboBox</name>
|
||||
<message>
|
||||
<location filename="../ecombobox.cpp" line="44"/>
|
||||
<location filename="../ecombobox.cpp" line="80"/>
|
||||
<location filename="../ecombobox.cpp" line="45"/>
|
||||
<location filename="../ecombobox.cpp" line="82"/>
|
||||
<source>Filter</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -242,8 +242,8 @@
|
||||
<context>
|
||||
<name>EvalSpinBox</name>
|
||||
<message>
|
||||
<location filename="../evalspinbox.cpp" line="28"/>
|
||||
<location filename="../evalspinbox.cpp" line="93"/>
|
||||
<location filename="../evalspinbox.cpp" line="34"/>
|
||||
<location filename="../evalspinbox.cpp" line="100"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -251,32 +251,32 @@
|
||||
<context>
|
||||
<name>MatrixEdit</name>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="33"/>
|
||||
<location filename="../matrixedit.ui" line="39"/>
|
||||
<source>Cols:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="47"/>
|
||||
<location filename="../matrixedit.ui" line="53"/>
|
||||
<source>Rows:</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="76"/>
|
||||
<location filename="../matrixedit.ui" line="82"/>
|
||||
<source>Null</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="79"/>
|
||||
<location filename="../matrixedit.ui" line="85"/>
|
||||
<source>0</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="86"/>
|
||||
<location filename="../matrixedit.ui" line="92"/>
|
||||
<source>Identity</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="89"/>
|
||||
<location filename="../matrixedit.ui" line="95"/>
|
||||
<source>I</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -284,23 +284,24 @@
|
||||
<context>
|
||||
<name>PathEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="105"/>
|
||||
<location filename="../qvariantedit.cpp" line="112"/>
|
||||
<source>All files(*)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="112"/>
|
||||
<location filename="../qvariantedit.cpp" line="125"/>
|
||||
<location filename="../qvariantedit.cpp" line="117"/>
|
||||
<location filename="../qvariantedit.cpp" line="129"/>
|
||||
<source>Choose</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="139"/>
|
||||
<location filename="../qvariantedit.cpp" line="152"/>
|
||||
<source>Select directory</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="140"/>
|
||||
<location filename="../qvariantedit.cpp" line="155"/>
|
||||
<location filename="../qvariantedit.cpp" line="157"/>
|
||||
<source>Select file</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -378,8 +379,8 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qcodeedit.cpp" line="53"/>
|
||||
<location filename="../qcodeedit.cpp" line="570"/>
|
||||
<location filename="../qcodeedit.cpp" line="84"/>
|
||||
<location filename="../qcodeedit.cpp" line="580"/>
|
||||
<source>Press F1 for details</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -525,57 +526,57 @@
|
||||
<context>
|
||||
<name>QPIConfigWidget</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Name</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Value</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Type</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="354"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<source>Add item ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="355"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="361"/>
|
||||
<source>Add node ...</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="356"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="362"/>
|
||||
<source>Convert to item</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="357"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="363"/>
|
||||
<source>Convert to node</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="358"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="364"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="359"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="365"/>
|
||||
<source>Expand all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="366"/>
|
||||
<source>Collapse all</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -625,7 +626,7 @@
|
||||
<context>
|
||||
<name>QVariantEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="186"/>
|
||||
<location filename="../qvariantedit.cpp" line="203"/>
|
||||
<source>Invalid value</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -655,23 +656,38 @@
|
||||
</context>
|
||||
<context>
|
||||
<name>StringListEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="66"/>
|
||||
<source>Apply</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="67"/>
|
||||
<location filename="../qvariantedit.cpp" line="86"/>
|
||||
<location filename="../qvariantedit.cpp" line="92"/>
|
||||
<source>Add</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="68"/>
|
||||
<location filename="../qvariantedit.cpp" line="87"/>
|
||||
<location filename="../qvariantedit.cpp" line="93"/>
|
||||
<source>Remove</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="69"/>
|
||||
<location filename="../qvariantedit.cpp" line="88"/>
|
||||
<location filename="../qvariantedit.cpp" line="94"/>
|
||||
<source>Clear</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="84"/>
|
||||
<source>Clear All</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="84"/>
|
||||
<source>Clear All?</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<name>CLineEdit</name>
|
||||
<message>
|
||||
<location filename="../clineedit.cpp" line="9"/>
|
||||
<location filename="../clineedit.cpp" line="45"/>
|
||||
<location filename="../clineedit.cpp" line="44"/>
|
||||
<source>Clear</source>
|
||||
<translation>Сбросить</translation>
|
||||
</message>
|
||||
@@ -233,8 +233,8 @@
|
||||
<context>
|
||||
<name>EComboBox</name>
|
||||
<message>
|
||||
<location filename="../ecombobox.cpp" line="44"/>
|
||||
<location filename="../ecombobox.cpp" line="80"/>
|
||||
<location filename="../ecombobox.cpp" line="45"/>
|
||||
<location filename="../ecombobox.cpp" line="82"/>
|
||||
<source>Filter</source>
|
||||
<translation>Фильтр</translation>
|
||||
</message>
|
||||
@@ -242,8 +242,8 @@
|
||||
<context>
|
||||
<name>EvalSpinBox</name>
|
||||
<message>
|
||||
<location filename="../evalspinbox.cpp" line="28"/>
|
||||
<location filename="../evalspinbox.cpp" line="93"/>
|
||||
<location filename="../evalspinbox.cpp" line="34"/>
|
||||
<location filename="../evalspinbox.cpp" line="100"/>
|
||||
<source>Clear</source>
|
||||
<translation>Очистить</translation>
|
||||
</message>
|
||||
@@ -251,32 +251,32 @@
|
||||
<context>
|
||||
<name>MatrixEdit</name>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="33"/>
|
||||
<location filename="../matrixedit.ui" line="39"/>
|
||||
<source>Cols:</source>
|
||||
<translation>Колонки:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="47"/>
|
||||
<location filename="../matrixedit.ui" line="53"/>
|
||||
<source>Rows:</source>
|
||||
<translation>Строки:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="76"/>
|
||||
<location filename="../matrixedit.ui" line="82"/>
|
||||
<source>Null</source>
|
||||
<translation>Обнулить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="79"/>
|
||||
<location filename="../matrixedit.ui" line="85"/>
|
||||
<source>0</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="86"/>
|
||||
<location filename="../matrixedit.ui" line="92"/>
|
||||
<source>Identity</source>
|
||||
<translation>Единичная</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../matrixedit.ui" line="89"/>
|
||||
<location filename="../matrixedit.ui" line="95"/>
|
||||
<source>I</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
@@ -284,23 +284,24 @@
|
||||
<context>
|
||||
<name>PathEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="105"/>
|
||||
<location filename="../qvariantedit.cpp" line="112"/>
|
||||
<source>All files(*)</source>
|
||||
<translation>Все файлы(*)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="112"/>
|
||||
<location filename="../qvariantedit.cpp" line="125"/>
|
||||
<location filename="../qvariantedit.cpp" line="117"/>
|
||||
<location filename="../qvariantedit.cpp" line="129"/>
|
||||
<source>Choose</source>
|
||||
<translation>Выберите</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="139"/>
|
||||
<location filename="../qvariantedit.cpp" line="152"/>
|
||||
<source>Select directory</source>
|
||||
<translation>Выберите директорию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="140"/>
|
||||
<location filename="../qvariantedit.cpp" line="155"/>
|
||||
<location filename="../qvariantedit.cpp" line="157"/>
|
||||
<source>Select file</source>
|
||||
<translation>Выберите файл</translation>
|
||||
</message>
|
||||
@@ -308,8 +309,8 @@
|
||||
<context>
|
||||
<name>QCodeEdit</name>
|
||||
<message>
|
||||
<location filename="../qcodeedit.cpp" line="53"/>
|
||||
<location filename="../qcodeedit.cpp" line="570"/>
|
||||
<location filename="../qcodeedit.cpp" line="84"/>
|
||||
<location filename="../qcodeedit.cpp" line="580"/>
|
||||
<source>Press F1 for details</source>
|
||||
<translation>Нажмите F1 для справочной информации</translation>
|
||||
</message>
|
||||
@@ -525,57 +526,57 @@
|
||||
<context>
|
||||
<name>QPIConfigWidget</name>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Name</source>
|
||||
<translation>Имя</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Value</source>
|
||||
<translation>Значение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Type</source>
|
||||
<translation>Тип</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="339"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="345"/>
|
||||
<source>Comment</source>
|
||||
<translation>Описание</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="354"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<source>Add item ...</source>
|
||||
<translation>Добавить поле ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="355"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="361"/>
|
||||
<source>Add node ...</source>
|
||||
<translation>Добавить секцию ...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="356"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="362"/>
|
||||
<source>Convert to item</source>
|
||||
<translation>Преобразовать в значение</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="357"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="363"/>
|
||||
<source>Convert to node</source>
|
||||
<translation>Преобразовать в секцию</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="358"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="364"/>
|
||||
<source>Remove</source>
|
||||
<translation>Удалить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="359"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="365"/>
|
||||
<source>Expand all</source>
|
||||
<translation>Свернуть все</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qpiconfigwidget.cpp" line="360"/>
|
||||
<location filename="../qpiconfigwidget.cpp" line="366"/>
|
||||
<source>Collapse all</source>
|
||||
<translation>Развернуть все</translation>
|
||||
</message>
|
||||
@@ -625,7 +626,7 @@
|
||||
<context>
|
||||
<name>QVariantEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="186"/>
|
||||
<location filename="../qvariantedit.cpp" line="203"/>
|
||||
<source>Invalid value</source>
|
||||
<translation>Неверное значение</translation>
|
||||
</message>
|
||||
@@ -655,23 +656,38 @@
|
||||
</context>
|
||||
<context>
|
||||
<name>StringListEdit</name>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="66"/>
|
||||
<source>Apply</source>
|
||||
<translation>Применить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="67"/>
|
||||
<location filename="../qvariantedit.cpp" line="86"/>
|
||||
<location filename="../qvariantedit.cpp" line="92"/>
|
||||
<source>Add</source>
|
||||
<translation>Добавить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="68"/>
|
||||
<location filename="../qvariantedit.cpp" line="87"/>
|
||||
<location filename="../qvariantedit.cpp" line="93"/>
|
||||
<source>Remove</source>
|
||||
<translation>Удалить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="69"/>
|
||||
<location filename="../qvariantedit.cpp" line="88"/>
|
||||
<location filename="../qvariantedit.cpp" line="94"/>
|
||||
<source>Clear</source>
|
||||
<translation>Очистить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="84"/>
|
||||
<source>Clear All</source>
|
||||
<translation>Очистить всё</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../qvariantedit.cpp" line="84"/>
|
||||
<source>Clear All?</source>
|
||||
<translation>Очистить всё?</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@@ -1,42 +1,43 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>../../icons/edit-clear-locationbar-rtl.png</file>
|
||||
<file>../../icons/edit-copy.png</file>
|
||||
<file>../../icons/edit-paste.png</file>
|
||||
<file>../../icons/edit-find.png</file>
|
||||
<file>../../icons/edit-delete.png</file>
|
||||
<file>../../icons/edit-clear.png</file>
|
||||
<file>../../icons/dialog-ok-apply.png</file>
|
||||
<file>../../icons/dialog-warning.png</file>
|
||||
<file>../../icons/tools-wizard.png</file>
|
||||
<file>../../icons/go-next.png</file>
|
||||
<file>../../icons/go-previous.png</file>
|
||||
<file>../../icons/item.png</file>
|
||||
<file>../../icons/item-add.png</file>
|
||||
<file>../../icons/node.png</file>
|
||||
<file>../../icons/node-add.png</file>
|
||||
<file>../../icons/list-add.png</file>
|
||||
<file>../../icons/document-new.png</file>
|
||||
<file>../../icons/document-edit.png</file>
|
||||
<file>../../icons/document-close.png</file>
|
||||
<file>../../icons/document-save.png</file>
|
||||
<file>../../icons/document-save-as.png</file>
|
||||
<file>../../icons/document-save-all.png</file>
|
||||
<file>../../icons/document-revert.png</file>
|
||||
<file>../../icons/document-open.png</file>
|
||||
<file>../../icons/document-open-recent.png</file>
|
||||
<file>../../icons/alpha.png</file>
|
||||
<file>../../icons/chardialog.png</file>
|
||||
<file>../../icons/clineedit.png</file>
|
||||
<file>../../icons/colorbutton.png</file>
|
||||
<file>../../icons/ecombobox.png</file>
|
||||
<file>../../icons/evalspinbox.png</file>
|
||||
<file>../../icons/qcodeedit.png</file>
|
||||
<file>../../icons/qpiconsole.png</file>
|
||||
<file>../../icons/qvariantedit.png</file>
|
||||
<file>../../icons/spinslider.png</file>
|
||||
<file>../../icons/code-word.png</file>
|
||||
<file>../../icons/f1.png</file>
|
||||
<file>../../icons/scroll_spin.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>../../icons/edit-clear-locationbar-rtl.png</file>
|
||||
<file>../../icons/edit-copy.png</file>
|
||||
<file>../../icons/edit-paste.png</file>
|
||||
<file>../../icons/edit-find.png</file>
|
||||
<file>../../icons/edit-delete.png</file>
|
||||
<file>../../icons/edit-clear.png</file>
|
||||
<file>../../icons/dialog-ok-apply.png</file>
|
||||
<file>../../icons/dialog-warning.png</file>
|
||||
<file>../../icons/tools-wizard.png</file>
|
||||
<file>../../icons/go-next.png</file>
|
||||
<file>../../icons/go-previous.png</file>
|
||||
<file>../../icons/item.png</file>
|
||||
<file>../../icons/item-add.png</file>
|
||||
<file>../../icons/node.png</file>
|
||||
<file>../../icons/node-add.png</file>
|
||||
<file>../../icons/list-add.png</file>
|
||||
<file>../../icons/list-edit-apply.png</file>
|
||||
<file>../../icons/document-new.png</file>
|
||||
<file>../../icons/document-edit.png</file>
|
||||
<file>../../icons/document-close.png</file>
|
||||
<file>../../icons/document-save.png</file>
|
||||
<file>../../icons/document-save-as.png</file>
|
||||
<file>../../icons/document-save-all.png</file>
|
||||
<file>../../icons/document-revert.png</file>
|
||||
<file>../../icons/document-open.png</file>
|
||||
<file>../../icons/document-open-recent.png</file>
|
||||
<file>../../icons/alpha.png</file>
|
||||
<file>../../icons/chardialog.png</file>
|
||||
<file>../../icons/clineedit.png</file>
|
||||
<file>../../icons/colorbutton.png</file>
|
||||
<file>../../icons/ecombobox.png</file>
|
||||
<file>../../icons/evalspinbox.png</file>
|
||||
<file>../../icons/qcodeedit.png</file>
|
||||
<file>../../icons/qpiconsole.png</file>
|
||||
<file>../../icons/qvariantedit.png</file>
|
||||
<file>../../icons/spinslider.png</file>
|
||||
<file>../../icons/code-word.png</file>
|
||||
<file>../../icons/f1.png</file>
|
||||
<file>../../icons/scroll_spin.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
#include "qvariantedit.h"
|
||||
#include <QDateTimeEdit>
|
||||
#include <QFileDialog>
|
||||
|
||||
|
||||
StringListEdit::~StringListEdit() {
|
||||
delete combo;
|
||||
delete butt_add;
|
||||
delete butt_del;
|
||||
delete butt_clear;
|
||||
}
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
QStringList StringListEdit::value() const {
|
||||
@@ -19,10 +12,15 @@ QStringList StringListEdit::value() const {
|
||||
|
||||
|
||||
void StringListEdit::setValue(const QStringList & v) {
|
||||
int pi = combo->currentIndex();
|
||||
combo->clear();
|
||||
if (!v.isEmpty()) {
|
||||
combo->addItems(v);
|
||||
combo->setCurrentIndex(0);
|
||||
if (pi < combo->count() && pi >= 0) {
|
||||
combo->setCurrentIndex(pi);
|
||||
} else {
|
||||
combo->setCurrentIndex(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,36 +45,44 @@ void StringListEdit::clear() {
|
||||
}
|
||||
|
||||
|
||||
StringListEdit::StringListEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRight, this) {
|
||||
StringListEdit::StringListEdit(QWidget * parent): QWidget(parent) {
|
||||
lay = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||
combo = new EComboBox(this);
|
||||
combo->setEditable(true);
|
||||
combo->setLineEdit(new CLineEdit);
|
||||
combo->setInsertPolicy(QComboBox::NoInsert);
|
||||
butt_apply = new QPushButton(this);
|
||||
butt_add = new QPushButton(this);
|
||||
butt_del = new QPushButton(this);
|
||||
butt_clear = new QPushButton(this);
|
||||
/*butt_add->setIconSize(QSize(16, 16));
|
||||
butt_del->setIconSize(QSize(16, 16));
|
||||
butt_clear->setIconSize(QSize(16, 16));*/
|
||||
butt_apply->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
butt_add->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
butt_del->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
butt_clear->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
butt_apply->setIcon(QIcon(":/icons/list-edit-apply.png"));
|
||||
butt_add->setIcon(QIcon(":/icons/list-add.png"));
|
||||
butt_del->setIcon(QIcon(":/icons/edit-delete.png"));
|
||||
butt_del->setIcon(QIcon(":/icons/list-remove.png"));
|
||||
butt_clear->setIcon(QIcon(":/icons/edit-clear.png"));
|
||||
butt_apply->setToolTip(tr("Apply"));
|
||||
butt_add->setToolTip(tr("Add"));
|
||||
butt_del->setToolTip(tr("Remove"));
|
||||
butt_clear->setToolTip(tr("Clear"));
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
lay.setSpacing(2);
|
||||
lay.addWidget(combo);
|
||||
lay.addWidget(butt_add);
|
||||
lay.addWidget(butt_del);
|
||||
lay.addWidget(butt_clear);
|
||||
lay->setContentsMargins(0, 0, 0, 0);
|
||||
lay->setSpacing(2);
|
||||
lay->addWidget(combo);
|
||||
lay->addWidget(butt_apply);
|
||||
lay->addWidget(butt_add);
|
||||
lay->addWidget(butt_del);
|
||||
lay->addWidget(butt_clear);
|
||||
setLayout(lay);
|
||||
connect(combo->lineEdit(), SIGNAL(returnPressed()), this, SLOT(editItem()));
|
||||
connect(combo, SIGNAL(rowsChanged()), this, SIGNAL(valueChanged()));
|
||||
connect(butt_apply, SIGNAL(clicked(bool)), this, SLOT(editItem()));
|
||||
connect(butt_add, SIGNAL(clicked(bool)), this, SLOT(addItem()));
|
||||
connect(butt_del, SIGNAL(clicked(bool)), this, SLOT(delItem()));
|
||||
connect(butt_clear, SIGNAL(clicked(bool)), this, SLOT(clear()));
|
||||
connect(butt_clear, &QPushButton::clicked, [this](){
|
||||
if (QMessageBox::question(this, tr("Clear All"), tr("Clear All?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) clear();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -95,6 +101,7 @@ void StringListEdit::editItem() {
|
||||
int ci = combo->currentIndex();
|
||||
if (ci < 0) return;
|
||||
combo->setItemText(ci, combo->currentText());
|
||||
emit valueChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -104,14 +111,11 @@ PathEdit::PathEdit(QWidget * parent): QWidget(parent), lay(QBoxLayout::LeftToRig
|
||||
is_dir = is_abs = is_save = false;
|
||||
filter = tr("All files(*)");
|
||||
line = new CLineEdit(this);
|
||||
//line->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
butt_select = new QPushButton(this);
|
||||
//butt_select->setIconSize(QSize(16, 16));
|
||||
butt_select->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred);
|
||||
butt_select->setIcon(QIcon(":/icons/document-open.png"));
|
||||
butt_select->setToolTip(tr("Choose") + " ...");
|
||||
lay.setContentsMargins(0, 0, 0, 0);
|
||||
//lay.setSpacing(2);
|
||||
lay.addWidget(line);
|
||||
lay.addWidget(butt_select);
|
||||
connect(line, SIGNAL(textChanged(QString)), this, SIGNAL(valueChanged()));
|
||||
@@ -188,7 +192,6 @@ QVariantEdit::~QVariantEdit() {
|
||||
|
||||
|
||||
void QVariantEdit::resizeEvent(QResizeEvent * e) {
|
||||
//_resize();
|
||||
QWidget::resizeEvent(e);
|
||||
}
|
||||
|
||||
@@ -275,8 +278,6 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
|
||||
case QMetaType::Double:
|
||||
#endif
|
||||
_espin = new EvalSpinBox(this);
|
||||
//_spin->setDecimals(5);
|
||||
//_spin->setRange(-1E+199, 1E+199);
|
||||
_cur_edit = _espin;
|
||||
connect(_espin, SIGNAL(valueChanged(double)), this, SLOT(_changed()));
|
||||
break;
|
||||
@@ -409,10 +410,8 @@ void QVariantEdit::_recreate(const QVariant & new_value) {
|
||||
}
|
||||
}
|
||||
}
|
||||
//qDebug() << _cur_edit;
|
||||
if (_cur_edit) {
|
||||
_resize();
|
||||
//_cur_edit->show();
|
||||
}
|
||||
_value = new_value;
|
||||
}
|
||||
@@ -610,7 +609,6 @@ void QVariantEdit::_newPath() {
|
||||
_value = _value.toString();
|
||||
connect(_path, SIGNAL(valueChanged()), this, SLOT(_changed()));
|
||||
_resize();
|
||||
//_cur_edit->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,16 +39,15 @@ class QAD_WIDGETS_EXPORT StringListEdit: public QWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
StringListEdit(QWidget * parent = 0);
|
||||
~StringListEdit();
|
||||
|
||||
QStringList value() const;
|
||||
|
||||
private:
|
||||
virtual void changeEvent(QEvent * e);
|
||||
|
||||
QBoxLayout lay;
|
||||
QBoxLayout * lay;
|
||||
EComboBox * combo;
|
||||
QPushButton * butt_add, * butt_del, * butt_clear;
|
||||
QPushButton * butt_apply, * butt_add, * butt_del, * butt_clear;
|
||||
|
||||
public slots:
|
||||
void setValue(const QStringList & v);
|
||||
|
||||
Reference in New Issue
Block a user