atrr-editor_patch.diff

Larry Shaffer, 2012-12-16 09:40 PM

Download (3.56 KB)

View differences:

src/gui/qgsattributeeditor.cpp
494 494
        myWidget = pte;
495 495
      }
496 496

  
497
      QLineEdit* cble = 0;
497 498
      if ( cb )
498 499
      {
500
        cble = cb->lineEdit();
499 501
        myWidget = cb;
500 502
      }
501 503

  
......
516 518
          relay = new QgsStringRelay( myWidget );
517 519
        }
518 520

  
519
        if ( cb && cb->isEditable() )
521
        if ( cb && cb->isEditable() && cble )
520 522
        {
521
          synchronized =  connect( relay, SIGNAL( textChanged( QString ) ), myWidget, SLOT( setEditText( QString ) ) );
522
          synchronized &= connect( myWidget, SIGNAL( editTextChanged( QString ) ), relay, SLOT( changeText( QString ) ) );
523
          synchronized =  connect( relay, SIGNAL( textChanged( QString ) ), cb, SLOT( setEditText( QString ) ) );
524
          synchronized &= connect( cble, SIGNAL( textChanged( QString ) ), relay, SLOT( storeText( QString ) ) );
525
          synchronized &= connect( cble, SIGNAL( editingFinished() ), relay, SLOT( sendStoredText() ) );
523 526
        }
524 527
        else
525 528
        {
526 529
          synchronized =  connect( relay, SIGNAL( textChanged( QString ) ), myWidget, SLOT( setText( QString ) ) );
527
          synchronized &= connect( myWidget, SIGNAL( textChanged( QString ) ), relay, SLOT( changeText( QString ) ) );
530
          synchronized &= connect( myWidget, SIGNAL( textChanged( QString ) ), relay, SLOT( storeText( QString ) ) );
531
          synchronized &= connect( myWidget, SIGNAL( editingFinished() ), relay, SLOT( sendStoredText() ) );
528 532
        }
529 533

  
530 534
        if ( !cb || cb->isEditable() )
......
888 892
    default:
889 893
    {
890 894
      QLineEdit *le = qobject_cast<QLineEdit *>( editor );
895
      QComboBox *cb = qobject_cast<QComboBox *>( editor );
891 896
      QTextEdit *te = qobject_cast<QTextEdit *>( editor );
892 897
      QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
893
      if ( !le && !te && !pte )
898
      if ( !le && ! cb && !te && !pte )
894 899
        return false;
895 900

  
896 901
      QString text;
......
910 915

  
911 916
      if ( le )
912 917
        le->setText( text );
918
      if ( cb && cb->isEditable() )
919
        cb->setEditText( text );
913 920
      if ( te )
914 921
        te->setHtml( text );
915 922
      if ( pte )
src/gui/qgsattributeeditor.h
95 95
      emit textChanged( str );
96 96
    }
97 97

  
98
    void storeText( QString str )
99
    {
100
      mStoredText = str;
101
    }
102

  
103
    void sendStoredText()
104
    {
105
      emit textChanged( mStoredText );
106
    }
107

  
98 108
  signals:
99 109
    void textChanged( QString );
110

  
111
  private:
112
    QString mStoredText;
100 113
};
101 114

  
102 115
#endif
103
-