Results 1 to 16 of 16

Thread: QT Table Model

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: QT Table Model

    i allready tried yours but i got a error like

    error:request for member 'exec' in 'ca', which is of non-class type 'formCari'

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QT Table Model

    Quote Originally Posted by aekilic View Post
    i allready tried yours but i got a error like

    error:request for member 'exec' in 'ca', which is of non-class type 'formCari'
    The only difference to your example is that I allocated the dialog on the stack. A modal dialog is one of the cases where it is acceptable to allocate a QWidget on the stack. QDialog::exec() blocks as long as the modal dialog is accepted/rejected.

    I assumed that "formCari" is a subclass of QDialog. You have used exec():
    Quote Originally Posted by aekilic View Post
    Qt Code:
    1. void slotCariEdit(QTreeWidgetItem *item)
    2. {
    3. ...
    4. formCari *ca = new formCari(this, itemcari->statusTip(0));
    5. ca->exec();
    6. ...
    7. }
    To copy to clipboard, switch view to plain text mode 
    So isn't "formCari" a subclass of QDialog? Or did you just mix operators "." and "->" up or even forget an include statement?
    Last edited by jpn; 20th January 2007 at 19:06. Reason: spelling error
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: QT Table Model

    We have solved the problem thank you very much,

    We have tried to change some codes

    connect(tableCariler, SIGNAL(doubleClicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));

    void slotCarilerEdit(const QModelIndex qm)
    {

    formCari *ce = new formCari(this, qm.sibling(qm.row(),0).data().toString());
    ce->exec();
    return;

    }

    Now we would like to do something else with this table. We would like to select something from the the table and send it to slotCarilerEdit with a push button. Any suggestion that we could use?

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QT Table Model

    Quote Originally Posted by aekilic View Post
    We would like to select something from the the table and send it to slotCarilerEdit with a push button. Any suggestion that we could use?
    In Qt, how do you act in general to a button click? The answer is; signals and slots.
    J-P Nurmi

  5. #5
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: QT Table Model

    Yes, we know about the signals and slots but, is it possible to select from table?

    To tell more,

    for the doubleClick

    connect(tableCariler, SIGNAL(doubleClicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));

    the signal starts from tableCariler

    we dont know how to connect tablecariler with a push button so that it will take the QModelIndex from tableCariler?
    Last edited by aekilic; 24th January 2007 at 11:51.

  6. #6
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QT Table Model

    Maybe you could rely on the fact that the modal formCari dialog was shown when the user double clicked on some certain item. So as long as the dialog is blocking the users input, the same item remains active in the table view.

    So maybe you could just connect to the clicked() signal and act in the view according to the current index.
    J-P Nurmi

  7. #7
    Join Date
    Jan 2007
    Posts
    201
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows
    Thanks
    22

    Default Re: QT Table Model

    But if we say we have a slot like this

    connect(pushInceleCari, SIGNAL(clicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));

    how could program could understand that there should be link between table and button?

  8. #8
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: QT Table Model

    Quote Originally Posted by aekilic View Post
    connect(pushInceleCari, SIGNAL(clicked(QModelIndex)), parent, SLOT(slotCarilerEdit(const QModelIndex)));
    You cannot do this. You cannot add random parameter types to signals. QPushButton offers a signal clicked(), not clicked(QModelIndex).

    Qt Code:
    1. connect(pushInceleCari, SIGNAL(clicked()), parent, SLOT(doSomething()));
    2.  
    3. void doSomething()
    4. {
    5. QModelIndex idx = tableView->currentIndex();
    6. ...
    7. }
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

Similar Threads

  1. hierarchical model in a flat view
    By gniking in forum Qt Programming
    Replies: 4
    Last Post: 10th November 2009, 20:17
  2. Relational Table Model Problem
    By aekilic in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2007, 14:57
  3. displaying any table on a qdatatable
    By Philip_Anselmo in forum Newbie
    Replies: 4
    Last Post: 9th May 2006, 22:12
  4. creating table plugin
    By mgurbuz in forum Qt Programming
    Replies: 3
    Last Post: 28th April 2006, 13:50
  5. Table model / view editing issue
    By Caius Aérobus in forum Qt Programming
    Replies: 9
    Last Post: 7th April 2006, 11:03

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.