Results 1 to 7 of 7

Thread: QCombobox remove checkbox

  1. #1
    ucomesdag Guest

    Default QCombobox remove checkbox

    Hi,

    I have for some reason check boxes on all QComboBoxes, when I use the plastic style and set a minimum width with view(). I wonder how can I get rid of them.

    Qt Code:
    1. comboBox->view()->setMinimumWidth( lenght );
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images
    Last edited by ucomesdag; 31st July 2007 at 19:56. Reason: Rephrased question

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCombobox remove checkbox

    Quote Originally Posted by ucomesdag View Post
    Hi,

    I have for some reason check boxes on all QComboBoxes, when I use the plastic style and set a minimum width with view(). I wonder how can I get rid of them.

    Qt Code:
    1. comboBox->view()->setMinimumWidth( lenght );
    To copy to clipboard, switch view to plain text mode 
    But that's weird. Shouldn't happen. What about other styles?

    Regards

  3. #3
    ucomesdag Guest

    Default Re: QCombobox remove checkbox

    Quote Originally Posted by marcel View Post
    But that's weird. Shouldn't happen. What about other styles?

    On windows the same code is fine and without the plastik style on linux it is also fine.

    ...But without the plastik style it screwsup the layout...

  4. #4
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCombobox remove checkbox

    Then it must be a bug in the style somewhere.
    Probably a wrong condition in an "if" statement, and there you have your checkboxes.

    Just saying... I am not sure exactly if that is the error, but the style is definitely to blame.

    Regards

  5. #5
    ucomesdag Guest

    Default Re: QCombobox remove checkbox

    Seems that setting any style on Linux generates check boxes with QCombobox.
    When using view() it seems to set all possible option, I noticed a big scroll Button on top and bottom of the list with all other styles...
    If someone has a hint or way to get rid of them or set the width of the list without using view() ....
    Last edited by ucomesdag; 31st July 2007 at 23:30.

  6. #6
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QCombobox remove checkbox

    Could you post an example reproducing the problem?
    Or at least a portion of your code? For example, where do you create and initialize the combo box.

    AFAIK, Jpn did something like this( a custom combo with checkable items ), just because it did not existed by default.

    So, I say it again, it is pretty weird.
    Check this out: http://jpnurmi.kapsi.fi/blog/2007/07...-2007/#respond

    Regards

  7. #7
    ucomesdag Guest

    Default Re: QCombobox remove checkbox

    Quote Originally Posted by marcel View Post
    Could you post an example reproducing the problem?
    Or at least a portion of your code? For example, where do you create and initialize the combo box.

    AFAIK, Jpn did something like this( a custom combo with checkable items ), just because it did not existed by default.

    So, I say it again, it is pretty weird.
    Check this out: http://jpnurmi.kapsi.fi/blog/2007/07...-2007/#respond

    Regards
    The original code:
    Qt Code:
    1. QComboBox comboBox = new QComboBox(this);
    2. comboBox ->setGeometry(geometry);
    3. comboBox ->setEditable(false);
    4. comboBox ->setFrame(false);
    5. comboBox ->setMaxVisibleItems(itemsCount);
    6. comboBox ->view()->setMinimumWidth(width);
    To copy to clipboard, switch view to plain text mode 
    This fixed the check box thing but has some weird scroll issues:
    Qt Code:
    1. QListView *view = new QListView;
    2. view->setAutoScroll(false);
    3. view->setMinimumWidth(width);
    4.  
    5. QComboBox comboBox = new QComboBox(this);
    6. comboBox ->setGeometry(geometry);
    7. comboBox ->setEditable(false);
    8. comboBox ->setFrame(false);
    9. comboBox ->setMaxVisibleItems(itemsCount);
    10. comboBox ->setView(view);
    To copy to clipboard, switch view to plain text mode 
    Btw. The parent widget has setStyle(QStyleFactory::create("plastique"));
    Attached Images Attached Images
    Last edited by ucomesdag; 1st August 2007 at 02:03.

Similar Threads

  1. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 09:58

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.