Skip to content
Permalink
Browse files
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
  • Loading branch information
g_j_m committed Sep 18, 2006
1 parent f901b17 commit 0527a4b2e8a48dcad8239d9ac3ee5f8989bd9ff7
Showing with 48 additions and 9 deletions.
  1. +23 −0 src/gui/qgsmessageviewer.cpp
  2. +9 −0 src/gui/qgsmessageviewer.h
  3. +16 −9 src/ui/qgsmessageviewer.ui
@@ -23,6 +23,9 @@ QgsMessageViewer::QgsMessageViewer(QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl)
{
setupUi(this);
// Default state for the checkbox
setCheckBoxVisible(false);
setCheckBoxState(Qt::Unchecked);
}

QgsMessageViewer::~QgsMessageViewer()
@@ -43,3 +46,23 @@ void QgsMessageViewer::appendMessage(const QString& msg)
{
txtMessage->append(msg);
}

void QgsMessageViewer::setCheckBoxText(const QString& text)
{
checkBox->setText(text);
}

void QgsMessageViewer::setCheckBoxVisible(bool visible)
{
checkBox->setVisible(visible);
}

void QgsMessageViewer::setCheckBoxState(Qt::CheckState state)
{
checkBox->setCheckState(state);
}

Qt::CheckState QgsMessageViewer::checkBoxState()
{
return checkBox->checkState();
}
@@ -35,6 +35,15 @@ class QgsMessageViewer: public QDialog, private Ui::QgsMessageViewer
// Treats the given text as plain text
void setMessageAsPlainText(const QString& msg);
void appendMessage(const QString& msg);
// A checkbox that can be used for something like
// "don't show this message again"
void setCheckBoxText(const QString& text);
// Make the check box visible/invisible
void setCheckBoxVisible(bool visible);
// Sets the check state
void setCheckBoxState(Qt::CheckState state);
// The state of the checkbox
Qt::CheckState checkBoxState();
};

#endif
@@ -22,6 +22,13 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QCheckBox" name="checkBox" >
<property name="text" >
<string>Don't show this message again</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QTextEdit" name="txtMessage" >
<property name="lineWidth" >
@@ -35,7 +42,14 @@
</property>
</widget>
</item>
<item row="1" column="2" >
<item row="2" column="1" >
<widget class="QPushButton" name="btnClose" >
<property name="text" >
<string>Close</string>
</property>
</widget>
</item>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -51,7 +65,7 @@
</property>
</spacer>
</item>
<item row="1" column="0" >
<item row="2" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -67,13 +81,6 @@
</property>
</spacer>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="btnClose" >
<property name="text" >
<string>Close</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />

0 comments on commit 0527a4b

Please sign in to comment.