Results 1 to 12 of 12

Thread: How to display marquee animation of QProgressBar properly when using it in QTreeView

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to display marquee animation of QProgressBar properly when using it in QTreeV

    You are right, "constantly" doesn't make sense.

    the progress bar animated regardless if it changes its values or not
    I haven't thought of that yet because I don't use Windows so often.

    Maybe I can reduce that problem by hiding progress bars that aren't visible. I will try it and test it on Windows.
    Last edited by Infinity; 10th August 2013 at 23:20.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to display marquee animation of QProgressBar properly when using it in QTreeV

    Quote Originally Posted by Infinity View Post
    I haven't thought of that yet because I don't use Windows so often.
    Neither do I but my students had to deal with the animated progress bar problem back in Qt 4.4-ish days. I don't think much has changed since then in this regard.

    Maybe I can reduce that problem by hiding progress bars that aren't visible. I will try it and test it on Windows.
    I think you should first think if you really need to update all those bars "constantly" as this seems to me like a bigger problem than Windows redrawing progress bars (you can always draw a progress bar yourself in the delegate to overcome this issue).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Oct 2012
    Posts
    132
    Thanks
    10
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: How to display marquee animation of QProgressBar properly when using it in QTreeV

    I tested the application under Windows. There are no performance problems, but the CPU usage is higher. I think the animation (which I don't really need) is not worth it considering the higher CPU usage.

    As already mentioned I'm also displaying QComboBoxes in another column. Currently I'm using openPersistentEditor() to display them. Now I've tried to display them by manual painting:
    Qt Code:
    1. void ComboBoxItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const//(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
    2. {
    3. QStyleOptionComboBox comboBoxOption;
    4. comboBoxOption.rect = option.rect;
    5. comboBoxOption.state = option.state;
    6. comboBoxOption.state |= QStyle::State_Enabled;
    7. comboBoxOption.state |= QStyle::State_On;
    8. comboBoxOption.subControls = QStyle::SC_All;
    9. comboBoxOption.editable = false;
    10. comboBoxOption.currentText = index.model()->data(index).toString();
    11.  
    12. QApplication::style()->drawComplexControl(QStyle::CC_ComboBox, &comboBoxOption, painter);
    13. QApplication::style()->drawControl(QStyle::CE_ComboBoxLabel, &comboBoxOption, painter);
    14. }
    To copy to clipboard, switch view to plain text mode 

    On Windows the code works, but on Linux (when using QGtkStyle) I'm just getting the ComboBoxLabel. Does anybody know why painting the combo box not works with QGtkStyle?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to display marquee animation of QProgressBar properly when using it in QTreeV

    Drawing a combobox is one thing. Making it work like a combobox is another. If you want to hear my personal opinion then pushing comboboxes into table columns is a violation against user experience If you consider what the column contains -- it contains some VALUE. The way you change the value and the sole fact that you can change the value (or not) is meaningless while displaying that value. If you display a bunch of comboboxes in a column, you just clutter the display and you have no functional benefit over just displaying the value contained in the field. If the user wants to edit a field, he will enter edit mode and use the combo that pops up, to modify the value which afterwards will again be displayed in the column.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 11
    Last Post: 30th March 2015, 06:03
  2. Replies: 0
    Last Post: 15th April 2011, 19:04
  3. QProgressBar "crash" - doesn't work properly
    By metRo_ in forum Qt Programming
    Replies: 6
    Last Post: 23rd October 2010, 13:56
  4. Replies: 21
    Last Post: 20th October 2010, 13:25
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.