comparison widgets/ListInputDialog.h @ 126:0e95c127bb53

* New dialog for selection from a list of items through radio buttons rather than a combobox * Move system-specific init stuff out into another file (to avoid Window naming conflict (X11 vs base/Window.h))
author Chris Cannam
date Thu, 27 Jul 2006 16:08:04 +0000
parents
children cd81066ac7ad
comparison
equal deleted inserted replaced
125:999ae0f7d10c 126:0e95c127bb53
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version. See the file
12 COPYING included with this distribution for more information.
13 */
14
15 #ifndef _LIST_INPUT_DIALOG_H_
16 #define _LIST_INPUT_DIALOG_H_
17
18 #include <QDialog>
19 #include <QString>
20 #include <QStringList>
21
22 #include <vector>
23
24 class QRadioButton;
25
26 /**
27 * Like QInputDialog::getItem(), except that it offers the items as a
28 * set of radio buttons instead of in a single combo box.
29 */
30
31 class ListInputDialog : public QDialog
32 {
33 public:
34 virtual ~ListInputDialog();
35
36 static QString getItem(QWidget *parent, const QString &title,
37 const QString &label, const QStringList &list,
38 int current = 0, bool *ok = 0, Qt::WFlags f = 0);
39
40 protected:
41 ListInputDialog(QWidget *parent, const QString &title,
42 const QString &label, const QStringList &list,
43 int current = 0, Qt::WFlags f = 0);
44
45 QString getCurrentString() const;
46
47 QStringList m_strings;
48 std::vector<QRadioButton *> m_radioButtons;
49 };
50
51 #endif