Akiva
8th September 2013, 01:33
Someone told me there is no proper way to do what I want to do, so I guess just tell me what you would do.
Here is a sample of my code from my .cpp file
card_Estate = new QToolButton();
card_Estate->setCheckable(true);
card_Estate->setText("Estate");
card_Estate->setToolTip("<img src=':/Cards/Estate.jpg' width='250'>");
ui->verticalLayout_Disabled->addWidget(card_Estate);
connect(card_Estate, SIGNAL(clicked(bool)), this, SLOT(SLOTcard_Estate(bool)));
Now I need to duplicate this code 200 times. The only difference in each duplication is that the word "Estate" is replaced by another word, and that other word corresponds to the name of a file found in a folder or resource file: "<img src=':/Cards/Estate.jpg' width='250'>" , <img src=':/Cards/Copper.jpg' width='250'>, <img src=':/Cards/Dutchy.jpg' width='250'>,
etc~
Thanks for any ideas.
edit:
Oh, and I forgot to ask; is this same sort of thing possible with the header file as well, or is it best in that case to just manually declare 200 buttons?
Here is a sample of my code from my .cpp file
card_Estate = new QToolButton();
card_Estate->setCheckable(true);
card_Estate->setText("Estate");
card_Estate->setToolTip("<img src=':/Cards/Estate.jpg' width='250'>");
ui->verticalLayout_Disabled->addWidget(card_Estate);
connect(card_Estate, SIGNAL(clicked(bool)), this, SLOT(SLOTcard_Estate(bool)));
Now I need to duplicate this code 200 times. The only difference in each duplication is that the word "Estate" is replaced by another word, and that other word corresponds to the name of a file found in a folder or resource file: "<img src=':/Cards/Estate.jpg' width='250'>" , <img src=':/Cards/Copper.jpg' width='250'>, <img src=':/Cards/Dutchy.jpg' width='250'>,
etc~
Thanks for any ideas.
edit:
Oh, and I forgot to ask; is this same sort of thing possible with the header file as well, or is it best in that case to just manually declare 200 buttons?