Skip to content

Commit 0527a4b

Browse files
author
g_j_m
committedSep 18, 2006
Provide an optional checkbox in the message viewer for such things as
a "don't show this message again" use. git-svn-id: http://svn.osgeo.org/qgis/trunk@5835 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent f901b17 commit 0527a4b

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed
 

‎src/gui/qgsmessageviewer.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ QgsMessageViewer::QgsMessageViewer(QWidget *parent, Qt::WFlags fl)
2323
: QDialog(parent, fl)
2424
{
2525
setupUi(this);
26+
// Default state for the checkbox
27+
setCheckBoxVisible(false);
28+
setCheckBoxState(Qt::Unchecked);
2629
}
2730

2831
QgsMessageViewer::~QgsMessageViewer()
@@ -43,3 +46,23 @@ void QgsMessageViewer::appendMessage(const QString& msg)
4346
{
4447
txtMessage->append(msg);
4548
}
49+
50+
void QgsMessageViewer::setCheckBoxText(const QString& text)
51+
{
52+
checkBox->setText(text);
53+
}
54+
55+
void QgsMessageViewer::setCheckBoxVisible(bool visible)
56+
{
57+
checkBox->setVisible(visible);
58+
}
59+
60+
void QgsMessageViewer::setCheckBoxState(Qt::CheckState state)
61+
{
62+
checkBox->setCheckState(state);
63+
}
64+
65+
Qt::CheckState QgsMessageViewer::checkBoxState()
66+
{
67+
return checkBox->checkState();
68+
}

‎src/gui/qgsmessageviewer.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ class QgsMessageViewer: public QDialog, private Ui::QgsMessageViewer
3535
// Treats the given text as plain text
3636
void setMessageAsPlainText(const QString& msg);
3737
void appendMessage(const QString& msg);
38+
// A checkbox that can be used for something like
39+
// "don't show this message again"
40+
void setCheckBoxText(const QString& text);
41+
// Make the check box visible/invisible
42+
void setCheckBoxVisible(bool visible);
43+
// Sets the check state
44+
void setCheckBoxState(Qt::CheckState state);
45+
// The state of the checkbox
46+
Qt::CheckState checkBoxState();
3847
};
3948

4049
#endif

‎src/ui/qgsmessageviewer.ui

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@
2222
<property name="spacing" >
2323
<number>6</number>
2424
</property>
25+
<item row="1" column="0" >
26+
<widget class="QCheckBox" name="checkBox" >
27+
<property name="text" >
28+
<string>Don't show this message again</string>
29+
</property>
30+
</widget>
31+
</item>
2532
<item row="0" column="0" colspan="3" >
2633
<widget class="QTextEdit" name="txtMessage" >
2734
<property name="lineWidth" >
@@ -35,7 +42,14 @@
3542
</property>
3643
</widget>
3744
</item>
38-
<item row="1" column="2" >
45+
<item row="2" column="1" >
46+
<widget class="QPushButton" name="btnClose" >
47+
<property name="text" >
48+
<string>Close</string>
49+
</property>
50+
</widget>
51+
</item>
52+
<item row="2" column="0" >
3953
<spacer>
4054
<property name="orientation" >
4155
<enum>Qt::Horizontal</enum>
@@ -51,7 +65,7 @@
5165
</property>
5266
</spacer>
5367
</item>
54-
<item row="1" column="0" >
68+
<item row="2" column="2" >
5569
<spacer>
5670
<property name="orientation" >
5771
<enum>Qt::Horizontal</enum>
@@ -67,13 +81,6 @@
6781
</property>
6882
</spacer>
6983
</item>
70-
<item row="1" column="1" >
71-
<widget class="QPushButton" name="btnClose" >
72-
<property name="text" >
73-
<string>Close</string>
74-
</property>
75-
</widget>
76-
</item>
7784
</layout>
7885
</widget>
7986
<layoutdefault spacing="6" margin="11" />

0 commit comments

Comments
 (0)
Please sign in to comment.