[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kxstitch] src: Added tooltip to Library Manager dialog
From: Steve Allewell <steve.allewell () gmail ! com>
Date: 2014-07-12 22:26:42
Message-ID: E1X65kg-0006LC-5Q () scm ! kde ! org
[Download RAW message or body]
Git commit 945814571901cdd559617372f8e119ff40afad4e by Steve Allewell.
Committed on 12/07/2014 at 22:24.
Pushed by sallewell into branch 'master'.
Added tooltip to Library Manager dialog
M +31 -0 src/LibraryManagerDlg.cpp
M +3 -0 src/LibraryManagerDlg.h
http://commits.kde.org/kxstitch/945814571901cdd559617372f8e119ff40afad4e
diff --git a/src/LibraryManagerDlg.cpp b/src/LibraryManagerDlg.cpp
index b3061a4..3362d59 100644
--- a/src/LibraryManagerDlg.cpp
+++ b/src/LibraryManagerDlg.cpp
@@ -14,7 +14,9 @@
#include <QClipboard>
#include <QDir>
#include <QFileInfoList>
+#include <QHelpEvent>
#include <QMimeData>
+#include <QToolTip>
#include <KInputDialog>
#include <KMessageBox>
@@ -63,6 +65,35 @@ LibraryTreeWidgetItem *LibraryManagerDlg::currentLibrary()
}
+bool LibraryManagerDlg::event(QEvent *event)
+{
+ if (event->type() == QEvent::ToolTip) {
+ QHelpEvent *helpEvent = static_cast<QHelpEvent *>(event);
+ QString tip;
+
+ if (ui.LibraryTree->topLevelItemCount() == 0) {
+ tip = i18n("The Library Manager can be used to store\nreusable patterns \
for insertion into\nnew patterns.\n\nThere are no library categories defined.\nClick \
the Help button for information on creating\nand populating libraries."); + } \
else { + if (ui.LibraryTree->currentItem() == 0) {
+ tip = i18n("Select a library to show the associated patterns.");
+ } else if (ui.LibraryIcons->count() == 0) {
+ tip = i18n("There are no patterns defined\nfor this \
library.\n\nClick the Help button for information\non creating and populating \
libraries."); + }
+ }
+
+ if (!tip.isEmpty()) {
+ QToolTip::showText(helpEvent->globalPos(), tip);
+ } else {
+ QToolTip::hideText();
+ }
+
+ return true;
+ }
+
+ return QWidget::event(event);
+}
+
+
void LibraryManagerDlg::setCellSize(double cellWidth, double cellHeight)
{
ui.LibraryIcons->setCellSize(cellWidth, cellHeight);
diff --git a/src/LibraryManagerDlg.h b/src/LibraryManagerDlg.h
index 03f5991..ba0e678 100644
--- a/src/LibraryManagerDlg.h
+++ b/src/LibraryManagerDlg.h
@@ -36,6 +36,9 @@ public:
LibraryTreeWidgetItem *currentLibrary();
+protected:
+ virtual bool event(QEvent *);
+
public slots:
void setCellSize(double, double);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic