Results 1 to 4 of 4

Thread: Help on using QTableWidget with LineEdit.

  1. #1
    Join Date
    Oct 2009
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Help on using QTableWidget with LineEdit.

    Hi,
    i have a lineEdit widget set to QTableWidget cell. With validator added to lineEdit.
    Can i get any signal from QTableWidget, if the lineEdit set of the tableWidget is changed ?
    like cellChanged(int,int) when we use QTableWidget Item

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Help on using QTableWidget with LineEdit.

    The first thing that comes to my mind if you don't want to use your QLineEdit pointer, is that you can connect to the cell widget signals by using:
    Qt Code:
    1. connect(pTableWidget->cellWidget(row,col),SIGNAL(someSignal()),pObj,SLOT(someSlot()));
    To copy to clipboard, switch view to plain text mode 

    but you can also just use the pointer to your QLineEdit.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Oct 2009
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help on using QTableWidget with LineEdit.

    Ya true, but i can't use validator with QTableWidgetItem so by using that method i have to wait for the user to finish entering the value for validating.

    I want to validate as user keys in the data for ex: i don't want the user to enter the alphabet in cell where i am expecting integer.

  4. #4
    Join Date
    Oct 2009
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Help on using QTableWidget with LineEdit.

    Any way i have solved by connecting the signals of the lineEdit to slot almost the same way as you said. But i want to know is there a better solution ?

Similar Threads

  1. Replies: 7
    Last Post: 18th September 2009, 10:59
  2. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 13th October 2007, 23:29
  3. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 19th December 2006, 23:27
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.