Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. stylesheet for widgets dynamically
Qt 6.11 is out! See what's new in the release blog

stylesheet for widgets dynamically

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 1.3k Views 2 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.
  • Pradeep KumarP Offline
    Pradeep KumarP Offline
    Pradeep Kumar
    wrote on last edited by
    #1

    Hi,

    I have to provide stylesheet for widgets dynamically,
    here is the code

    the stylesheet is aplied to widgets but its flickering for all, i dont want in that manner.

    QString objectName = QString("%1").arg(i);
            QString color = QString("#%1 { border: 5px solid black; border-color:green;}").arg(i);
    
            m_arr_CCamera[i].widget = new QWidget;
            m_arr_CCamera[i].widget->setObjectName(objectName);
            m_arr_CCamera[i].widget->setStyleSheet(color);
            m_arr_CCamera[i].widget->setSizePolicy(QSizePolicy::Expanding,
                                                       QSizePolicy::Expanding);
    

    Thanks,

    Pradeep Kumar
    Qt,QML Developer

    1 Reply Last reply
    1
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Moderators Qt Champions 2024 Qt Champions 2022 Qt Champions 2017
      wrote on last edited by
      #2

      When does it flicker ? Are you applying style sheet through some option after your app starts ?

      Dheerendra
      @Community Service
      Certified Qt Specialist
      https://www.pthinks.com

      1 Reply Last reply
      3
      • Pradeep KumarP Offline
        Pradeep KumarP Offline
        Pradeep Kumar
        wrote on last edited by
        #3

        Hi,After running the application,

        i am applying in constructor.

        Thanks,

        Pradeep Kumar
        Qt,QML Developer

        1 Reply Last reply
        0
        • Pradeep KumarP Offline
          Pradeep KumarP Offline
          Pradeep Kumar
          wrote on last edited by
          #4

          Hi,

          I have provided border color for the widgets in paintevent, using setpen.

          Thanks,

          Pradeep Kumar
          Qt,QML Developer

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Are you setting a style sheet while at the same time writing your own paint event ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • Pradeep KumarP Offline
              Pradeep KumarP Offline
              Pradeep Kumar
              wrote on last edited by
              #6

              No , i am providing color in paintevent, i am not using stylesheet.

              Thanks,

              Pradeep Kumar
              Qt,QML Developer

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                In that case, why use the style sheet at all ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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