Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. About ReDraw button on QWidget
Forum Updated to NodeBB v4.3 + New Features

About ReDraw button on QWidget

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dleviathan
    wrote on last edited by
    #1

    I have a problem as:
    @
    int nViTri = (10 - sDapAnNhanDc.length()) / 2;
    for(int i = 0; i < _arrKyTuDapAn->count(); i++)
    {
    CongCuGiaoDien::log(this, "hienThiDapAn >>> nVitri hien thi: " + QString::number(nViTri).toAscii());
    QPushButton *_btnTemp = new QPushButton(ui->_widKetQua);
    _btnTemp->setGeometry(nViTri * 35, 15, 35, 35);
    _btnTemp->setEnabled(true);
    _btnTemp->setStyleSheet(".QPushButton{border-image: none; background-color: rgba(255, 255, 255, 0);}");
    _arrViTriCacDapAn->append(_btnTemp);
    }
    @
    when i want to update the nViTri with new formula, my buttons on widget NO Redraw although i had use Update() or etc....
    how to solve it!
    Thanks for all support!

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      So... how many items are in _arrkYTuDapAn? Is that in the order of magnitude of 10, 100, 10000?
      Note that changing visible properties of items on the screen will only result in a a repaint event being queued in the eventqueue. You need to give the eventqueue time to actually do the repaints too, at some point. That will happen after your loop is done. If that is too late for you, you should considder either breaking up your loop in multiple runs over parts of the array, or perhaps call QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents | QEventLoop::ExcludeSocketNotifiers) once every few iterations.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Fuzzbender
        wrote on last edited by
        #3

        How did you tried to update your buttons?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved