Results 1 to 9 of 9

Thread: QTableWidgetItem editing problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Question Re: QTableWidgetItem editing problem

    ........
    QAbstractItemModel* model=ui.futuresTableWidget->model();


    ind= model->index(row,col);

    QWidget *w =0;

    if(it==0) it=dynamic_cast<QDrvAbstractItemDelegate*>ui.futur esTableWidget->itemDelegate());

    QStyleOptionViewItem styleIt;
    if(it!=0) w=it->createEditor(ui.futuresTableWidget,styleIt,ind) ;

    auxLine=qobject_cast<QLineEdit*> (w);
    it->setEditorData(auxLine,ind);

    connect(auxLine,SIGNAL(cursorPositionChanged ( int, int ) ),this,SLOT(cursorPosChanged(int,int)) );

    numPad->setWindowModality(Qt::WindowModal);
    numPad->show();
    numPad->raise();
    ........



    I use auxLine to manage the text that i send from my numPad which is another widget from that i send numbers to the tablewidget and i want to insert the numbers where the
    cursor is

    the thing is when i send a number the qtablewidget item turns gray and it inserts items only at its end i dont know if this is relevant

    //slot // numPad emits a signal sendText(t); and sends the text here
    void catchText(QString text)
    {
    auxLine.insert(text);
    }

  2. #2
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    4
    Thanked 140 Times in 132 Posts

    Default Re: QTableWidgetItem editing problem

    ... couldn't get the idea. Can you provide compilable example? Or at least some sreenshot?
    P.S. and use CODE tags for code.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  3. #3
    Join Date
    Jul 2008
    Posts
    26
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Question Re: QTableWidgetItem editing problem

    i think it should be pretty clear
    i want to edit the QtableWidgetItem like a QlineEdit ,and to use the insert function of QlineEdit and to insert text anywhere where i place the cursor , so if someone knows how to do that....
    Thanks
    Last edited by fmariusd; 4th September 2009 at 08:16.

Similar Threads

  1. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.