Results 1 to 2 of 2

Thread: How to access the lineEdits values in TableView

  1. #1
    Join Date
    Jul 2009
    Location
    Bangalore
    Posts
    68
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default How to access the lineEdits values in TableView

    Hi All,

    I have designed(Qt Designer-4.4.3) a QTableView and i need to enter the some data from another dialog with 4 lineEdits. how do i access the lineEdits values and display in the QTableView and here is the code snippet which i have implemented.
    Qt Code:
    1. void ToolForm::addEntry()
    2. {
    3. ToolAddDialog tooladddialog;
    4.  
    5. if (tooladddialog.exec()) {
    6. QString toolnumber = tooladddialog.toolnolineEdit->text();
    7. QString tooldiameter = tooladddialog.diameterlineEdit->text();
    8. QString toollength = tooladddialog.lengthlineEdit->text();
    9. QString toolunits = tooladddialog.unitslineEdit->text();
    10. addEntry(toolnumber, tooldiameter, toollength, toolunits);
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 
    Thanks & Regards
    Sandeep G.R.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How to access the lineEdits values in TableView

    Add getter functions to your ToolAddDialog. Something like:

    Qt Code:
    1. class ToolAddDialog : public QDialog
    2. {
    3. public:
    4. QString getDiameter() const
    5. {
    6. return ui.diameterlineEdit->text();
    7. }
    8. // and so on....
    9. }
    To copy to clipboard, switch view to plain text mode 

    in your function you can access it via:
    Qt Code:
    1. void ToolForm::addEntry()
    2. {
    3. ToolAddDialog tooladddialog;
    4.  
    5. if (tooladddialog.exec()) {
    6. QString tooldiameter = tooladddialog.getDiameter();
    7. //...
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. how to access widgets values?
    By BalaQT in forum Qt Programming
    Replies: 4
    Last Post: 22nd August 2009, 12:06

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.