Results 1 to 2 of 2

Thread: QSpinbox value changes only by double click on up/down button

  1. #1
    Join Date
    Jul 2019
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSpinbox value changes only by double click on up/down button

    My Spinbox changes value only by double clicking up/down button. I want o change this to value change on single click. Can anybody help me on how to do this please?


    Added after 1 41 minutes:


    Quote Originally Posted by PradeepP View Post
    My Spinbox changes value only by double clicking up/down button. I want o change this to value change on single click. Can anybody help me on how to do this please?
    Further information: I noticed that eventfilter() function of window on which spinbox is used is actually preventing it to increment/decrement values on single click. I want to display soft keyboard and set focus on clicked spinbox and hence evenfilter() is implemented. The code snippet is as below:
    if (event->type() == QEvent::MouseButtonPress) {
    if (object->objectName() == "brightSpinbox" ) {
    show_keyboard();
    ui->brightSpinbox->setFocus();
    return true;
    }
    return false;
    }
    I want to have this functionality in place as well as increment/decrement values of spinbox on single click. Can anybody please help?
    Last edited by PradeepP; 11th December 2019 at 09:38.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QSpinbox value changes only by double click on up/down button

    Your method is returning "true" when it finds a MouseButtonPress event for your spin box. This means the event is prevented from reaching the spin box for its normal handling (eg. an up/down click). Return false instead so the event gets passed along to the spin box.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 4
    Last Post: 11th January 2014, 04:06
  2. Replies: 2
    Last Post: 16th July 2012, 13:40
  3. Replies: 2
    Last Post: 28th November 2011, 16:12
  4. Replies: 2
    Last Post: 12th January 2009, 00:24
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 17:40

Tags for this Thread

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.