Hi there. This is more of a C++ question than Qt but this is the first time I have run into it...
I am working on a simple grade calculator using spin boxes. The number of spin boxes (for grade and assignment weighting) is determined by how many grades the user inputs in another slider/spinbox. My program works fine but there is ALOT of redundant code it seems. I would really like to shorten it up, make it more managable because there are some changes I would like to make.
For example. Right now I have 8 functions like this:
Qt Code:
void MainWindow::show_ass_1() { ass_label_1->show(); ass_grade_SpinBox_1->show(); ass_weight_SpinBox_1->show();To copy to clipboard, switch view to plain text mode
Labelled 1 - 8 with accompanying labels and spinboxes of the same number. These are my functions just to unhide part of the interface. To hide them, there are 8 more functions that do the opposite. To call the functions I am using a switch statement.
Is there a way that I can somehow reduce the number of lines? If someone can point me in the right direction I would appreciate it, thanks.
Bookmarks