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. What is this widget? Is it available for Qt?

What is this widget? Is it available for Qt?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 6 Posters 2.4k Views
  • 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    I saw this in a couple of apps for Ubuntu..

    !http://i.imgur.com/vy4X6.png(Screen)!

    Is this Ubuntu specific (Gtk) ?9

    1 Reply Last reply
    0
    • JohanSoloJ Offline
      JohanSoloJ Offline
      JohanSolo
      wrote on last edited by
      #2

      I've seen this on Wind*** as well, therefore I don't think this is Ubuntu specific. But I have no idea whether there is a Qt version of it.

      `They did not know it was impossible, so they did it.'
      -- Mark Twain

      1 Reply Last reply
      0
      • P Offline
        P Offline
        pcmantinker
        wrote on last edited by
        #3

        If you have experience in Qt Widget development, you could implement your own.

        This is a very basic overview, but I'd make a widget class that inherits QWidget and create a layout manager and add two QLabels for the two switch states to layout manager. You could then style each QLabel using QSS to use specific background colors and rounded corners. The switch element can be a widget styled to have rounded corners and be placed on top of the main widget. You'll have to create signals for handling the click event of the switch. Then within your main code, you'll have to connect the switch state changed signal to a slot.

        I may look into making a widget like this at some point. It's got a nice clean look. I'll put the source on my Github if I do decide to make the widget.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          raaghuu
          wrote on last edited by
          #4

          It looks like a QML Switch Element...

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Sam
            wrote on last edited by
            #5

            yes it looks like "Slide Switch example ":http://doc.qt.nokia.com/4.7-snapshot/declarative-ui-components-slideswitch.html

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tucnak
              wrote on last edited by
              #6

              Hi, ~Leon!

              Qt doesn't have this widget in defaults, but it's very simple to implement it on your own!

              I will do it in this way.

              1. In switcher - create horizontal layout.
              2. Create QLabel and set it's style via QSS.
              3. Move it in layout.
              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