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. how to apply hover in button
Forum Updated to NodeBB v4.3 + New Features

how to apply hover in button

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 7.9k 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.
  • R Offline
    R Offline
    Rameshguru
    wrote on last edited by
    #1

    HI,
    I create a small window and apply style sheet using css file
    but in button how to write apply a hover property
    suppose i set background (ui->pushbutton->setstylesheet(style))
    same way how to apply hover in coding side

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

      Hi,

      @Rameshguru

      u can try the link from SO:

      https://stackoverflow.com/questions/19161119/using-hover-and-pressed-stylesheet-qt

      Hope this helps

      Thanks,

      Pradeep Kumar
      Qt,QML Developer

      1 Reply Last reply
      0
      • R Offline
        R Offline
        Rameshguru
        wrote on last edited by
        #3

        thank you @Pradeep-Kumar
        i already applied ,this is ok
        but i want coding part like
        QString cs1="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);";
        ui->pushbutton->setstylesheet(cs1);

        same way how to write code in hover

        raven-worxR 1 Reply Last reply
        0
        • R Rameshguru

          thank you @Pradeep-Kumar
          i already applied ,this is ok
          but i want coding part like
          QString cs1="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);";
          ui->pushbutton->setstylesheet(cs1);

          same way how to write code in hover

          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @Rameshguru said in how to apply hover in button:

          QString cs1="background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);";
          ui->pushbutton->setstylesheet(cs1);

          for example:

          QString cs1="QPushButton {"
                         "background-color: rgb(255, 255, 255);"
                         "color: rgb(0, 0, 0);"
                       "}"
                       "QPushButton:hover {"
                           "..."
                       "}";
          ui->pushbutton->setstylesheet(cs1);
          

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          2
          • R Offline
            R Offline
            Rameshguru
            wrote on last edited by
            #5

            @raven-worx ,@Pradeep-Kumar sir
            now it,s properly working
            Thank you sir

            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