Results 1 to 8 of 8

Thread: Qtablewidget like Excel

  1. #1
    Join Date
    Jul 2013
    Posts
    54
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Question Qtablewidget like Excel

    Hi every body ,


    i want to reimplement my QtableWidget to work like so,

    at start QtableWidget looks like so

    ________________________
    |column1| column2| column3|
    --------|--------|-------- |
    |x |y |z=x*y |
    -----------------------------

    I want this :

    when user type a number in Column1(X) and Column2 (Y) ( user must fill x and y to be able to show result in z)

    the result updated automatically in Column3 (Z)

    how i can do this ???

  2. #2
    Join Date
    Jul 2013
    Posts
    54
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Qtablewidget like Excel

    plz i need a hint

  3. #3
    Join Date
    Jul 2013
    Posts
    54
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Qtablewidget like Excel

    if my post is not clera

    i need some thing like so,

    ////////////////////////////////
    // combobox //
    //////////////////////////////////////////////////////////////////////////////////
    // Qtableview her with all cells inside it ** Horizontal Header //
    /////////////////////////////////////////////////////////////////////////////////
    /// row 0 //
    /////////////////////////////////////////////////////////////////////////////////
    /// row 1 //
    /////////////////////////////////////////////////////////////////////////////////
    /// row 2 //
    /////////////////////////////////////////////////////////////////////////////////

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

    Default Re: Qtablewidget like Excel

    Use QTableWidget::cellChanged(). Connect it to a slot, calculate and update the result.

  5. #5
    Join Date
    Jul 2013
    Posts
    54
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Qtablewidget like Excel

    thanks a lot

    is this the optimized methode ??

    you have an idea about how MS excel calculate results ?

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

    Default Re: Qtablewidget like Excel

    Quote Originally Posted by advseo32 View Post
    is this the optimized methode ??
    Yes, I think so.

    you have an idea about how MS excel calculate results ?
    Well, it does not use Qt, but the general approach is the same: detect value change, recalculate, update with new value (if needed). How could one optimize that?

  7. #7
    Join Date
    Jul 2013
    Posts
    54
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1

    Default Re: Qtablewidget like Excel

    Quote Originally Posted by Lykurg View Post
    Yes, I think so.


    Well, it does not use Qt, but the general approach is the same: detect value change, recalculate, update with new value (if needed). How could one optimize that?
    don't worry about this , i want only to get advices from professionals, and correct my errors

    thank's for helping

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Qtablewidget like Excel

    I imagine that Excel creates a dependency tree between cells in much the same way that make does for builds. When a cell is changed the downstream recalculation flows by simply following the dependency tree. This approach allows for early detection of circular references.

    C++ GUI Programming with Qt 4 (Second Edition) walks through a simple spreadsheet application. The same example may be in the first edition (which can be had for no money). http://www.qtrac.eu/marksummerfield.html

Similar Threads

  1. Replies: 2
    Last Post: 19th July 2013, 10:44
  2. Replies: 1
    Last Post: 2nd August 2012, 11:17
  3. Qt and Excel
    By eltecprogetti in forum Qt Programming
    Replies: 7
    Last Post: 13th March 2012, 13:04
  4. Replies: 2
    Last Post: 15th December 2011, 22:57
  5. Replies: 3
    Last Post: 1st February 2011, 12: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.