Results 1 to 5 of 5

Thread: QSpinBox with checkbox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSpinBox with checkbox

    The code is somewhat cluttered, it's hard to say what each variables represent... Anyway... you can get the value in the spinbox by using QSpinBox::value() and the value of the checkbox using QCheckBox::isChecked(). Then you can make an if statement that checks whether the checkbox is checked and if the item should be accepted. Pseudo code follows:
    Qt Code:
    1. if(firstcheck->isChecked() && item->value()<firstspin->value()){
    2. ignoretheitem = true;
    3. }
    4. if(secondcheck->isChecked() && item->value()>secondspin->value()){
    5. ignoretheitem = true;
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: QSpinBox with checkbox

    wysota,
    i have used ur code but i get errors, this is how i did it

    optionsDlg dlg(this);

    if (dlg.firstCheckBox->isChecked() &&
    item->getCol_Val() > dlg.spinBox1->value() )
    {

    item->setVisible(true);

    }

    if (dlg.secondCheckBox->isChecked()
    && item->getCol_Val() < dlg.spinBox2->value())
    {
    item->setVisible(true);
    }
    i get these errors:

    : error C2027: use of undefined type 'QSpinBox'
    : error C2227: left of '->value' must point to class/struct/union
    : error C2027: use of undefined type 'QSpinBox'
    : see declaration of 'QSpinBox'
    : error C2227: left of '->value' must point to class/struct/union
    i have linked my dialogu with my code,
    Love::Peace

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSpinBox with checkbox

    1. I said it was pseudocode
    2. You probably forgot to include <QSpinBox>

  4. #4
    Join Date
    Feb 2006
    Posts
    51
    Thanks
    7

    Default Re: QSpinBox with checkbox

    Quote Originally Posted by wysota View Post
    1. I said it was pseudocode
    2. You probably forgot to include <QSpinBox>
    jah thanks i had forgotten to include <Qspinbox.h>

    but it doesnt work yet..
    Love::Peace

Similar Threads

  1. Replies: 3
    Last Post: 1st April 2011, 04:58
  2. QSpinBox and setStylesheet problem
    By Ace-X in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2007, 11:21
  3. float value to Qspinbox
    By nErnie in forum Qt Programming
    Replies: 6
    Last Post: 17th October 2006, 08:16
  4. checkbox
    By nErnie in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2006, 21:59
  5. Problem reimplementing QSpinBox in a custom widget
    By hvengel in forum Qt Programming
    Replies: 1
    Last Post: 30th March 2006, 08:12

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
  •  
Qt is a trademark of The Qt Company.