Results 1 to 3 of 3

Thread: Selecting row in tableview on focus, got a solution but not sure if foolproof [gif]

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2015
    Posts
    20
    Thanks
    7
    Qt products
    Platforms
    Unix/X11

    Question Selecting row in tableview on focus, got a solution but not sure if foolproof [gif]

    so when table view gets focused on some DE with some themes its barely visible

    like here on default theme KDE on opensuse, we dont even see it highlighting first row, only when I jump arrow down we see where we are


    So I wanned to improve that by selecting the row right away...



    heres the relevant part from the example above, its custom focusInEvent defined in the tableview
    Qt Code:
    1. def focusInEvent(self, event):
    2. row = self.currentIndex().row()
    3. if row == -1:
    4. row = 0
    5. self.selectRow(row)
    6. QTableView.focusInEvent(self, event)
    To copy to clipboard, switch view to plain text mode 
    but should I also let it run to the default focusInEvent with that 6th line?
    can I remove that last line without expecting some issues? I tested it without and it seemed fine but I am not really sure about all the stuff that could be going on.
    is there a better way? like setting some preference to true to get this selection going on focus?
    Is it OK solution?

    heres the whole code of the example, pyqt5, python3
    Last edited by DoTheEvo; 8th May 2016 at 00:10.

Similar Threads

  1. best threading solution?
    By danics in forum Qt Programming
    Replies: 20
    Last Post: 18th August 2013, 14:30
  2. Replies: 3
    Last Post: 18th July 2012, 14:15
  3. paint solution
    By abu45 in forum Newbie
    Replies: 3
    Last Post: 14th September 2010, 09:49
  4. clean solution?
    By Dumbledore in forum Qt Programming
    Replies: 5
    Last Post: 30th October 2007, 00:44
  5. Focus issues / Setting multiple focus
    By ComputerPhreak in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2007, 06:09

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.