• I am new to Qt ..can nyone tell me how can I add around 36 checkboxes in a wizard???

  • Do you use Qt Creator or Qt Designer? You can do this using Qt user-interface.
    Otherwise you should create pointers and objects in your ui-class constructor (example from Qt Doc):

    QCheckBox *checkbox = new QCheckBox("Case sensitive", this);

    The best way to use Checkboxes is to use them inside QGroupBox.
    Hope it helps.

  • Please read "QCheckBox":http://qt-project.org/doc/qt-5.0/qcheckbox.html documentation. QCheckBox inherits "QAbstractButton":http://qt-project.org/doc/qt-5.0/qabstractbutton.html and "QWidget":http://qt-project.org/doc/qt-5.0/qwidget.html so you can add it to a layout as a standard widget.

  • I'd suggest to re-think your GUI design. Do you really expect your users to find their way through 30+ checkboxes on a single page of a wizard? Is that a usable interface?

    If you must present that many checkboxes, and they are all on the same level, considder using a list with checkable items. Make sure you add a filter above the list to the user can trim down the list quickly to only the relevant items.

  • I think use dynamic checkboxes.

    This is my code, but this is C#.

    @private void GenerateDynamicControls(int amount)
    //Clear existing

            for (int i = 0; i < amount; i++)
                //Create the Textbox
                TextBox dynamicTextbox = new TextBox();
                dynamicTextbox.Name = "dynamicTextbox" + i.ToString();
                dynamicTextbox.Width = 290;
                dynamicTextbox.Height = 20;
                dynamicTextbox.Left = 9;
                dynamicTextbox.Top = 10 + (dynamicTextbox.Height * i) + (10 * i); //initial + height + padding
                dynamicTextbox.Text = @"This is textbox number " + (i + 1).ToString();
                //Create the Button
                Button dynamicButton = new Button();
                dynamicButton.Name = "dynamicButton" + i.ToString();
                dynamicButton.Width = 75;
                dynamicButton.Height = 23;
                dynamicButton.Left = dynamicTextbox.Left + dynamicTextbox.Width + 5;
                dynamicButton.Top = dynamicTextbox.Top; //Center the button vertically to textbox
                dynamicButton.Text = "Show";
                dynamicButton.Click += new EventHandler(Button_Click); //hook the Click event
                //Add them to the container

  • Andre said right,36 checkBox in a single form are not good for interface!
    but! if you are newbie, u can use this method for generate dynamically controls :
    for(int i=0;i<37;i++){
    QCheckBox *chkbox = new QCheckBox();

    all of properties can be include in the "for" statement.
    have a good code ;)

  • I am using 36 checkboxes for vertices in a graph .Checkboxes will consist of alphabets and digits and user will be required to check the box corresponding to vertices in his graph...

  • Boy, it sure sounds I should be glad I don't have to use your application... Anyway, best of luck!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.