annotate ui/certificateitemwidget.h @ 701:31c3d2bc9880

(Issue22) Fix painting problems with fixed size in windows style. We now use fusion style also on Windows for the combobox to let it be shown in the same way as we do on GNU/Linux.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 02 Jul 2014 11:26:42 +0200
parents 973a7ce19658
children 9c4543128666
rev   line source
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
3 *
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
6 * See LICENSE.txt for details.
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
7 */
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
8 #ifndef CERTIFICATELISTITEM_H
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
9 #define CERTIFICATELISTITEM_H
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
10 /**
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
11 * @file certificateitemdelegate.h
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
12 * @brief Item delegate drawing custom certificate items in list views.
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
13 *
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
14 */
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
15 #include <QWidget>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
16 #include <QLabel>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
17 #include <QComboBox>
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 #include "certificate.h"
701
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
20 /** @brief A combo box that shows the text only in the popup
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
21 *
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
22 * The text shown is the data set as Qt::UserRole
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
23 */
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
24 class IconOnlyTextPopupBox : public QComboBox
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
25 {
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
26 protected:
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
27 virtual void showPopup();
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
28 virtual void hidePopup();
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
29 };
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
30
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
32 class CertificateItemWidget : public QWidget
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 {
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
34 Q_OBJECT
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
35 public:
638
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
36 CertificateItemWidget(
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
37 QWidget *parent = 0,
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
38 const Certificate &cert = Certificate(),
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
39 bool state = false,
687
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 638
diff changeset
40 bool editable = true,
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 638
diff changeset
41 const QString& installLabel = tr("install"),
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 638
diff changeset
42 const QString& removeLabel = tr("remove"));
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
43
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
44 bool state();
638
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
45 void setState(bool state);
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
46 Certificate certificate();
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
47
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
48 private:
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
49 void setupGUI();
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
50
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
51 Certificate mCertificate;
638
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
52 bool mState;
9d806f140bd5 Added state and editable flag to certificate list items.
Raimund Renkert <rrenkert@intevation.de>
parents: 627
diff changeset
53 bool mEditable;
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 QLabel *mLabel;
701
31c3d2bc9880 (Issue22) Fix painting problems with fixed size in windows style.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 687
diff changeset
55 IconOnlyTextPopupBox *mComboBox;
687
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 638
diff changeset
56 QString mInstallLabel;
973a7ce19658 (issue24) Let the string for install / remove be set for each item individually
Andre Heinecke <andre.heinecke@intevation.de>
parents: 638
diff changeset
57 QString mRemoveLabel;
627
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
58
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
59 private slots:
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
60 void currentStateChanged(int ndx);
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
61
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
62 signals:
566ee111e331 Added state to certificate list item and updated certificate list widget.
Raimund Renkert <rrenkert@intevation.de>
parents: 582
diff changeset
63 void stateChanged(bool state, const Certificate &cert);
582
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
64 };
88c9bdc74175 New widgets to display certificates in lists.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
65 #endif

http://wald.intevation.org/projects/trustbridge/