diff options
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp | 8 | ||||
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp index 74d9c59..155bd4f 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.cpp @@ -15,6 +15,7 @@ #include <cassert> #include <QHBoxLayout> +#include <QToolTip> namespace Swift { @@ -38,6 +39,7 @@ void QtVCardGeneralField::initialize() { ); layout->addWidget(preferredCheckBox, row, 0, Qt::AlignVCenter); childWidgets << preferredCheckBox; + connect(preferredCheckBox, SIGNAL(stateChanged(int)), SLOT(handlePreferredStarStateChanged(int))); } label = new QLabel(this); label->setText(labelText); @@ -124,6 +126,12 @@ void QtVCardGeneralField::handleCloseButtonClicked() { deleteField(this); } +void QtVCardGeneralField::handlePreferredStarStateChanged(int state) { + if (state == Qt::Checked) { + QToolTip::showText(QCursor::pos(), tr("Marked as your preferred %1. Click again to undo.").arg(labelText)); + } +} + void QtVCardGeneralField::updatePreferredStarVisibility() { if (preferredCheckBox) { bool showStar = false; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h index 93d326b..4f4cccd 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardGeneralField.h @@ -65,6 +65,7 @@ class QtVCardGeneralField : public QWidget { public slots: void handleCloseButtonClicked(); + void handlePreferredStarStateChanged(int statte); protected: QList<QWidget*> childWidgets; |