Navigation Menu

Skip to content

Commit

Permalink
Provide an optional checkbox in the message viewer for such things as
Browse files Browse the repository at this point in the history
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 0527a4b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
23 changes: 23 additions & 0 deletions src/gui/qgsmessageviewer.cpp
Expand Up @@ -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()
Expand All @@ -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();
}
9 changes: 9 additions & 0 deletions src/gui/qgsmessageviewer.h
Expand Up @@ -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
25 changes: 16 additions & 9 deletions src/ui/qgsmessageviewer.ui
Expand Up @@ -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" >
Expand All @@ -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>
Expand All @@ -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>
Expand All @@ -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" />
Expand Down

0 comments on commit 0527a4b

Please sign in to comment.