Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9167045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:17:42+00:00 2026-06-17T15:17:42+00:00

I have a bug in next function. This function refreshes table with, adjust column

  • 0

I have a bug in next function. This function refreshes table with, adjust column sizes and sorts table. But in some cases for some rows text in column 3 and 4 is empty. I found out, that it happens in “problem code” section.
What do i wrong in this section? I just want to change size for specific columns.
Please help to find out the problem or show me my mistakes.

def print_day_worklog(self):
    logging.info('RefReshing day worklog table')
    selected_day = self.ui.dateDayWorklogEdit.date().toPyDate()
    day_work = db.get_day_worklog(self.creds[3], selected_day)
    self.ui.tableDayWorklog.setRowCount(len(day_work))
    for row, entry in enumerate(day_work):
        e0 = QtGui.QTableWidgetItem(entry[0])
        e1 = QtGui.QTableWidgetItem(entry[1])
        e2 = QtGui.QTableWidgetItem(entry[2].strftime('%H:%M'))
        e3 = QtGui.QTableWidgetItem(entry[3].strftime('%H:%M'))
        e4 = QtGui.QTableWidgetItem(utils.get_time_spent_string(entry[2],
            entry[3]))
        # debug
        print e0.text(), e1.text(), e2.text(), e3.text(), e4.text()
        self.ui.tableDayWorklog.setItem(row, 0, e0)
        self.ui.tableDayWorklog.setItem(row, 1, e1)
        self.ui.tableDayWorklog.setItem(row, 2, e2)
        self.ui.tableDayWorklog.setItem(row, 3, e3)
        self.ui.tableDayWorklog.setItem(row, 4, e4)

    # problem code starts
    self.ui.tableDayWorklog.horizontalHeader().setResizeMode(1,
        QtGui.QHeaderView.Stretch)
    for column in (0,2,3,4):
        self.ui.tableDayWorklog.resizeColumnToContents(column)
        self.ui.tableDayWorklog.horizontalHeader().setResizeMode(column,
            QtGui.QHeaderView.Fixed)
        self.ui.tableDayWorklog.horizontalHeader().setResizeMode(column,
            QtGui.QHeaderView.Fixed)
    self.ui.tableDayWorklog.sortByColumn(2,0)
    # problem code ends

P.s. it looks not clearly, but it’s because i try to catch the bug

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:17:43+00:00Added an answer on June 17, 2026 at 3:17 pm

    Problem is in table sorting. I’ve found this idea in this question.
    I’ve just added

    self.ui.tableDayWorklog.setSortingEnabled(False)
    

    before filling the table and this

    self.ui.tableDayWorklog.setSortingEnabled(True)
    

    after that. and it helped

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying this code, but apparently i have some bug. The problem is
I have this weird bug, where C++ calls the wrong function: So this bit
Here is some jQuery I have coded: $(function () { $('input').click(function() { $(this).css(background, -webkit-gradient(linear,left
We have this bug that only appears 30% of the time for the Release
This is homework...I'm not asking for answers, I just have a bug I'm not
hi guys i have the next code function getclientip() { $.getJSON(http://192.168.127.2/getipclient.php?callback=?, function(json) { eval(json.ip);
I have encountered a bug in the following linked list function and I have
This is a general question of sorts, but to explain it I will use
I'd like to have a function which returns the next week and year given
So, I essentially have what I want already, very simple, but there are some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.