git-svn-id: svn://db.shs.com.ru/libs@399 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -151,6 +151,7 @@ bool QCDCore::bindWidget(QWidget * w) {
|
||||
|
||||
bool QCDCore::bindWidget(QWidget * w, const CDType & k) {
|
||||
if (!w) return false;
|
||||
//piCout << "bind..." << k.name() << k.path();
|
||||
QString cn = w->metaObject()->className();
|
||||
bool ok = false;
|
||||
if (cn == "QCheckBox" || cn == "QGroupBox") {
|
||||
@@ -179,7 +180,7 @@ bool QCDCore::bindWidget(QWidget * w, const CDType & k) {
|
||||
connect(w, SIGNAL(destroyed(QObject*)), this, SLOT(slotDestroyed(QObject*)), Qt::UniqueConnection);
|
||||
setWidgetValue(w, k);
|
||||
if (!ok) return false;
|
||||
//piCout << k.name() << k.path();
|
||||
//piCout << k.name() << k.path() << "ok";
|
||||
binded_widgets.insert(w, k.path());
|
||||
return true;
|
||||
}
|
||||
@@ -252,6 +253,7 @@ int QCDCore::unbindWidgets(QList<QWidget * > wl) {
|
||||
|
||||
bool QCDCore::unbindWidget(QWidget * w) {
|
||||
if (!w) return false;
|
||||
//qDebug() << "unbind" << w;
|
||||
if (!binded_widgets.contains(w)) return false;
|
||||
QString cn = w->metaObject()->className();
|
||||
if (cn == "QCheckBox" || cn == "QGroupBox")
|
||||
@@ -264,13 +266,16 @@ bool QCDCore::unbindWidget(QWidget * w) {
|
||||
disconnect(w, SIGNAL(textChanged(QString)), this, SLOT(slotText(QString)));
|
||||
if (cn == "QVariantEdit")
|
||||
disconnect(w, SIGNAL(valueChanged(QVariant)), this, SLOT(slotVariant(QVariant)));
|
||||
//qDebug() << "remove b" << binded_widgets.size();
|
||||
binded_widgets.remove(w);
|
||||
//qDebug() << "remove a" << binded_widgets.size();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void QCDCore::unbindAllWidgets() {
|
||||
QMapIterator<QWidget * , PIDeque<int> > it(binded_widgets);
|
||||
QMap<QWidget * , PIDeque<int> > bwm = binded_widgets;
|
||||
QMapIterator<QWidget * , PIDeque<int> > it(bwm);
|
||||
while (it.hasNext()) {
|
||||
QWidget * w = it.next().key();
|
||||
unbindWidget(w);
|
||||
|
||||
Reference in New Issue
Block a user