Results 1 to 16 of 16

Thread: Timetable Widget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Timetable Widget

    Quote Originally Posted by saa7_go View Post
    You can access selected indexes through QAbstractItemView::selectionModel().

    Qt Code:
    1. tableView->selectionModel()->selectedIndexes();
    To copy to clipboard, switch view to plain text mode 
    Call the selectedIndexes() method after some event from MainWindow (that contains the tableView)?

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Wiki edits
    1

    Default Re: Timetable Widget

    Maybe, yes.... I don't understand with "after some event from MainWindow".
    For example, if you have a pushbutton, you connect it's clicked() signal to your pusbutton_clicked() slot, then in your pushbutton_clicked() function you called selectedIndexes().
    Last edited by saa7_go; 27th July 2010 at 15:02. Reason: updated contents

  3. #3
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Timetable Widget

    Quote Originally Posted by saa7_go View Post
    Maybe, yes.... I don't understand with "after some event from MainWindow".
    For example, if you have a pushbutton, you connect it's clicked() signal to your pusbutton_clicked() slot, then in your pushbutton_clicked() function you called selectedIndex().
    Thanks for the tips! Single click on a single cell is alright for me now. I would like to perform multiple cells selection and update the value.

  4. #4
    Join Date
    Jan 2009
    Posts
    53
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    12
    Thanked 1 Time in 1 Post

    Default Re: Timetable Widget

    I did tried to use the code below to make left-click drag and multiple selection of cells. It works with multiple selection. However, I cannot make entered() and clicked() mutually exclusive to each other for a cell. It triggers double events called when clicked and the reverted the value. Any other approaches?
    Qt Code:
    1. connect( tableView, SIGNAL(entered(const QModelIndex &) ), this, SLOT( setOnOff(const QModelIndex &) ) );
    2. connect( tableView, SIGNAL(clicked(const QModelIndex &) ), this, SLOT( setOnOff(const QModelIndex &) ) );
    To copy to clipboard, switch view to plain text mode 
    Also, how can I paint a "focus" rectangle upon mouse hover a QTableView's cell?

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 07:06
  2. Remove widget from a QList
    By Eos Pengwern in forum Newbie
    Replies: 4
    Last Post: 16th October 2009, 21:25
  3. Playbutton functionality
    By uchennaanyanwu in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2008, 22:29
  4. How to Open & Close a Widget ?!!
    By Fatla in forum Qt Programming
    Replies: 6
    Last Post: 13th June 2008, 20:39
  5. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35

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
  •  
Qt is a trademark of The Qt Company.