Results 1 to 2 of 2

Thread: Connecting Vertical Slider + PushButton to change variable in class

  1. #1
    Join Date
    May 2014
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Connecting Vertical Slider + PushButton to change variable in class

    Hi!
    I want user to choose a value using Vertical Slider and then click PushButton to accept chosen value.
    Signal (?) should change variable in other class and QLineEdit in the same window. How to implement this?
    Will it be a problem that I used QtDesigner to create those widgets?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Connecting Vertical Slider + PushButton to change variable in class

    You can use a slot connected to the slider's valueChanged() signal if you want to update the line edit and variable when the slider is dragged.
    Then, in the slot connected to the button's clicked() signal you do whatever action you want to do with the new value.

    If you don't need live update, you only need the slot connected to the button's clicked() signal.

    And no, it does not change anything if you create the widgets using designer.

    Cheers,
    _

Similar Threads

  1. vertical pushbutton text
    By eric in forum Qt Programming
    Replies: 11
    Last Post: 18th April 2019, 19:17
  2. vertical slider
    By TomASS in forum Newbie
    Replies: 4
    Last Post: 29th November 2009, 00:30
  3. linking a slider to a global variable
    By switch in forum Newbie
    Replies: 6
    Last Post: 5th August 2009, 08:02
  4. how to infrom a different class of a change in variable..
    By salmanmanekia in forum General Programming
    Replies: 3
    Last Post: 15th August 2008, 15:36
  5. connecting image to a pushbutton
    By sudheer in forum Qt Tools
    Replies: 2
    Last Post: 4th December 2007, 09:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.