Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

bool Item::mouseDoubleClickEvent ( const EventInfo eventInfo  )  [virtual]

Todo:
Replace this with KInputDialog::getMultiLineText for KDE 3.3

Definition at line 287 of file item.cpp.

References Variant::editorCaption(), Variant::setValue(), and Variant::value().

Referenced by CMManager::mouseDoubleClickEvent().

{
      Q_UNUSED(eventInfo);
      
      typedef QValueList<Variant*> VarPtrLst;
      VarPtrLst list;
      const VariantDataMap::iterator variantDataEnd = m_variantData.end();
      for ( VariantDataMap::iterator it = m_variantData.begin(); it != variantDataEnd; ++it )
      {
            if ( it.data()->type() == Variant::Type::Multiline ) {
                  list.append(it.data());
            }
      }
      if ( list.count() > 1 )
      {
            kdWarning() << "Item::mouseDoubleClickEvent: Can't handle more than one multiline data"<<endl;
            return false;
      }
      else if ( list.isEmpty() )
            return false;
      
      Variant *v = *(list.at(0));
      
      /// @todo Replace this with KInputDialog::getMultiLineText for KDE 3.3
//    bool ok;
//    QString text = KInputDialog::getMultiLineText( v->caption(), "", v->getValue(), ok );

      KDialogBase *dlg = new KDialogBase( 0l, "", true, v->editorCaption(), KDialogBase::Ok|KDialogBase::Cancel|KDialogBase::User1, KDialogBase::Ok, false, KStdGuiItem::clear() );
      QFrame *frame = dlg->makeMainWidget();
      QVBoxLayout *layout = new QVBoxLayout( frame, 0, dlg->spacingHint() );
      KTextEdit *textEdit = new KTextEdit( frame );
      textEdit->setTextFormat( PlainText );
      textEdit->setText( v->value().toString() );
      layout->addWidget( textEdit, 10 );
      textEdit->setFocus();
      connect( dlg, SIGNAL( user1Clicked() ), textEdit, SLOT( clear() ) );
      dlg->setMinimumWidth( 600 );
      if ( dlg->exec() == KDialogBase::Accepted )
      {
            v->setValue( textEdit->text() );
            dataChanged();
            p_itemDocument->setModified(true);
      }
      delete dlg;
      
      return true;
}


Generated by  Doxygen 1.6.0   Back to index