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. Hovercraft 2
Forum Updated to NodeBB v4.3 + New Features

Hovercraft 2

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.5k 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
    David King
    wrote on last edited by
    #1

    Hi,

    Who knows if Qt Script styled pushbuttons, act on hover and pressed styles ?

    I'm using Qt Script only, so just a .js and .ui - our vendor tool launches the .js,
    which then loads a .ui via special command.

    Everything Qt I've tried works, except for this:

    I have 2 buttons: one unstyled, and one styled. The unstyled (ie stylesheet empty), when I hover or press it, visually changes.

    But the styled one visually does nothing, despite my trying configuring hover and pressed in the stylesheet about 27 different ways, according to all the Qt documentation etc examples.

    So I'm either in need a way 28+ (the most likely by far).

    Or, with just a Qt Script js+ui pair, re hover and pressed events, unsupported ?

    I've not read anything to that effect. But perhaps, you know otherwise..

    Many thanks,

    David

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Can it be you have conflicting statements for the pushbuttons ?
      Just tried

      QPushButton:hover:!pressed
      {
        border: 1px solid red;
      }
      

      and get this
      alt text

      D 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        Can it be you have conflicting statements for the pushbuttons ?
        Just tried

        QPushButton:hover:!pressed
        {
          border: 1px solid red;
        }
        

        and get this
        alt text

        D Offline
        D Offline
        David King
        wrote on last edited by
        #3

        Hi mrjj,

        Thanks again. Yep, I had tried as above :-/

        But got me thinking. And I realised, my existing styleSheet content, needed the following added, before and after:

        Before: QPushbutton {
        After: }

        Actually, I don't understand why that wrapping is needed, if there are also hover or pressed actions in the styleSheet. Why is that ?

        It also seems a bit odd, telling a QPushButton, it is a QPushButton

        Anyway, with the wrapping added, all is working well :-) #28 it was !

        Many thanks,

        David

        mrjjM 1 Reply Last reply
        0
        • D David King

          Hi mrjj,

          Thanks again. Yep, I had tried as above :-/

          But got me thinking. And I realised, my existing styleSheet content, needed the following added, before and after:

          Before: QPushbutton {
          After: }

          Actually, I don't understand why that wrapping is needed, if there are also hover or pressed actions in the styleSheet. Why is that ?

          It also seems a bit odd, telling a QPushButton, it is a QPushButton

          Anyway, with the wrapping added, all is working well :-) #28 it was !

          Many thanks,

          David

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #4

          @David-King
          Its called a selector.
          We say this is for class type pushbutton. else it would affect all widgets.
          So to avoid a mess, its often good to use a selector.
          Like ClassType, or object name. etc.
          http://doc.qt.io/qt-5/stylesheet-syntax.html

          1 Reply Last reply
          0
          • D Offline
            D Offline
            David King
            wrote on last edited by
            #5

            Ooh ok. Almost all of my styleSheet content is without selectors presently.
            Though oddly, I don't see any other elements getting those styles.

            mrjjM 1 Reply Last reply
            0
            • D David King

              Ooh ok. Almost all of my styleSheet content is without selectors presently.
              Though oddly, I don't see any other elements getting those styles.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @David-King
              Well it depends on where you set style sheet.
              if directly on widget, then only it self and its children are affected.
              So if directly on button, then you wont see other get the style as they are not
              children. Often you set stylesheet on Mainwindow or application so
              all is covered automatically. and there selectors are important.

              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