Results 1 to 9 of 9

Thread: QListWidget refreshing issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    May 2010
    Posts
    61
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    2
    Thanked 6 Times in 5 Posts

    Default Re: QListWidget refreshing issue

    Hey ouekah,

    Good news! I believe i have found a hack for solving this.
    I just had an idea and tried it out on my Mac. What I did was the following:
    1. added a private slot in my header
    Qt Code:
    1. private slots:
    2. void buttonWasPushed();
    3. void updateGroupBoxTitle();
    To copy to clipboard, switch view to plain text mode 

    2. In the already defined add function I do not call directly groupBox->setTitle(), but instead I use the QTimer:singleShot() static function:
    Qt Code:
    1. void Form::add(const QString& item)
    2. {
    3. ui->listWidget->addItem(item);
    4. QTimer::singleShot(0, this, SLOT(updateGroupBoxTitle()));
    5. }
    To copy to clipboard, switch view to plain text mode 
    .

    Then, in the implementation of the updateGroupBoxTitle() slot i just set the title of the groupbox:
    Qt Code:
    1. void Form::updateGroupBoxTitle()
    2. {
    3. ui->groupBox->setTitle("Currently (" + QString::number(ui->listWidget->count()) + ")"); // updates QGroupBox title
    4. }
    To copy to clipboard, switch view to plain text mode 

    This works for me. I hope it will be functional for you also.
    If it does work, do not ask me why .

    Waiting for your feedback...
    Wladek
    One second is long, everything longer than two seconds is definitely too long.

  2. The following user says thank you to wladek for this useful post:

    ouekah (8th July 2010)

Similar Threads

  1. QListWidget issue
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2009, 11:54
  2. dropdown menu(popupmenu) refreshing issue
    By Ankit in forum Qt Programming
    Replies: 12
    Last Post: 24th August 2007, 04:57
  3. dropdown menu(popupmenu) refreshing issue
    By Ankit in forum Qt Tools
    Replies: 3
    Last Post: 17th August 2007, 13:09
  4. Refreshing issue
    By Ankit in forum Qt Programming
    Replies: 1
    Last Post: 14th August 2007, 12:30
  5. QListWidget::currentItem() issue
    By high_flyer in forum Qt Programming
    Replies: 4
    Last Post: 16th April 2007, 11:04

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.