summaryrefslogtreecommitdiff
path: root/src/selectiondialog.cpp
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2015-01-29 19:26:42 +0100
committerTannin <devnull@localhost>2015-01-29 19:26:42 +0100
commit8aa6dc4c7dcf4139cd0144207a327013bd3cb1dc (patch)
tree06a28839549304e32b5774b37fba07ca4413bc03 /src/selectiondialog.cpp
parentc3a95bdef1d989a54684b966e042b12bf682046d (diff)
extended the game-plugin interface
Diffstat (limited to 'src/selectiondialog.cpp')
-rw-r--r--src/selectiondialog.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/selectiondialog.cpp b/src/selectiondialog.cpp
index 1b284928..aae95f56 100644
--- a/src/selectiondialog.cpp
+++ b/src/selectiondialog.cpp
@@ -22,8 +22,8 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <QCommandLinkButton>
-SelectionDialog::SelectionDialog(const QString &description, QWidget *parent)
- : QDialog(parent), ui(new Ui::SelectionDialog), m_Choice(nullptr), m_ValidateByData(false)
+SelectionDialog::SelectionDialog(const QString &description, QWidget *parent, const QSize &iconSize)
+ : QDialog(parent), ui(new Ui::SelectionDialog), m_Choice(nullptr), m_ValidateByData(false), m_IconSize(iconSize)
{
ui->setupUi(this);
@@ -35,10 +35,24 @@ SelectionDialog::~SelectionDialog()
delete ui;
}
-
void SelectionDialog::addChoice(const QString &buttonText, const QString &description, const QVariant &data)
{
- QCommandLinkButton *button = new QCommandLinkButton(buttonText, description, ui->buttonBox);
+ QAbstractButton *button = new QCommandLinkButton(buttonText, description, ui->buttonBox);
+ if (m_IconSize.isValid()) {
+ button->setIconSize(m_IconSize);
+ }
+ button->setProperty("data", data);
+ ui->buttonBox->addButton(button, QDialogButtonBox::AcceptRole);
+ if (data.isValid()) m_ValidateByData = true;
+}
+
+void SelectionDialog::addChoice(const QIcon &icon, const QString &buttonText, const QString &description, const QVariant &data)
+{
+ QAbstractButton *button = new QCommandLinkButton(buttonText, description, ui->buttonBox);
+ if (m_IconSize.isValid()) {
+ button->setIconSize(m_IconSize);
+ }
+ button->setIcon(icon);
button->setProperty("data", data);
ui->buttonBox->addButton(button, QDialogButtonBox::AcceptRole);
if (data.isValid()) m_ValidateByData = true;
@@ -49,7 +63,6 @@ int SelectionDialog::numChoices() const
return ui->buttonBox->findChildren<QCommandLinkButton*>(QString()).count();
}
-
QVariant SelectionDialog::getChoiceData()
{
return m_Choice->property("data");